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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to get Layer status of Drawing layers


How to get Layer status of Drawing layers

Hello All,


I am trying to get layer status of drawing layers using "ProLayerDisplaystatusGet".

As per my understanding, drawing includes model layers which can separately show/hide in drawing along with it's own layers.


I am not able to find the status of layers inside the drawing which comes from model.

please refer below snap for reference.



I found another API (ProDwgLayerDisplaystatusGet) which takes view as input. but I wants to check the status of layers which corresponds to drawing(TOP MODEL).


If I have wrong concept on layer then please correct me.


Thanks for the help.



Harsh Patel



For checking layer status,  I Visit the layers, and in the action call  use the ProLayerDisplaystatusGet.


tkerr = ProMdlRetrieve (w_partname, PRO_MDL_DRAWING, &mdl);



status = ProMdlLayerVisit(mdl, (ProLayerAction)LayVisitAction, (ProLayerAction)LayFilter,
(ProAppData)&BlankNotes );


This is my action function.   its been years since ive written this but it appears im just looking the status of notes on certain layers, and writing them to a file.

This just illustrates how I am calling the function, I hope this is useful.  


ProError LayVisitAction(
void *p_object, /* In: The pointer to the object
being visited */
ProAppData app_data) /* In: In fact it's ProArray** */

ProError status;
ProLayerDisplay *DispStat;
LayerAppdata *appd;
ProName layname;
ProModelitem p_item;
ProLayerItem *layer_items;
int n_item, j;

LAYVIS = fopen("c:\\temp\\layvis.txt","a");

appd = (LayerAppdata *)app_data;

status = ProMdlToModelitem(p_object, &p_item);
status = ProModelitemNameGet(p_object, layname);

ProLayerDisplaystatusGet(p_object, &DispStat);

fprintf(LAYVIS, "%S %d\n",layname, DispStat);

status = ProLayerItemsGet(p_object, &layer_items, &n_item);

for (j=0; j<n_item; j++)
appd->NoteID[0] = appd->NoteID[0] + 1; /* inc the counter, first element of int array */
appd->NoteID[appd->NoteID[0]] = layer_items[j].id;
fprintf(LAYVIS, "%d NoteID stat\n", layer_items[j].id);


return (status);


Thank you so much for help @msteffke .


I used similar visit function but it is collect only layers which is created inside Drawing files.


e.g in below snap highlighted layer(DRWLAYERS) is created in drawing. so Visit function collects only highlighted layer(DRWLAYERS).




@msteffke .in your case you only need layers which are created in drawing ?



Harsh Patel


The concept is wrong.


What we could see via GUI's 'Layer Tree' with 'Layer Tree Filter' - 'All Submodel Layers' is a conglomerated view of drawing layers and drawing's 'active model' layers presented as one collection. If a drawing view on the current sheet has 'special' layer status its layers could be also listed. 



What Pro/Toolkit layer visit function would actually be able to access could be viewed by selecting a combo-list item of available models from 'Layer Tree' 




All of this means that Pro/Toolkit app has to follow the same steps - get the current model, which would be a drawing, collect drawing layers, get drawing's models, collect layers, if a model is an assembly, collect components, collect component's layers and so on.

If drawing view layers needs to be accessed - use ProDwgLayerDisplayStatusGet() which will give drawing's layers visibility in the queried drawing view.


There are rules spelled in Creo Help how and when a drawing and/or a view layer visibility status would affect a model layer visibility.