Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hello,
I want to delete only the suppressed parts from creo assembly using protoolkit.
I am able to delete using the feature_ids with the function ProFeatureDelete(), But, it is deleting all the parts of the feature_ids I provide, irrespective of the status (active and suppressed)
I want it to filter out between active and suppressed parts ,and then only delete the suppressed ones.
Thanks and Regards,
Disha
One method that comes to mind would be to traverse the assembly tree using ProSolidFeatVisit, this has a filter action ProFeatureFilterAction.
Within the filter action, you could use something like this:
ProError UserAsmCompFilter(
ProFeature *feature,
ProAppData app_data)
{
ProError status;
ProFeattype ftype;
ProFeatStatus fstatus;
//Only want to consider assembly components
status = ProFeatureTypeGet(feature, &ftype);
if (ftype == PRO_FEAT_COMPONENT)
{
status = ProFeatureStatusGet(feature, &fstatus);
/* Assume we only want NON-active features */
switch (fstatus)
{
case PRO_FEAT_ACTIVE:
return(PRO_TK_CONTINUE); //Skip past the active components
break;
case PRO_FEAT_INVALID:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_INACTIVE:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_FAMTAB_SUPPRESSED:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_SIMP_REP_SUPPRESSED:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_PROG_SUPPRESSED:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_SUPPRESSED:
return(PRO_TK_NO_ERROR);
break;
case PRO_FEAT_UNREGENERATED:
return(PRO_TK_NO_ERROR);
break;
default:
return(PRO_TK_NO_ERROR);
break;
}
}
else
return(PRO_TK_CONTINUE);
}
This will then step into the visit_action with the component you want to delete, from here you can obtain the model details of the part you are at with ProAsmcompMdlGet, and then use ProMdlDelete
Thanks, I tried implementing this solution, using ProMdlDelete and also used ProSolidFeatVisit to visit the components and then only delete the suppressed features. But, still it is failing to filter them out.
How can I use ProFeatureWithoptionsDelete() and ProFeatureDelete() to then filter out the parts with the help of the suppressed feature Ids?
Get the assembly feature IDS, check that the feature is a component. If true get the feature status and decide what to do. To avoid miss leading status, because you have Undo/Redo, it might be better to save the part upfront.
Hello @DS_12573442,
It looks like you have some responses from some community members. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Vivek N.
Community Moderation Team.