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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to get surface color after selection?

CS_11420818
3-Visitor

How to get surface color after selection?

I am trying to get the color of surface after selecting it with a selection pointer as described in the toolkit user guide. It appears that the information resides wfcAppearance which is extracted from wfcWSelection.

 

pfcSelection_ptr selSurface = pfcCreateModelItemSelection(pfcModelItem::cast(surfaces->get(0)));
wfcWSelection_ptr wselSurface = wfcWSelection::cast(selSurface);

if (wselSurface->GetVisibleAppearance().isnull())
     cout << "Error: wfcAppearance nullptr" << endl;

 

but GetVisibleAppearance() is returning a nullptr.

 

However, when I select a surface using user selection process by directly clicking on it after invoking session->select(), I am able to get wfcAppearance where i can access surface properties including its color.

 

Can anyone please help why is GetVisibleAppearance() returning nullptr from pfcSelection_ptr when selecting a surface programmatically using pfcCreateModelItemSelection() instead of clicking on it?

 

If there is any other way I will appreciate it as well. Thank you.

 

Creo 4.0 M150

Toolkit C++

1 ACCEPTED SOLUTION

Accepted Solutions
Trebla
15-Moonstone
(To:CS_11420818)

Hi CS

I think this thread could help you.

View solution in original post

2 REPLIES 2
Trebla
15-Moonstone
(To:CS_11420818)

Hi CS

I think this thread could help you.

Hi @CS_11420818,


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.
Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator
Top Tags