Skip to main content
4-Participant
July 18, 2024
Solved

How to get surface color after selection?

  • July 18, 2024
  • 2 replies
  • 1109 views

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++

Best answer by Trebla

Hi CS

I think this thread could help you.

2 replies

Trebla16-PearlAnswer
16-Pearl
July 24, 2024

Hi CS

I think this thread could help you.

Catalina
Community Moderator
July 25, 2024

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