Page 1 of 1

Boundary of a stl surface

Posted: Fri Sep 06, 2024 12:34 am
by Gitesh Powar
Greetings,

I'm currently reading an stl file. What I want to do is given a triangular mesh of a non-closed surface, I would like to extract the points on the four boundary curves of the STL surface.
A simple example is a meshed plane where I would like only the points on the four boundary lines.

Is there a way to extract this information from an STL file?

Thanks

Re: Boundary of a stl surface

Posted: Mon Sep 09, 2024 4:42 am
by Anand Prashar
I think IVertex_DG.IsInteriorVertex is what you need.

Use IMesh_DG.GetVertexList(), then loop all and select ones which are not interior. It will give you a list.

Its order I expect will be random. Sorting it in, say CCW order will need more work. Sadly, there is no GetSegmentList() in IMesh_DG.

You can start with the first vertex in your list and use IVertex_DG.GetStarSegment(), IVertexSegment_DG.IsInterior(), IVertexSegment_DG.GetEnd()
to find the two adjacent boundary segments and the two adjacent vertices. Keep looping until the algorithms produces the same vertex on both sides.

You need only one boundary vertex in the first step to do this.

Make sure the mesh is in upgraded state before any of this.