How to do lofting through closed sections

I have two closed sections (basically 2 polygons in YZ plane), how do I Loft through the two sections? There isn't any sample provided. Can anybody pls help. Thanks in advance.

Gheorghiu's picture

BRepOffsetAPI_ThruSections

Riaz Sheikh Ahmed's picture

Thanks Gheorghiu, but now how do I get each edge from the added wire to the BRepOffsetAPI_ThruSections object. I have constructed the wire by adding gp_Pnts to BRepLib_MakePolygon.

gp_Pnt aPnt4(50, 10, 20);
gp_Pnt aPnt5(50, 100, 50);
gp_Pnt aPnt6(50, 50, 90);

BRepLib_MakePolygon aPoly1;

aPoly1.Add(aPnt4);
aPoly1.Add(aPnt5);
aPoly1.Add(aPnt6);

TopoDS_Wire aWire = aPoly.Wire();

I need all the edges from this wire to get the
GeneratedFace(const TopoDS_Shape& Edge) shape objects for each of the edge.

arkoala's picture

But this is not a closed section...
You should repeat first point to the end to close the section.
aPoly1.Add(aPnt4);
aPoly1.Add(aPnt5);
aPoly1.Add(aPnt6);
aPoly1.Add(aPnt4);

And another thing, do you want to extrude along a line path (BRepPrimAPI_MakePrism) or along a 3d and possibly curved path (BRepOffsetAPI_ThruSections)?

It is difficult for me to understand "lofting" concept

Riaz Sheikh Ahmed's picture

Its true for a closed section it should be a closed polygon;
aPoly1.Close() or the method which you have stated above. So I have two closed sections on a 3D plane and I have to loft through the sections.

You can visit this page
http://www.opencascade.org/showroom/demos/ and check how the concept of lofting works.

arkoala's picture

I do like following code, thanks to Volker and Roman:

TopoDS_Shape pipe;
BRepOffsetAPI_ThruSections thePipe(Standard_True, Standard_True);
thePipe.AddWire(theSection);
...
thePipe.AddWire(theSection);
thePipe.Build();
if (thePipe.IsDone()) pipe = thePipe.Shape();

But, I have still a case that I can not solve: To create a irregular torus, for instance.
I asked for that, but nobody could help me.