cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding/Suppressing parts using Creo VB API

SOLVED
ptc-3329578
Newbie

Hiding/Suppressing parts using Creo VB API

I am trying to hide/unhide some of the parts in my drawing. What would be the best way to do it? In Creo I just right click and choose Hide but I can't find anywhere in the documentation on how to use this feature in the VB API.

Can this hidden feature be set as a parameter for the parts?


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Hiding/Suppressing parts using Creo VB API

I found out, I post the code if anyone else can use it (C#). So much code for such a simple task...

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

//connect

pfcls.CCpfcAsyncConnection asynconn = new pfcls.CCpfcAsyncConnection();

pfcls.IpfcAsyncConnection conn = asynconn.Connect("", "", ".", 5);

pfcls.IpfcBaseSession session = (pfcls.IpfcBaseSession)conn.Session;

session.SetConfigOption("regen_failure_handling", "resolve_mode");

pfcls.IpfcModel topModel = session.CurrentModel;

pfcls.IpfcAssembly assembly = (pfcls.IpfcAssembly) topModel;

pfcls.IpfcSolid solidComponent = (pfcls.IpfcSolid) assembly;

pfcls.IpfcFeatures featureComponents = solidComponent.ListFeaturesByType(true, pfcls.EpfcFeatureType.EpfcFEATTYPE_COMPONENT);

pfcls.CpfcFeatureOperations suppressFeatureOperations = new pfcls.CpfcFeatureOperations();

pfcls.CCpfcRegenInstructions regen = new pfcls.CCpfcRegenInstructions();

foreach (pfcls.IpfcFeature feature in featureComponents)

{

pfcls.IpfcComponentFeat compFeature = (pfcls.IpfcComponentFeat) feature;

if (compFeature.ModelDescr.InstanceName == "510-157")

{

suppressFeatureOperations.Append(feature.CreateSuppressOp());

}

}

solidComponent.ExecuteFeatureOps(suppressFeatureOperations, regen.Create(false, false, null));

solidComponent.Regenerate(regen.Create(false, false, null));

Console.ReadLine();

conn.Disconnect(2);

}

}

}

View solution in original post

1 REPLY 1

Re: Hiding/Suppressing parts using Creo VB API

I found out, I post the code if anyone else can use it (C#). So much code for such a simple task...

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

//connect

pfcls.CCpfcAsyncConnection asynconn = new pfcls.CCpfcAsyncConnection();

pfcls.IpfcAsyncConnection conn = asynconn.Connect("", "", ".", 5);

pfcls.IpfcBaseSession session = (pfcls.IpfcBaseSession)conn.Session;

session.SetConfigOption("regen_failure_handling", "resolve_mode");

pfcls.IpfcModel topModel = session.CurrentModel;

pfcls.IpfcAssembly assembly = (pfcls.IpfcAssembly) topModel;

pfcls.IpfcSolid solidComponent = (pfcls.IpfcSolid) assembly;

pfcls.IpfcFeatures featureComponents = solidComponent.ListFeaturesByType(true, pfcls.EpfcFeatureType.EpfcFEATTYPE_COMPONENT);

pfcls.CpfcFeatureOperations suppressFeatureOperations = new pfcls.CpfcFeatureOperations();

pfcls.CCpfcRegenInstructions regen = new pfcls.CCpfcRegenInstructions();

foreach (pfcls.IpfcFeature feature in featureComponents)

{

pfcls.IpfcComponentFeat compFeature = (pfcls.IpfcComponentFeat) feature;

if (compFeature.ModelDescr.InstanceName == "510-157")

{

suppressFeatureOperations.Append(feature.CreateSuppressOp());

}

}

solidComponent.ExecuteFeatureOps(suppressFeatureOperations, regen.Create(false, false, null));

solidComponent.Regenerate(regen.Create(false, false, null));

Console.ReadLine();

conn.Disconnect(2);

}

}

}

View solution in original post

Announcements