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

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

How to get Layer status of Drawing layers

Harsh9592
7-Bedrock

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.

Harsh9592_0-1638858662643.png

 

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.

 

Regards,

Harsh Patel

 

3 REPLIES 3
msteffke
14-Alexandrite
(To:Harsh9592)

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;
FILE *LAYVIS;
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);

if (DispStat != PRO_LAYER_TYPE_NORMAL)
{
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);
}


}
fclose(LAYVIS);

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).

 

Harsh9592_0-1638941601738.png

 

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

 

Regards,

Harsh Patel

FV
17-Peridot
17-Peridot
(To:Harsh9592)

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. 

FV_1-1638904372465.png

 

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' 

FV_0-1638904104052.png

 

 

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.

 

HIH.

Announcements


Top Tags