Archived issue #0029647
Swept body looks incorrect for this sample
Description
Rectangular profile swept along spline. The result shape looks incorrect: sections scaled/rotated/deformed.
Attached image contains swept body (red), profile and path (green).
Attached image contains swept body (red), profile and path (green).
Steps to reproduce
Paste this code to void CModelingDoc::OnWire() and include <BRepOffsetAPI_MakePipeShell.hxx>
TopoDS_Wire profile;
{
BRep_Builder builder;
TopoDS_Vertex verts[4];
builder.MakeVertex(verts[0], gp_Pnt(-26, 12, 0), Precision::Confusion());
builder.MakeVertex(verts[1], gp_Pnt(-26, 0, 0), Precision::Confusion());
builder.MakeVertex(verts[2], gp_Pnt(26, 0, 0), Precision::Confusion());
builder.MakeVertex(verts[3], gp_Pnt(26, 12, 0), Precision::Confusion());
BRepBuilderAPI_MakeEdge line1(verts[0], verts[1]);
BRepBuilderAPI_MakeEdge line2(verts[1], verts[2]);
BRepBuilderAPI_MakeEdge line3(verts[2], verts[3]);
BRepBuilderAPI_MakeEdge line4(verts[3], verts[0]);
BRepBuilderAPI_MakeWire wire_maker;
wire_maker.Add(line1.Edge());
wire_maker.Add(line2.Edge());
wire_maker.Add(line3.Edge());
wire_maker.Add(line4.Edge());
profile = wire_maker.Wire();
}
TopoDS_Wire path;
{
TColStd_Array1OfReal knots(1, 5);
knots(1) = 0;
knots(2) = 51.0881590977792043872796;
knots(3) = 107.168458669019017293067;
knots(4) = 183.588351367190227847459;
knots(5) = 226.108934618128841975704;
TColgp_Array1OfPnt poles(1, 7);
poles(1) = gp_Pnt(-1, 0, -179);
poles(2) = gp_Pnt(16.3889401679998876204536, 0, -170.243017571998649373199);
poles(3) = gp_Pnt(37.082312570477270696756, 0, -141.435758819370448691188);
poles(4) = gp_Pnt(41.486375303785358426012, 0, -71.1477890837955300185058);
poles(5) = gp_Pnt(-42.7880805804954960080977, 0, -41.4882630495723816466125);
poles(6) = gp_Pnt(-22.2735032725623796068248, -0, -12.263785177549062055391);
poles(7) = gp_Pnt(1, 0, 0);
TColStd_Array1OfInteger mults(1, 5);
mults(1) = 4;
mults(2) = 1;
mults(3) = 1;
mults(4) = 1;
mults(5) = 4;
bool is_periodic = 0;
int degree = 3;
Handle(Geom_BSplineCurve) spl = new Geom_BSplineCurve(poles, knots, mults, degree, is_periodic);
BRepBuilderAPI_MakeEdge edge_maker(spl);
BRepBuilderAPI_MakeWire wire_maker;
TopoDS_Edge edge = edge_maker.Edge();
edge.Reverse();
wire_maker.Add(edge);
path = wire_maker.Wire();
}
BRepOffsetAPI_MakePipeShell sweep(path);
sweep.Add(profile, Standard_False, Standard_False);
sweep.Build();
Handle(AIS_Shape) ais_profile = new AIS_Shape(profile);
myAISContext->SetColor(ais_profile,Quantity_NOC_GREEN,Standard_False);
myAISContext->Display(ais_profile,Standard_False);
Handle(AIS_Shape) ais_path = new AIS_Shape(path);
myAISContext->SetColor(ais_path,Quantity_NOC_GREEN,Standard_False);
myAISContext->Display(ais_path,Standard_False);
Handle(AIS_Shape) ais_prism = new AIS_Shape(sweep.Shape());
myAISContext->SetColor(ais_prism,Quantity_NOC_RED,Standard_False);
myAISContext->Display(ais_prism,Standard_False);
TopoDS_Wire profile;
{
BRep_Builder builder;
TopoDS_Vertex verts[4];
builder.MakeVertex(verts[0], gp_Pnt(-26, 12, 0), Precision::Confusion());
builder.MakeVertex(verts[1], gp_Pnt(-26, 0, 0), Precision::Confusion());
builder.MakeVertex(verts[2], gp_Pnt(26, 0, 0), Precision::Confusion());
builder.MakeVertex(verts[3], gp_Pnt(26, 12, 0), Precision::Confusion());
BRepBuilderAPI_MakeEdge line1(verts[0], verts[1]);
BRepBuilderAPI_MakeEdge line2(verts[1], verts[2]);
BRepBuilderAPI_MakeEdge line3(verts[2], verts[3]);
BRepBuilderAPI_MakeEdge line4(verts[3], verts[0]);
BRepBuilderAPI_MakeWire wire_maker;
wire_maker.Add(line1.Edge());
wire_maker.Add(line2.Edge());
wire_maker.Add(line3.Edge());
wire_maker.Add(line4.Edge());
profile = wire_maker.Wire();
}
TopoDS_Wire path;
{
TColStd_Array1OfReal knots(1, 5);
knots(1) = 0;
knots(2) = 51.0881590977792043872796;
knots(3) = 107.168458669019017293067;
knots(4) = 183.588351367190227847459;
knots(5) = 226.108934618128841975704;
TColgp_Array1OfPnt poles(1, 7);
poles(1) = gp_Pnt(-1, 0, -179);
poles(2) = gp_Pnt(16.3889401679998876204536, 0, -170.243017571998649373199);
poles(3) = gp_Pnt(37.082312570477270696756, 0, -141.435758819370448691188);
poles(4) = gp_Pnt(41.486375303785358426012, 0, -71.1477890837955300185058);
poles(5) = gp_Pnt(-42.7880805804954960080977, 0, -41.4882630495723816466125);
poles(6) = gp_Pnt(-22.2735032725623796068248, -0, -12.263785177549062055391);
poles(7) = gp_Pnt(1, 0, 0);
TColStd_Array1OfInteger mults(1, 5);
mults(1) = 4;
mults(2) = 1;
mults(3) = 1;
mults(4) = 1;
mults(5) = 4;
bool is_periodic = 0;
int degree = 3;
Handle(Geom_BSplineCurve) spl = new Geom_BSplineCurve(poles, knots, mults, degree, is_periodic);
BRepBuilderAPI_MakeEdge edge_maker(spl);
BRepBuilderAPI_MakeWire wire_maker;
TopoDS_Edge edge = edge_maker.Edge();
edge.Reverse();
wire_maker.Add(edge);
path = wire_maker.Wire();
}
BRepOffsetAPI_MakePipeShell sweep(path);
sweep.Add(profile, Standard_False, Standard_False);
sweep.Build();
Handle(AIS_Shape) ais_profile = new AIS_Shape(profile);
myAISContext->SetColor(ais_profile,Quantity_NOC_GREEN,Standard_False);
myAISContext->Display(ais_profile,Standard_False);
Handle(AIS_Shape) ais_path = new AIS_Shape(path);
myAISContext->SetColor(ais_path,Quantity_NOC_GREEN,Standard_False);
myAISContext->Display(ais_path,Standard_False);
Handle(AIS_Shape) ais_prism = new AIS_Shape(sweep.Shape());
myAISContext->SetColor(ais_prism,Quantity_NOC_RED,Standard_False);
myAISContext->Display(ais_prism,Standard_False);
Public activity
No public notes
Participants are labeled by their role within this record.