Set The Material Of A TopoDS_Face

Hello,

I am trying to set the material of a topology face for a visualization, the visualization uses a custom user interface so I am not using AIS at all. Right now Im trying to implement setting the material of a face or shell. I do so currently just by using the index of a face by the order the topology explorer gives. However, after boolean operations, a face may become split into multiple faces and the order may change, which means the material is no longer properly assigned. Is there a way to give the data to the face object in open cascade, and in subsequent operations, it keeps the material data that it had originally no matter the operation?

Thanks, and please tell me if anything is unclear.

Qr Qr's picture

To associate custom attributes with geometry, OpenCascade provides OCAF component which is a kind of super-structure over your shapes. This is different, for example, from ACIS where attributes are associated directly to topological elements (edges, faces, etc.). To solve your problem, you have to use the philosophy similar to OCAF: create a super-structure and keep track of evolution of your sub-shapes. Evolution can be tracked with help of modification history which is provided by the most of modeling API in OpenCascade (including Booleans).

Wei JIn Weng's picture

Ah okay, so i use each algorithm's ::Generated and ::Modified shapes to track it right? Is there anything else i should be careful about?

Forum supervisor's picture

Dear Wei Jin,

I suggest you to read OCAF USer's Guide (occt_ocaf.pdf available with the official OCCT version).

I do hope that chapter "4. OCAF Shape Attribute" can answer to main of your questions (pay your attention to the sub-chapter "4.6 Topological naming" which in general descibes necessary components).

Best regards
FSR.