Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello.
I have written a program to explore an assembly, by connection to an open PTC Creo session (using of ProEngineerConnect()).
This program uses the function ProSolidFeatVisit(visit_model_cb) to visit each component of the main assembly.
An the called function visit_model_cb() uses itself the ProSolidFeatVisit() function recursively.
So, the entire assembly is visited.
My probem is that I can not detect the hidden components, in visit_model_cb().
I tried ProFeatureVisibilityGet(), ProFeatureStatusGet(), ProAsmcompVisibilityGet() but all these functions return true for the visibility of the visited component, even if this component is hidden in PTC Creo.
I would appreciate any help to solve my problem.
Thank you.
Best regards.
Solved! Go to Solution.
How to identify a component feature and it's state, model type, internal visibility or whether shown, hidden or supressed in an assembly in Creo Parametric
https://www.ptc.com/en/support/article/CS312332
This extensive article deals with the issue
ProLayer.h
extern ProError ProModelitemIsHidden ( ProModelitem *item,
ProBoolean *is_hidden);
/*
Purpose: Identifies if the item is hidden via the "Hide" menu choice in
Creo Parametric or the related function ProModelitemHide().
Input Arguments:
item - The item.
Output Arguments:
is_hidden - PRO_B_TRUE if the item is hidden, PRO_B_FALSE otherwise.
Return Values:
PRO_TK_NO_ERROR - The function succeeded.
PRO_TK_BAD_INPUTS - One or more input arguments was invalid.
PRO_TK_INVALID_TYPE - The item is not permitted to be shown or hidden.
*/
extern ProError ProModelitemHide (ProModelitem* item);
/*
Purpose: Hides the item, similar to the Creo Parametric menu choice "Hide".
Input Arguments:
item - The layer item.
Output Arguments:
none
Return Values:
PRO_TK_NO_ERROR - The function succeeded.
PRO_TK_BAD_INPUTS - One or more input arguments was invalid.
PRO_TK_NO_CHANGE - The item was already hidden.
PRO_TK_INVALID_TYPE - The item is not permitted to be hidden.
PRO_TK_GENERAL_ERROR - A general error occurred and the function failed.
*/
extern ProError ProModelitemUnhide (ProModelitem* item);
/*
Purpose: Unhides the item, similar to the Creo Parametric menu choice
"Unhide".
Input Arguments:
item - The layer item.
Output Arguments:
none
Return Values:
PRO_TK_NO_ERROR - The function succeeded.
PRO_TK_BAD_INPUTS - One or more input arguments was invalid.
PRO_TK_NO_CHANGE - The item was already shown.
PRO_TK_INVALID_TYPE - The item is not permitted to be shown or hidden.
PRO_TK_GENERAL_ERROR - A general error occurred and the function failed.
*/
Hello.
Thank you for this answer.
ProModelitemIsHidden() works perfectly except when the component belongs to a layer which is hidden.
In this case, ProModelitemIsHidden() returns false, even if the component is not visible in the 3D view.
Il will try to use ProLayeritemStatusGet() by it means that I need to convert a ProFeature (parameter of visit_model_cb()) to a ProLayerItem and I have the impression that it is not so easy.
Regards.
How to identify a component feature and it's state, model type, internal visibility or whether shown, hidden or supressed in an assembly in Creo Parametric
https://www.ptc.com/en/support/article/CS312332
This extensive article deals with the issue