Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
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?
Solved! Go to Solution.
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);
}
}
}
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);
}
}
}