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
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
CODE
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
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