Holes

Hi All,

I'm importing data from and odd fille format.
Surfaces are defined by sequences of points defining the polygons for the boundaries of the surface and other polygons defining the holes.
(Just like happens for the opengl tessellator... see "Winding Numbers and Winding Rules" paragraph in http://www.glprogramming.com/red/chapter11.html)

What would be the best way to represent such geometries in OCC?

I know I can create faces(and then shapes) from wires but I'm not able to create wires for polygons. And drill holes in them.

Any hint appreciated.

Thanks, Claudio

Patrik Mueller's picture

Hi Claudio,

you could try something like this (you have to modify it :-))

BRepBuilderAPI_MakePolygon ActWire;

Im_PointListIterator pointIt(thePoints);
for (pointIt.InitEntries(); pointIt.MoreEntries(); pointIt.NextEntry())
{
Im_Vec3D* tmpVec = pointIt.Value();
ActWire.Add(gp_Pnt(gp_XYZ(tmpVec->X(), tmpVec->Y(), tmpVec->Z())));
}

ActWire.Close();

if(ActWire.IsDone())
{
TopoDS_Wire tmpWire;
tmpWire = ActWire.Wire();

BRepBuilderAPI_MakeFace(tmpWire);
}

And with BRepBuilderAPI_MakeFace you could add the holes if you build the outer wire.

Hope this helps,

Patrik