![sahithya's picture sahithya's picture](/sites/default/files/images/userpic_default.png)
Thu, 11/29/2012 - 23:47
Hello,
I am trying to generate a solid shape that connects two polygons defined by points and vertices via lofting. I seem to be generating a shell that is connecting the two polygons.(See attached) Here is a snippet of my code:
//polygon 1
gp_Pnt point1(97, 73, 69);
....
gp_Pnt point9(107, 73, 69);
TopoDS_Vertex vertex1 = BRepBuilderAPI_MakeVertex(point1);
....
TopoDS_Vertex vertex9 = BRepBuilderAPI_MakeVertex(point9);
BRepLib_MakePolygon polygon;
polygon.Add(vertex1);
....
polygon.Add(vertex9);
polygon.Close();
//polygon 2
gp_Pnt p1(137, 120.6, 34.5);
....
gp_Pnt p10(137, 120.6, 34.5);
TopoDS_Vertex vtx1 = BRepBuilderAPI_MakeVertex(p1);
....
TopoDS_Vertex vtx10 = BRepBuilderAPI_MakeVertex(p10);
BRepLib_MakePolygon polygon1;
polygon1.Add(vtx1);
....
polygon1.Add(vtx10);
polygon1.Close();
//Build wires
TopoDS_Wire aWire = polygon.Wire();
TopoDS_Wire bWire = polygon1.Wire();
//loft between the wires
BRepLib::BuildCurves3d(aWire);
BRepLib::BuildCurves3d(bWire);
// Try the lofting functionality
BRepOffsetAPI_ThruSections loft(Standard_True, Standard_False);
loft.AddWire(aWire);
loft.AddWire(bWire);
//loft.CheckCompatibility(Standard_False);
loft.Build();
TopoDS_Shape loftShape = loft.Shape();
Handle(AIS_Shape) AIS_loftShape = new AIS_Shape(loftShape);
AIS_loftShape->SetColor(Quantity_NOC_ANTIQUEWHITE);
Handle(AIS_InteractiveContext)aContext = new AIS_InteractiveContext(viewer);
aContext->Display(AIS_loftShape);
Any help on why this results in the attached image?
Sahithya
Thu, 11/29/2012 - 23:59
Loft the edges, not the wires together.
You cannot expect ThruSections to resolve this topology for you.
-jelle