}
else {
//cout <<"Error creating edge"<<endl;
- di <<"Error creating edge"<<"\n";
+ di <<"Error creating edge\n";
}
return 0;
}
if (n < 3) return 1;
Standard_Integer i;
BRepBuilderAPI_MakeWire MW;
- for (i = 2; i < n; i ++) {
- TopoDS_Shape S = DBRep::Get(a[i]);
- if (S.IsNull()) continue;
- if (S.ShapeType() == TopAbs_EDGE)
- MW.Add(TopoDS::Edge(S));
- else if (S.ShapeType() == TopAbs_WIRE)
- MW.Add(TopoDS::Wire(S));
- else
- continue;
+ Standard_Boolean IsUnsorted = !strcmp(a[2], "-unsorted");
+
+ if (!IsUnsorted)
+ for (i = 2; i < n; i ++) {
+ TopoDS_Shape S = DBRep::Get(a[i]);
+ if (S.IsNull()) continue;
+ if (S.ShapeType() == TopAbs_EDGE)
+ MW.Add(TopoDS::Edge(S));
+ else if (S.ShapeType() == TopAbs_WIRE)
+ MW.Add(TopoDS::Wire(S));
+ else
+ continue;
+ }
+ else
+ {
+ TopTools_ListOfShape aLE;
+ for (i = 3; i < n; i ++)
+ {
+ TopoDS_Shape S = DBRep::Get(a[i]);
+ TopExp_Explorer Exp(S, TopAbs_EDGE);
+ for (;Exp.More();Exp.Next())
+ {
+ const TopoDS_Edge& anE = TopoDS::Edge(Exp.Current());
+ if (!anE.IsNull())
+ aLE.Append(anE);
+ }
+ }
+ MW.Add(aLE);
}
+
if (!MW.IsDone()) {
//cout << "Wire not done" << endl;
- di << "Wire not done" << "\n";
- return 0;
+ di << "Wire not done with an error:\n";
+ switch (MW.Error())
+ {
+ case BRepBuilderAPI_EmptyWire:
+ di << "BRepBuilderAPI_EmptyWire\n";
+ break;
+ case BRepBuilderAPI_DisconnectedWire:
+ di << "BRepBuilderAPI_DisconnectedWire\n";
+ break;
+ case BRepBuilderAPI_NonManifoldWire:
+ di << "BRepBuilderAPI_NonManifoldWire\n";
+ break;
+ default:
+ break;
+ }
}
- DBRep::Set(a[1],MW);
+ else
+ DBRep::Set(a[1],MW);
return 0;
}
Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]);
if (C.IsNull() && C2d.IsNull()) {
//cout << a[2] << " is not a curve" << endl;
- di << a[2] << " is not a curve" << "\n";
+ di << a[2] << " is not a curve\n";
return 1;
}
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(S),L,f,l);
if (C.IsNull()) {
//cout << a[2] << " has no 3d curve" << endl;
- di << a[2] << " has no 3d curve" << "\n";
+ di << a[2] << " has no 3d curve\n";
return 1;
}
C = new Geom_TrimmedCurve(C,f,l);
0.0e0) ;
gp_Pnt2d first_point(0.0e0,
0.0e0) ;
- Standard_Integer i = 2,
- wait = 1 ;
+ Standard_Integer i = 2;
+ Standard_Boolean wait = Standard_True;
// Standard_Real x0 = 0, y0 = 0, x = 0, y = 0, dx = 1, dy = 0;
Standard_Real x = 0, y = 0, dx = 1, dy = 0;
BRepBuilderAPI_MakeWire MW;
if ( !Paral.IsDone())
{
- di << " Error: Offset is not done." << "\n";
+ di << " Error: Offset is not done.\n";
return 1;
}
else
if ( !Paral.IsDone())
{
- di << " Error: Offset is not done." << "\n";
+ di << " Error: Offset is not done.\n";
return 1;
}
else
if (EInter.IsEmpty()) {
//cout << " No intersection found" << endl;
- di << " No intersection found" << "\n";
+ di << " No intersection found\n";
return 0;
}
di << " Orientation of vertex " << NbV << " on " << a[i+1] << ": ";
if (OO == TopAbs_FORWARD) {
//cout << "FORWARD" << endl;
- di << "FORWARD" << "\n";
+ di << "FORWARD\n";
} else {
//cout << "REVERSED" << endl;
- di << "REVERSED" << "\n";
+ di << "REVERSED\n";
}
}
}
if ( (n <2) || (n>3) ) {
//cout << " 1 or 2 arguments expected" << endl;
- di << " 1 or 2 arguments expected" << "\n";
+ di << " 1 or 2 arguments expected\n";
return 1;
}
Standard_Boolean Ok;
- TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
+ TopoDS_Shape S = DBRep::Get(a[1]);
if (S.IsNull()) return 1;
if (n==2) { Ok = BRepLib::BuildCurves3d(S); }
else { Ok = BRepLib::BuildCurves3d(S,Draw::Atof(a[2])); }
//if (!Ok) {cout << " one of the computation failed" << endl;}
- if (!Ok) {di << " one of the computation failed" << "\n";}
+ if (!Ok) {di << " one of the computation failed\n";}
return 0;
}
TopoDS_Shape aShape = DBRep::Get(a[i]);
if (aShape.IsNull())
//cout << a[i] << " is not a valid shape" << endl;
- di << a[i] << " is not a valid shape" << "\n";
+ di << a[i] << " is not a valid shape\n";
else
BRepTools::RemoveUnusedPCurves(aShape);
}
polyvertex,g);
theCommands.Add("wire",
- "wire wirename e1/w1 [e2/w2 ...]",__FILE__,
+ "wire wirename [-unsorted] e1/w1 [e2/w2 ...]",__FILE__,
wire,g);
theCommands.Add("profile",