DiscussionsIssue archiveOther usage issues

Archived discussion

How to convert shape to polygons/faces?

Other usage issuesThu, 01/29/2015 - 06:244 replies

Browse this forum
QuestionAuthor

Hello,

I'm new to OpenCascade and would like to convert a loaded shape (TopoDS_Shape, AIS_Shape,) to a polygon representation that I can inspect / export?

I've been able to project a shape onto a plane (using Prs3d_Projector, HLRBRep_HLRToShape), but I'd like to also get it's polygonal representation.

Thanks,
Author

Discussion

4 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi Author,

Do you mean the mesh for the TopoDS_Shape?

Best Regards,
Commenter-1

02Author

Commenter-1,

I think that describes what I'm trying to do.

I'm trying to get a wireframe (or polygonal) representation of the imported CAD file.

The application I'm writing doesn't support CAD files directly (STEP, IGES), so I'm trying to get them into a representation that I can handle such as vertices and polygons/faces/mesh.

All I currently need from the CAD file is the outline in X/Y plane. I've been able to project an imported IGES disc object onto the X/Y plane. See the attached image of the disc before and after projected onto the X/Y plane. I need the outline vertices (for the red projected disc).

Any help is greatly appreciated. I'm very new to OpenCascade.

Thanks,
Author

03Author

I'm noticing some example source that will likely help:
occ-install-dir/samples/mfc/occtdemo/Tesselate

These examples didn't get built by default using custom.bat/msvc.bat, so I didn't initially notice it.

04Commenter-1

Hi Author,

If you just want to display the outline of a shape, I think you can explorer the Edges of the shape, and get the representation data from an Edge by:

Handle_Poly_Polygon3D aPolygon = BRep_Tool::Polygon3D(const TopoDS_Edge &E, TopLoc_Location &L);

then project the aPolygon points into XOY plane.

Best Regards,
Commenter-1