×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Features SuppressFeatures

Features SuppressFeatures

Features SuppressFeatures

(OP)
Hi

I have radio buttons that when checked supress or unsupress features

In vb.net it works!

Dim features1(0) As Features.Feature
Dim featureGroup1 As Features.FeatureGroup = CType(workPart.Features.FindObject("FEATURE_SET(43)"), Features.FeatureGroup)
Dim errorFeatures1() As Features.Feature
features1(0) = featureGroup1
...
workPart.Features.SuppressFeatures(features1)

However when I tranfer this code to c# it does NOT! What's wrong?

NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1];
NXOpen.Features.FeatureGroup featureGroup1 = (NXOpen.Features.FeatureGroup)theSession.Parts.Work.Features.FindObject("FEATURE_SET(38)");
NXOpen.Features.Feature[] errorFeatures1;
features1[0] = featureGroup1

theSession.Parts.Work.Features.SuppressFeatures(features1[0], features1);

Thank you,Zoes

RE: Features SuppressFeatures

Try changing the last two lines to this

CODE

features1[0] = featureGroup1;

theSession.Parts.Work.Features.SuppressFeatures(features1); 

Also, you should avoid using FindObject function.
This is from the docs..

"In general, this method should not be used in handwritten code and exists to support record and playback of journals. An exception will be thrown if no object can be found with the given journal identifier."

Suresh
www.technisites.com.au

RE: Features SuppressFeatures

(OP)
Thanks for the reply

I have tried that but still have an error for overload method.
...
public FeatureGroup featureGroup1;
public FeatureGroup featureGroup2;
public Feature features1;
public Feature features2;
public Feature errorFeatures1;
public Feature errorFeatures2;
...
public classx()
{
InitializeComponent();
NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1];
NXOpen.Features.FeatureGroup featureGroup1 = (NXOpen.Features.FeatureGroup)theSession.Parts.Work.Features.FindObject("FEATURE_SET(2)");
NXOpen.Features.Feature[] errorFeatures1;

NXOpen.Features.Feature[] features2 = new NXOpen.Features.Feature[1];
NXOpen.Features.FeatureGroup featureGroup2 = (NXOpen.Features.FeatureGroup)theSession.Parts.Work.Features.FindObject("FEATURE_SET(3)");
NXOpen.Features.Feature[] errorFeatures2;
}
...
private void none_CheckedChanged(object sender, EventArgs e)
{

features1[0] = featureGroup1;
theSession.Parts.Work.Features.SuppressFeatures(features1);
features2[0] = featureGroup2;
theSession.Parts.Work.Features.SuppressFeatures(features2);
}

private void radio_CheckedChanged(object sender, EventArgs e)
{
errorFeatures1 = theSession.Parts.Work.Features.UnsuppressFeatures(features1)
theSession.Parts.Work.Features.SuppressFeatures(features2)
}

Can you see where the mistake can be?
Thank you,
Zoes

RE: Features SuppressFeatures


It will be easier to figure out if you post the entire code. Or try and record a journal in C# and see the difference in code.

Suresh
www.technisites.com.au

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources