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

how can I get vertices, faces and color of the part or assembly parts

vvladimir
Newbie

how can I get vertices, faces and color of the part or assembly parts

Hello! Could you please tell me how can I get vertices, faces and colors oof the part or assembly parts in Pro/E Wildfire 4.0 using Pro/Toolkit (c++).


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
6 REPLIES 6

Re: how can I get vertices, faces and color of the part or assembly parts

Hello Vladimir,

how to do it, is nothing to explain in a few words in a thread.

I can just say that it is possible by accessing the geometry data of the model and that there are some examples about how to access that.

With colors you need to be aware that there are several levels of coloring possible for each surface (part surface color, model color and color assigned in assembly), so it depends whether you want to get the color currently showing or an underlying color.

Regards,

Gunter

Re: how can I get vertices, faces and color of the part or assembly parts

Hello Gunter,

It is quite clear. I do not want you to repeat chapters of user manual. However, could you please give me any clue/hint where to find.

Regards,

Vladimir

Re: how can I get vertices, faces and color of the part or assembly parts

Hello Vladimir,

I would start with the section "Visiting Solid Geometry" under the chapter "Core: 3D Geometry".

It explains in short, how to traverse down to the geometry items for vertices and faces.

ProSolidSurfaceVisit() and/or ProSolidQuiltVisit() are probably functions you will need at the top of traversing.

To get the colors of surfaces, I would use ProSurfaceAppearancepropsGet()

There are useful links from the function descriptions to User's Guide and sample code.

Regards,

Gunter


Re: how can I get vertices, faces and color of the part or assembly parts

Hello Gunter,

I could not find ProSurfaceAppearancepropsGet(). However, I could get

color in the following way:

lPart = pro_get_current_object();

props = (Pro_surf_props *)calloc(1, sizeof(Pro_surf_props));

memset(props,'\0',sizeof(Pro_surf_props));

prodb_get_surface_props(lPart,SEL_3D_PART, -1, 0,props);

int lColor = this->RGBToColor(props->color_rgb[0] * 255, props->color_rgb[1] * 255, props->color_rgb[2] * 255);

std::stringstream ss;

ss<< lColor << ",0,0,0,100,1";

return ss.str();

I faced with difficulties when getting geometry. I read Sect. "Core:

3D Geometry" and understood the structure of the part:

solid->Surface->Contur->Edge


However, I did not understand how to work with ProSolidSurfaceVisit

procedure and cannot find understandable examples of usage.

ProSolidSurfaceVisit procedure has three parameters.

I understood what the first parameter means:

ProError lStatus;

  ProMdl lModel;

  ProMdlType lModelType;

  ProSurface **p_surfaces

  lStatus = ProMdlCurrentGet(&lModel);

  ProSolidSurfaceVisit((ProSolid)lModel, ?, ?,(ProAppData)&p_surfaces)

The second parameter:

Should I simply use ProAppData as the third parameter or work with contours?

Can I use NULL for the third parameter to get all surfaces?

Re: how can I get vertices, faces and color of the part or assembly parts

Hello Vladimir,

sorry for the late reply, I was OOTO for two weeks.

The visit functions are a basic concept of Toolkit - they all work the same with the arguments 2 and 3 containing functions to be executed with all occurrences of the visited items. The sample codes linked from ProSolidSurfaceVisit() should give you an impression how to use the visit-actions.

To put it simple:

  • The visit action is the function that is used with every visited item
  • The optional visit filter allows to exclude some items from the processing, based on the programmed criteria (but usually this could be done in the action as well)
  • ProAppData is also optional, allowing to provide additional data to the filter and action functions.
  • The visit function simply initializes the visit, specifying the top object to visit the items within (e.g. the solid model to visit all its surfaces), the function(s) used to process the data and the optional data these functions may receive.


Regards,

Gunter

Re: how can I get vertices, faces and color of the part or assembly parts

Hi Vladimir,

did you solve your problem with colors?

I need to retrive the current color of a part.

I tried with ProSurfaceAppearancepropsGet but on Part I retrive the part color

Using ProSurfaceAppearancepropsGet on Assy I retrive null data

Hope you can help!

Thanks Patrizia

Announcements