1 // Created on: 1993-07-22
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <BRepTest.hxx>
18 #include <GeometryTest.hxx>
19 #include <gp_Pnt2d.hxx>
23 #include <gp_Vec2d.hxx>
24 #include <TColgp_HArray1OfPnt2d.hxx>
25 #include <TColgp_Array1OfPnt2d.hxx>
26 #include <BRepBuilderAPI.hxx>
27 #include <BRepBuilderAPI_MakeVertex.hxx>
28 #include <BRepBuilderAPI_MakeEdge.hxx>
29 #include <BRepBuilderAPI_MakeEdge2d.hxx>
30 #include <BRepBuilderAPI_MakeFace.hxx>
31 #include <BRepBuilderAPI_MakeWire.hxx>
32 #include <BRepBuilderAPI_MakePolygon.hxx>
33 #include <BRepOffsetAPI_MakeOffset.hxx>
34 #include <BRepLib.hxx>
35 #include <BRepAlgo.hxx>
36 #include <BRepAdaptor_Curve.hxx>
37 #include <BRep_Builder.hxx>
38 #include <BRep_Tool.hxx>
39 #include <BRepTools.hxx>
40 #include <Geom_Curve.hxx>
41 #include <Geom_TrimmedCurve.hxx>
42 #include <Geom2d_BSplineCurve.hxx>
43 #include <Geom_Surface.hxx>
44 #include <Geom_RectangularTrimmedSurface.hxx>
45 #include <Geom_Plane.hxx>
46 #include <Geom2d_Line.hxx>
47 #include <Geom2d_Circle.hxx>
48 #include <Geom2dAPI_Interpolate.hxx>
49 #include <Geom2d_TrimmedCurve.hxx>
51 #include <TopoDS_Shape.hxx>
52 #include <TopoDS_Wire.hxx>
55 #include <DBRep_DrawableShape.hxx>
56 #include <Draw_Interpretor.hxx>
57 #include <Draw_Appli.hxx>
58 #include <DrawTrSurf.hxx>
59 #include <DrawTrSurf_BSplineCurve2d.hxx>
60 #include <DrawTrSurf_Point.hxx>
63 #include <Precision.hxx>
64 #include <GeomAPI.hxx>
65 #include <TopAbs_Orientation.hxx>
66 #include <TopExp_Explorer.hxx>
67 #include <TopOpeBRep_EdgesIntersector.hxx>
68 #include <TopOpeBRep_Point2d.hxx>
69 #include <TopOpeBRepDS_Transition.hxx>
73 Standard_IMPORT Draw_Viewer dout;
76 //=======================================================================
78 //=======================================================================
80 static Standard_Integer vertex(Draw_Interpretor& , Standard_Integer n, const char** a)
85 BRepBuilderAPI_MakeVertex(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]))));
89 TopoDS_Shape S = DBRep::Get(a[3]);
90 if (S.IsNull()) return 0;
91 if (S.ShapeType() != TopAbs_EDGE) return 0;
92 BRepAdaptor_Curve C(TopoDS::Edge(S));
94 C.D0(Draw::Atof(a[2]),P);
95 DBRep::Set(a[1], BRepBuilderAPI_MakeVertex(P));
99 Handle(DrawTrSurf_Point) aP =
100 Handle(DrawTrSurf_Point)::DownCast(Draw::Get(a[2]));
101 DBRep::Set(a[1], BRepBuilderAPI_MakeVertex(aP->Point()));
106 //=======================================================================
108 //=======================================================================
110 static Standard_Integer range(Draw_Interpretor& , Standard_Integer n, const char** a)
113 TopoDS_Shape aLocalShape(DBRep::Get(a[1],TopAbs_EDGE));
114 TopoDS_Edge E = TopoDS::Edge(aLocalShape);
115 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE));
116 if (E.IsNull()) return 1;
117 Standard_Real f = Draw::Atof(a[n-2]);
118 Standard_Real l = Draw::Atof(a[n-1]);
123 aLocalShape = DBRep::Get(a[2],TopAbs_FACE);
124 TopoDS_Face F = TopoDS::Face(aLocalShape);
125 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
126 if (F.IsNull()) return 1;
132 //=======================================================================
134 //=======================================================================
136 static Standard_Integer trim(Draw_Interpretor& di, Standard_Integer n, const char** a)
139 TopoDS_Shape e = DBRep::Get(a[1]);
140 if (e.IsNull()) return 1;
141 if (e.ShapeType() != TopAbs_EDGE) return 1;
142 TopoDS_Shape v1 = DBRep::Get(a[2]);
143 if (v1.IsNull()) return 1;
144 if (v1.ShapeType() != TopAbs_VERTEX) return 1;
147 v2 = DBRep::Get(a[3]);
148 if (v2.IsNull()) return 1;
149 if (v2.ShapeType() != TopAbs_VERTEX) return 1;
153 const Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(e),L,f,l);
154 TopLoc_Location LI = L.Inverted();
155 e.Orientation(TopAbs_FORWARD);
161 if (v1.Orientation() == TopAbs_REVERSED) {
166 BRepBuilderAPI_MakeEdge ME(C,TopoDS::Vertex(v1),TopoDS::Vertex(v2));
173 //cout <<"Error creating edge"<<endl;
174 di <<"Error creating edge"<<"\n";
180 //=======================================================================
182 //=======================================================================
184 static Standard_Integer polyline(Draw_Interpretor& , Standard_Integer n, const char** a)
187 if (((n-2) % 3) != 0) return 1;
188 Standard_Integer i, j, np = (n-2) / 3;
189 BRepBuilderAPI_MakePolygon W;
191 for (i = 1; i <= np; i ++) {
192 W.Add(gp_Pnt(Draw::Atof(a[j]),Draw::Atof(a[j+1]),Draw::Atof(a[j+2])));
195 DBRep::Set(a[1],W.Wire());
199 //=======================================================================
201 //=======================================================================
203 static Standard_Integer polyvertex(Draw_Interpretor& , Standard_Integer n, const char** a)
207 BRepBuilderAPI_MakePolygon W;
208 for (i = 2; i < n; i ++) {
209 TopoDS_Shape S = DBRep::Get(a[i]);
210 if (S.IsNull()) return 1;
211 if (S.ShapeType() != TopAbs_VERTEX) return 1;
212 W.Add(TopoDS::Vertex(S));
214 DBRep::Set(a[1],W.Wire());
218 //=======================================================================
220 //=======================================================================
222 static Standard_Integer wire(Draw_Interpretor& di, Standard_Integer n, const char** a)
226 BRepBuilderAPI_MakeWire MW;
227 for (i = 2; i < n; i ++) {
228 TopoDS_Shape S = DBRep::Get(a[i]);
229 if (S.IsNull()) continue;
230 if (S.ShapeType() == TopAbs_EDGE)
231 MW.Add(TopoDS::Edge(S));
232 else if (S.ShapeType() == TopAbs_WIRE)
233 MW.Add(TopoDS::Wire(S));
238 //cout << "Wire not done" << endl;
239 di << "Wire not done" << "\n";
246 //=======================================================================
248 //=======================================================================
250 static Standard_Integer mkedge(Draw_Interpretor& di, Standard_Integer n, const char** a)
254 Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]);
255 Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]);
256 if (C.IsNull() && C2d.IsNull()) {
257 //cout << a[2] << " is not a curve" << endl;
258 di << a[2] << " is not a curve" << "\n";
265 if (!C.IsNull()) edge = BRepBuilderAPI_MakeEdge(C);
266 else edge = BRepBuilderAPI_MakeEdge2d(C2d);
269 Handle(Geom_Surface) S;
270 Standard_Integer i = 0;
272 S = DrawTrSurf::GetSurface(a[3]);
273 if (!S.IsNull()) i = 1;
275 TopoDS_Shape aLocalShape(DBRep::Get(a[3+i],TopAbs_VERTEX));
276 TopoDS_Vertex V1 = TopoDS::Vertex(aLocalShape);
277 // TopoDS_Vertex V1 = TopoDS::Vertex(DBRep::Get(a[3+i],TopAbs_VERTEX));
281 edge = BRepBuilderAPI_MakeEdge(C,Draw::Atof(a[3]),Draw::Atof(a[4]));
283 edge = BRepBuilderAPI_MakeEdge2d(C2d,Draw::Atof(a[3]),Draw::Atof(a[4]));
285 edge = BRepBuilderAPI_MakeEdge(C2d,S,Draw::Atof(a[4]),Draw::Atof(a[5]));
288 aLocalShape = DBRep::Get(a[4+i],TopAbs_VERTEX);
289 TopoDS_Vertex V2 = TopoDS::Vertex(aLocalShape);
290 // TopoDS_Vertex V2 = TopoDS::Vertex(DBRep::Get(a[4+i],TopAbs_VERTEX));
292 edge = BRepBuilderAPI_MakeEdge(C,V1,V2);
294 edge = BRepBuilderAPI_MakeEdge2d(C2d,V1,V2);
296 edge = BRepBuilderAPI_MakeEdge(C2d,S,V1,V2);
300 aLocalShape = DBRep::Get(a[5+i],TopAbs_VERTEX);
301 TopoDS_Vertex V2 = TopoDS::Vertex(aLocalShape);
302 // TopoDS_Vertex V2 = TopoDS::Vertex(DBRep::Get(a[5+i],TopAbs_VERTEX));
304 edge = BRepBuilderAPI_MakeEdge(C,V1,V2,Draw::Atof(a[4]),Draw::Atof(a[6]));
306 edge = BRepBuilderAPI_MakeEdge2d(C2d,V1,V2,Draw::Atof(a[4]),Draw::Atof(a[6]));
308 edge = BRepBuilderAPI_MakeEdge(C2d,S,V1,V2,Draw::Atof(a[5]),Draw::Atof(a[7]));
314 DBRep::Set(a[1],edge);
318 //=======================================================================
320 //=======================================================================
321 Standard_IMPORT Draw_Color DrawTrSurf_CurveColor(const Draw_Color col);
322 Standard_IMPORT void DBRep_WriteColorOrientation ();
323 Standard_IMPORT Draw_Color DBRep_ColorOrientation (const TopAbs_Orientation Or);
325 static Standard_Integer mkcurve(Draw_Interpretor& di, Standard_Integer n, const char** a)
329 Standard_Boolean DispOrientation = !strcmp(a[0],"mkoricurve");
331 TopoDS_Shape S = DBRep::Get(a[2],TopAbs_EDGE);
332 if (S.IsNull()) return 1;
336 Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(S),L,f,l);
338 //cout << a[2] << " has no 3d curve" << endl;
339 di << a[2] << " has no 3d curve" << "\n";
342 C = new Geom_TrimmedCurve(C,f,l);
344 Draw_Color col,savecol;
346 if ( DispOrientation) {
347 DBRep_WriteColorOrientation ();
348 col = DBRep_ColorOrientation(TopoDS::Edge(S).Orientation());
349 savecol = DrawTrSurf_CurveColor(col);
351 DrawTrSurf::Set(a[1],C->Transformed(L.Transformation()));
352 if ( DispOrientation) {
353 DrawTrSurf_CurveColor(savecol);
359 //=======================================================================
362 //=======================================================================
364 static Standard_Integer mkpoint(Draw_Interpretor& ,
365 Standard_Integer n, const char** a)
369 TopoDS_Shape S = DBRep::Get(a[2],TopAbs_VERTEX);
370 if ( S.IsNull()) return 1;
372 TopoDS_Vertex V = TopoDS::Vertex(S);
374 gp_Pnt P = BRep_Tool::Pnt(V);
375 DrawTrSurf::Set(a[1],P);
380 //=======================================================================
382 //=======================================================================
384 static Standard_Integer mk2dcurve(Draw_Interpretor& di,
385 Standard_Integer na, const char** a)
387 if (na < 3) return 1;
390 S = DBRep::Get(a[2],TopAbs_EDGE);
394 TopoDS_Edge E = TopoDS::Edge(S);
397 Standard_Real f = 0., l = 0.;
398 Handle(Geom2d_Curve) C;
399 Handle(Geom_Surface) Surf;
401 Standard_Boolean hasFace = Standard_False;
404 // get the first PCurve connected to edge E
405 BRep_Tool::CurveOnSurface(E,C,Surf,L,f,l);
409 S = DBRep::Get(a[3],TopAbs_FACE);
412 Standard_Integer ind = Draw::Atoi(a[3]);
413 BRep_Tool::CurveOnSurface(E,C,Surf,L,f,l,ind);
417 hasFace = Standard_True;
418 TopoDS_Face F = TopoDS::Face(S);
419 C = BRep_Tool::CurveOnSurface(E,F,f,l);
424 //cout << a[2] << " has no 2d curve"; if (na == 4) cout << " on " << a[3];
426 di << a[2] << " has no 2d curve";
430 di << " on " << a[3];
436 C = new Geom2d_TrimmedCurve(C,f,l);
437 DrawTrSurf::Set(a[1],C);
442 //=======================================================================
444 //=======================================================================
446 static Standard_Integer edge(Draw_Interpretor& , Standard_Integer n, const char** a)
449 TopoDS_Shape V1 = DBRep::Get(a[2],TopAbs_VERTEX);
450 TopoDS_Shape V2 = DBRep::Get(a[3],TopAbs_VERTEX);
451 if (V1.IsNull() || V2.IsNull()) return 1;
452 TopoDS_Edge E = BRepBuilderAPI_MakeEdge(TopoDS::Vertex(V1),
458 //=======================================================================
460 //=======================================================================
462 static Standard_Integer isoedge(Draw_Interpretor& , Standard_Integer n, const char** a)
466 Standard_Boolean uiso = *a[0] == 'u';
467 Standard_Real p = Draw::Atof(a[3]);
468 Standard_Real p1 = Draw::Atof(a[4]);
469 Standard_Real p2 = Draw::Atof(a[5]);
470 TopoDS_Shape Sh = DBRep::Get(a[2],TopAbs_FACE);
471 if (Sh.IsNull()) return 1;
473 const Handle(Geom_Surface)& S = BRep_Tool::Surface(TopoDS::Face(Sh),Loc);
474 Standard_Real UMin,UMax,VMin,VMax;
475 BRepTools::UVBounds(TopoDS::Face(Sh),UMin,UMax,VMin,VMax);
477 VMin = Min (VMin , Min (p1,p2));
478 VMax = Max (VMax , Max (p1,p2));
481 UMin = Min (UMin , Min (p1,p2));
482 UMax = Max (VMax , Max (p1,p2));
485 Handle(Geom_RectangularTrimmedSurface) TS = new Geom_RectangularTrimmedSurface(S,UMin,UMax,VMin,VMax);
486 Handle(Geom_Curve) C;
487 Handle(Geom2d_Line) L;
490 L = new Geom2d_Line(gp_Pnt2d(p,0),gp_Dir2d(0,1));
494 L = new Geom2d_Line(gp_Pnt2d(0,p),gp_Dir2d(1,0));
497 TopoDS_Edge E = BRepBuilderAPI_MakeEdge(C,p1,p2);
500 B.UpdateEdge(E,L,TopoDS::Face(Sh),0.);
506 //=======================================================================
508 //=======================================================================
510 static Standard_Integer transfert(Draw_Interpretor& , Standard_Integer n, const char** a)
514 TopoDS_Shape E1 = DBRep::Get(a[1],TopAbs_EDGE);
515 TopoDS_Shape E2 = DBRep::Get(a[2],TopAbs_EDGE);
516 if (E1.IsNull() || E2.IsNull()) return 1;
519 B.Transfert(TopoDS::Edge(E1),TopoDS::Edge(E2));
523 //=======================================================================
525 // command to build a profile
526 //=======================================================================
528 static Standard_Integer profile(Draw_Interpretor& di,
532 // this command build a profile
533 // from a moving point
538 //cout << "profile name [code values] [code values] ...\n";
539 //cout << " Build a profile in the XY plane from a moving point and direction\n";
540 //cout << " The original point and direction are 0 0 and 1 0\n";
541 //cout << " Codes and values describe the point or direction change\n";
542 //cout << " When the point change the direction becomes the tangent\n";
543 //cout << " All angles are in degree (may be negative)\n";
544 //cout << " By default the profile is closed and a face is built\n";
546 //cout << " Instruction Parameters Action\n";
547 //cout << " O X Y Z Set the origin of the plane\n";
548 //cout << " P DX DY DZ UX UY UZ Set the normal and X of the plane\n";
549 //cout << " S Face Set the Plane (Face must be a Face)\n";
550 //cout << " F X Y Set the first point\n";
551 //cout << " X DX Translate point along X\n";
552 //cout << " Y DY Translate point along Y\n";
553 //cout << " L DL Translate point along direction\n";
554 //cout << " XX X Set point X coordinate\n";
555 //cout << " YY Y Set point Y coordinate\n";
556 //cout << " T DX DY Translate point\n";
557 //cout << " TT X Y Set point\n";
558 //cout << " R Angle Rotate direction\n";
559 //cout << " RR Angle Set direction\n";
560 //cout << " D DX DY Set direction\n";
561 //cout << " IX X Intersect with vertical\n";
562 //cout << " IY Y Intersect with horizontal\n";
563 //cout << " C Radius Angle Arc of circle tangent to direction\n";
564 //cout << " W Make a closed wire\n";
565 //cout << " WW Make an open wire\n";
567 di << "profile name [code values] [code values] ...\n";
568 di << " Build a profile in the XY plane from a moving point and direction\n";
569 di << " The original point and direction are 0 0 and 1 0\n";
570 di << " Codes and values describe the point or direction change\n";
571 di << " When the point change the direction becomes the tangent\n";
572 di << " All angles are in degree (may be negative)\n";
573 di << " By default the profile is closed and a face is built\n";
575 di << " Instruction Parameters Action\n";
576 di << " O X Y Z Set the origin of the plane\n";
577 di << " P DX DY DZ UX UY UZ Set the normal and X of the plane\n";
578 di << " S Face Set the Plane (Face must be a Face)\n";
579 di << " F X Y Set the first point\n";
580 di << " X DX Translate point along X\n";
581 di << " Y DY Translate point along Y\n";
582 di << " L DL Translate point along direction\n";
583 di << " XX X Set point X coordinate\n";
584 di << " YY Y Set point Y coordinate\n";
585 di << " T DX DY Translate point\n";
586 di << " TT X Y Set point\n";
587 di << " R Angle Rotate direction\n";
588 di << " RR Angle Set direction\n";
589 di << " D DX DY Set direction\n";
590 di << " IX X Intersect with vertical\n";
591 di << " IY Y Intersect with horizontal\n";
592 di << " C Radius Angle Arc of circle tangent to direction\n";
593 di << " W Make a closed wire\n";
594 di << " WW Make an open wire\n";
599 Standard_Integer i = 2;
600 Standard_Real x0 = 0, y0 = 0, x = 0, y = 0, dx = 1, dy = 0;
601 BRepBuilderAPI_MakeWire MW;
602 gp_Ax3 DummyHP(gp::XOY());
604 enum {line , circle, none} move;
605 Standard_Boolean face = Standard_True;
606 Standard_Boolean close = Standard_True;
607 Standard_Boolean first = Standard_True;
608 Standard_Boolean stayfirst = Standard_False;
609 Standard_Boolean isplanar = Standard_True;
611 TopLoc_Location TheLocation;
612 Handle(Geom_Surface) Surface;
615 Standard_Real length=0,radius=0,angle=0;
623 if (i >= n) goto badargs;
625 di << "profile: The F instruction must precede all moves";
628 x0 = x = Draw::Atof(a[i-1]);
629 y0 = y = Draw::Atof(a[i]);
630 stayfirst = Standard_True;
636 if (i >= n) goto badargs;
637 P.SetLocation(gp_Pnt(Draw::Atof(a[i-2]),Draw::Atof(a[i-1]),Draw::Atof(a[i])));
638 stayfirst = Standard_True;
644 if (i >= n) goto badargs;
646 gp_Vec vn(Draw::Atof(a[i-5]),Draw::Atof(a[i-4]),Draw::Atof(a[i-3]));
647 gp_Vec vx(Draw::Atof(a[i-2]),Draw::Atof(a[i-1]),Draw::Atof(a[i]));
648 if (vn.Magnitude() <= Precision::Confusion()) {
649 di << "profile : null direction";
652 if (vx.Magnitude() <= Precision::Confusion()) {
653 di << "profile : null direction";
656 gp_Ax2 ax(P.Location(),vn,vx);
659 stayfirst = Standard_True;
665 if (i >= n) goto badargs;
667 TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_FACE));
668 TopoDS_Face Face = TopoDS::Face(aLocalShape);
669 // TopoDS_Face Face = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
671 di << "profile : no face found";
674 Surface = BRep_Tool::Surface(Face,TheLocation);
675 Handle(Geom_Plane) Plane = Handle(Geom_Plane)::DownCast(Surface);
676 if ( Plane.IsNull()) {
677 isplanar = Standard_False;
682 stayfirst = Standard_True;
688 if (i >= n) goto badargs;
689 length = Draw::Atof(a[i]);
690 if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) {
700 if (i >= n) goto badargs;
701 length = Draw::Atof(a[i]);
702 if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) {
712 if (i >= n) goto badargs;
713 length = Draw::Atof(a[i]);
720 if (i >= n) goto badargs;
722 Standard_Real vx = Draw::Atof(a[i-1]);
723 Standard_Real vy = Draw::Atof(a[i]);
724 if ((a[i-2][1] == 'T') || (a[i-2][1] == 't')) {
728 length = Sqrt(vx*vx+vy*vy);
729 if (length > Precision::Confusion()) {
740 if (i >= n) goto badargs;
741 angle = Draw::Atof(a[i]) * (M_PI / 180.0);
742 if ((a[i-1][1] == 'R') || (a[i-1][1] == 'r')) {
747 Standard_Real c = Cos(angle);
748 Standard_Real s = Sin(angle);
749 Standard_Real t = c * dx - s * dy;
750 dy = s * dx + c * dy;
758 if (i >= n) goto badargs;
760 Standard_Real vx = Draw::Atof(a[i-1]);
761 Standard_Real vy = Draw::Atof(a[i]);
762 length = Sqrt(vx*vx+vy*vy);
763 if (length > Precision::Confusion()) {
774 if (i >= n) goto badargs;
775 radius = Draw::Atof(a[i-1]);
776 if (Abs(radius) > Precision::Confusion()) {
777 angle = Draw::Atof(a[i]) * (M_PI / 180.0);
785 if (i >= n) goto badargs;
786 length = Draw::Atof(a[i]);
787 if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) {
788 if (Abs(dx) < Precision::Confusion()) {
789 di << "Profile : cannot intersect, arg " << i-1;
792 length = (length - x) / dx;
795 else if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) {
796 if (Abs(dy) < Precision::Confusion()) {
797 di << "Profile : cannot intersect, arg " << i-1;
800 length = (length - y) / dy;
808 face = Standard_False;
809 if ((a[i][1] == 'W') || (a[i][1] == 'w')) {
810 close = Standard_False;
816 di <<"profile : unknown code " << a[i];
831 Handle(Geom2d_Line) l =
832 new Geom2d_Line(gp_Pnt2d(x,y),gp_Dir2d(dx,dy));
834 MW.Add(BRepBuilderAPI_MakeEdge(GeomAPI::To3d(l,P),0,length));
836 MW.Add(BRepBuilderAPI_MakeEdge(l,Surface,0,length));
844 Standard_Boolean sense = Standard_True;
851 gp_Ax2d ax(gp_Pnt2d(x-radius*dy,y+radius*dx),gp_Dir2d(dy,-dx));
856 Handle(Geom2d_Circle) c = new Geom2d_Circle(ax,radius,sense);
858 MW.Add(BRepBuilderAPI_MakeEdge(GeomAPI::To3d(c,P),0,angle));
860 MW.Add(BRepBuilderAPI_MakeEdge(c,Surface,0,angle));
877 stayfirst = Standard_False;
881 if ((i == n) && close) {
882 // the closing segment
885 length = Sqrt(dx*dx+dy*dy);
886 if (length > Precision::Confusion()) {
896 // get the result, face or wire
900 S = BRepBuilderAPI_MakeFace(P,MW.Wire());
902 BRepBuilderAPI_MakeFace MFace;
903 MFace.Init(Surface,Standard_False,Precision::Confusion());
904 MFace.Add(MW.Wire());
912 if (!TheLocation.IsIdentity())
916 Standard_Real Tol = 1.e-5;
917 BRepLib::BuildCurves3d(S,Tol);
925 di << "profile : bad number of arguments";
928 //=======================================================================
930 // command to build a profile
931 //=======================================================================
933 static Standard_Integer bsplineprof(Draw_Interpretor& di,
937 // this command build a profile
938 // from a moving point
943 //cout << " bsplineprof name [S face] [W WW] " << endl;
944 //cout << " for an edge : <digitizes> ... <mouse button 2> " << endl ;
945 //cout << " to end profile : <mouse button 3> " << endl ;
946 //cout << " Build a profile in the XY plane from digitizes" << endl ;
947 //cout << " By default the profile is closed and a face is built\n";
949 //cout << " W Make a closed wire\n";
950 //cout << " WW Make an open wire\n";
952 di << " bsplineprof name [S face] [W WW] " << "\n";
953 di << " for an edge : <digitizes> ... <mouse button 2> " << "\n";
954 di << " to end profile : <mouse button 3> " << "\n";
955 di << " Build a profile in the XY plane from digitizes" << "\n";
956 di << " By default the profile is closed and a face is built\n";
958 di << " W Make a closed wire\n";
959 di << " WW Make an open wire\n";
964 gp_Pnt2d last_point(0.0e0,
966 gp_Pnt2d first_point(0.0e0,
968 Standard_Integer i = 2,
970 // Standard_Real x0 = 0, y0 = 0, x = 0, y = 0, dx = 1, dy = 0;
971 Standard_Real x = 0, y = 0, dx = 1, dy = 0;
972 BRepBuilderAPI_MakeWire MW;
973 gp_Ax3 DummyHP(gp::XOY());
975 Standard_Boolean face = Standard_True;
976 Standard_Boolean close = Standard_True;
977 // Standard_Boolean first = Standard_True;
978 Standard_Boolean isplanar = Standard_True;
979 Standard_Real length ;
981 TopLoc_Location TheLocation;
982 Handle(Geom_Surface) Surface;
992 TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_FACE));
993 TopoDS_Face Face = TopoDS::Face(aLocalShape);
994 // TopoDS_Face Face = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
996 di << "profile : no face found";
999 Surface = BRep_Tool::Surface(Face,TheLocation);
1000 Handle(Geom_Plane) Plane = Handle(Geom_Plane)::DownCast(Surface);
1001 if ( Plane.IsNull()) {
1002 isplanar = Standard_False;
1012 face = Standard_False;
1013 if ((a[i][1] == 'W') || (a[i][1] == 'w')) {
1014 close = Standard_False;
1020 di <<"profile : unknown code " << a[i];
1026 // to be done : close the profile using the first point of the contour
1027 // and the point taken with mouse button 3
1029 Handle(Geom2d_BSplineCurve) C ;
1030 Handle(Geom_Curve) curve3d_ptr ;
1031 Standard_Integer id, ii;
1032 Standard_Integer X,Y,b, not_done;
1033 Standard_Integer num_points = 0 ;
1034 gp_Pnt2d a_point( 0.0e0,
1036 Handle(TColgp_HArray1OfPnt2d) points_array_ptr =
1037 new TColgp_HArray1OfPnt2d(1, 1);
1038 Handle(TColgp_HArray1OfPnt2d) new_points_array_ptr ;
1043 dout.Select(id,X,Y,b,wait);
1044 Standard_Real z = dout.Zoom(id);
1045 a_point.SetCoord(1,(Standard_Real)X /z) ;
1046 a_point.SetCoord(2,(Standard_Real)Y /z) ;
1047 if (num_points == 0) {
1049 new TColgp_HArray1OfPnt2d(1, 1);
1050 points_array_ptr->ChangeArray1()(1) = a_point ;
1051 first_point = a_point ;
1055 if (num_points >= 2) {
1056 new_points_array_ptr =
1057 new TColgp_HArray1OfPnt2d(1, num_points);
1058 for (ii = 1 ; ii <= num_points -1 ; ii++) {
1059 new_points_array_ptr->ChangeArray1()(ii) =
1060 points_array_ptr->Array1()(ii) ;
1062 new_points_array_ptr->ChangeArray1()(num_points) = a_point ;
1063 Geom2dAPI_Interpolate a2dInterpolator(new_points_array_ptr,
1066 a2dInterpolator.Perform() ;
1067 if (a2dInterpolator.IsDone()) {
1068 C = a2dInterpolator.Curve() ;
1070 GeomAPI::To3d(C,P) ;
1071 DrawTrSurf::Set(a[1], curve3d_ptr);
1072 dout.RepaintView(id);
1074 points_array_ptr = new_points_array_ptr ;
1078 if (b == 2 || b == 3) {
1079 if (num_points == 2) {
1080 x = last_point.Coord(1) ;
1081 y = last_point.Coord(2) ;
1082 dx = a_point.Coord(1) - x ;
1083 dy = a_point.Coord(2) - y ;
1084 gp_Vec2d a_vector(dx,
1086 length = a_vector.Magnitude() ;
1087 Handle(Geom2d_Line) l =
1088 new Geom2d_Line(gp_Pnt2d(x,y),gp_Dir2d(dx,dy));
1090 MW.Add(BRepBuilderAPI_MakeEdge(GeomAPI::To3d(l,P),0,length));
1093 MW.Add(BRepBuilderAPI_MakeEdge(l,Surface,0,length));
1097 else if (num_points > 2) {
1099 MW.Add(BRepBuilderAPI_MakeEdge(curve3d_ptr,
1100 curve3d_ptr->FirstParameter(),
1101 curve3d_ptr->LastParameter()));
1104 MW.Add(BRepBuilderAPI_MakeEdge(C,
1106 C->FirstParameter(),
1107 C->LastParameter()));
1110 if (num_points >= 2) {
1111 last_point = a_point ;
1112 points_array_ptr->ChangeArray1()(1) = a_point ;
1114 DBRep::Set(a[1], MW.Wire()) ;
1123 a_point = first_point ;
1126 x = last_point.Coord(1) ;
1127 y = last_point.Coord(2) ;
1128 dx = a_point.Coord(1) - x ;
1129 dy = a_point.Coord(2) - y ;
1130 gp_Vec2d a_vector(dx,
1132 length = a_vector.Magnitude() ;
1133 Handle(Geom2d_Line) l =
1134 new Geom2d_Line(gp_Pnt2d(x,y),gp_Dir2d(dx,dy));
1136 MW.Add(BRepBuilderAPI_MakeEdge(GeomAPI::To3d(l,P),0,length));
1138 MW.Add(BRepBuilderAPI_MakeEdge(l,Surface,0,length));
1142 S = BRepBuilderAPI_MakeFace(P,MW.Wire());
1144 BRepBuilderAPI_MakeFace MFace;
1145 MFace.Init(Surface,Standard_False,Precision::Confusion());
1146 MFace.Add(MW.Wire());
1154 if (!TheLocation.IsIdentity())
1155 S.Move(TheLocation);
1158 Standard_Real Tol = 1.e-5;
1159 BRepLib::BuildCurves3d(S,Tol);
1169 //=======================================================================
1171 // command to build a profile
1172 //=======================================================================
1174 static Standard_Integer profile2d(Draw_Interpretor& di,
1178 // this command build a profile with 2d curves.
1179 // from a moving point
1184 //cout << "profile name [code values] [code values] ...\n";
1185 //cout << " Build a profile in the UV plane from a moving point and direction\n";
1186 //cout << " The original point and direction are 0 0 and 1 0\n";
1187 //cout << " Codes and values describe the point or direction change\n";
1188 //cout << " When the point change the direction becomes the tangent\n";
1189 //cout << " All angles are in degree (may be negative)\n";
1190 //cout << " By default the profile is closed \n";
1192 //cout << " Instruction Parameters Action\n";
1193 //cout << " F X Y Set the first point\n";
1194 //cout << " X DX Translate point along X\n";
1195 //cout << " Y DY Translate point along Y\n";
1196 //cout << " L DL Translate point along direction\n";
1197 //cout << " XX X Set point X coordinate\n";
1198 //cout << " YY Y Set point Y coordinate\n";
1199 //cout << " T DX DY Translate point\n";
1200 //cout << " TT X Y Set point\n";
1201 //cout << " R Angle Rotate direction\n";
1202 //cout << " RR Angle Set direction\n";
1203 //cout << " D DX DY Set direction\n";
1204 //cout << " IX X Intersect with vertical\n";
1205 //cout << " IY Y Intersect with horizontal\n";
1206 //cout << " C Radius Angle Arc of circle tangent to direction\n";
1207 //cout << " W Make a closed wire\n";
1209 di << "profile name [code values] [code values] ...\n";
1210 di << " Build a profile in the UV plane from a moving point and direction\n";
1211 di << " The original point and direction are 0 0 and 1 0\n";
1212 di << " Codes and values describe the point or direction change\n";
1213 di << " When the point change the direction becomes the tangent\n";
1214 di << " All angles are in degree (may be negative)\n";
1215 di << " By default the profile is closed \n";
1217 di << " Instruction Parameters Action\n";
1218 di << " F X Y Set the first point\n";
1219 di << " X DX Translate point along X\n";
1220 di << " Y DY Translate point along Y\n";
1221 di << " L DL Translate point along direction\n";
1222 di << " XX X Set point X coordinate\n";
1223 di << " YY Y Set point Y coordinate\n";
1224 di << " T DX DY Translate point\n";
1225 di << " TT X Y Set point\n";
1226 di << " R Angle Rotate direction\n";
1227 di << " RR Angle Set direction\n";
1228 di << " D DX DY Set direction\n";
1229 di << " IX X Intersect with vertical\n";
1230 di << " IY Y Intersect with horizontal\n";
1231 di << " C Radius Angle Arc of circle tangent to direction\n";
1232 di << " W Make a closed wire\n";
1237 Standard_Integer i = 2, NbCurves = 0;
1238 Standard_Real x0 = 0, y0 = 0, x = 0, y = 0, dx = 1, dy = 0;
1239 enum {line , circle, none} move;
1240 Standard_Boolean close = Standard_True;
1241 Standard_Boolean first = Standard_True;
1242 Standard_Boolean stayfirst = Standard_False;
1243 char* name = new char[100];
1247 Standard_Real length=0,radius=0,angle=0;
1255 if (i >= n) goto badargs;
1257 di << "profile: The F instruction must precede all moves";
1260 x0 = x = Draw::Atof(a[i-1]);
1261 y0 = y = Draw::Atof(a[i]);
1262 stayfirst = Standard_True;
1268 if (i >= n) goto badargs;
1269 length = Draw::Atof(a[i]);
1270 if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) {
1280 if (i >= n) goto badargs;
1281 length = Draw::Atof(a[i]);
1282 if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) {
1292 if (i >= n) goto badargs;
1293 length = Draw::Atof(a[i]);
1300 if (i >= n) goto badargs;
1302 Standard_Real vx = Draw::Atof(a[i-1]);
1303 Standard_Real vy = Draw::Atof(a[i]);
1304 if ((a[i-2][1] == 'T') || (a[i-2][1] == 't')) {
1308 length = Sqrt(vx*vx+vy*vy);
1309 if (length > Precision::Confusion()) {
1320 if (i >= n) goto badargs;
1321 angle = Draw::Atof(a[i]) * (M_PI / 180.0);
1322 if ((a[i-1][1] == 'R') || (a[i-1][1] == 'r')) {
1327 Standard_Real c = Cos(angle);
1328 Standard_Real s = Sin(angle);
1329 Standard_Real t = c * dx - s * dy;
1330 dy = s * dx + c * dy;
1338 if (i >= n) goto badargs;
1340 Standard_Real vx = Draw::Atof(a[i-1]);
1341 Standard_Real vy = Draw::Atof(a[i]);
1342 length = Sqrt(vx*vx+vy*vy);
1343 if (length > Precision::Confusion()) {
1354 if (i >= n) goto badargs;
1355 radius = Draw::Atof(a[i-1]);
1356 if (Abs(radius) > Precision::Confusion()) {
1357 angle = Draw::Atof(a[i]) * (M_PI / 180.0);
1365 if (i >= n) goto badargs;
1366 length = Draw::Atof(a[i]);
1367 if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) {
1368 if (Abs(dx) < Precision::Confusion()) {
1369 di << "Profile : cannot intersect, arg " << i-1;
1372 length = (length - x) / dx;
1375 else if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) {
1376 if (Abs(dy) < Precision::Confusion()) {
1377 di << "Profile : cannot intersect, arg " << i-1;
1380 length = (length - y) / dy;
1388 close = Standard_False;
1393 di <<"profile : unknown code " << a[i];
1408 Handle(Geom2d_Line) l = new Geom2d_Line(gp_Pnt2d(x,y),gp_Dir2d(dx,dy));
1409 Handle(Geom2d_TrimmedCurve) ct =
1410 new Geom2d_TrimmedCurve(l,0,length);
1412 Sprintf(name,"%s_%d",a[1],NbCurves);
1413 DrawTrSurf::Set(name,ct);
1414 di.AppendElement(name);
1422 Standard_Boolean sense = Standard_True;
1429 gp_Ax2d ax(gp_Pnt2d(x-radius*dy,y+radius*dx),gp_Dir2d(dy,-dx));
1434 Handle(Geom2d_Circle) c = new Geom2d_Circle(ax,radius,sense);
1435 Handle(Geom2d_TrimmedCurve) ct =
1436 new Geom2d_TrimmedCurve(c,0,angle);
1438 Sprintf(name,"%s_%d",a[1],NbCurves);
1439 DrawTrSurf::Set(name,ct);
1440 di.AppendElement(name);
1446 dx = v.X() / radius;
1447 dy = v.Y() / radius;
1457 stayfirst = Standard_False;
1461 if ((i == n) && close) {
1462 // the closing segment
1465 length = Sqrt(dx*dx+dy*dy);
1466 if (length > Precision::Confusion()) {
1476 Draw::Set(aName, x);
1478 Draw::Set(aName, y);
1480 Draw::Set(aName, dx);
1482 Draw::Set(aName, dy);
1487 di << "profile : bad number of arguments";
1493 //=======================================================================
1494 //function : mkoffset
1496 //=======================================================================
1498 Standard_Integer mkoffset(Draw_Interpretor& di,
1499 Standard_Integer n, const char** a)
1501 if (n < 5) return 1;
1504 BRepOffsetAPI_MakeOffset Paral;
1505 TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
1509 Base = DBRep::Get(a[2]);
1510 if (Base.IsNull()) return 1;
1511 Paral.Init(GeomAbs_Arc);
1512 TopExp_Explorer exp;
1513 for (exp.Init(Base,TopAbs_WIRE); exp.More(); exp.Next())
1515 TopoDS_Wire aLocalShape = TopoDS::Wire(exp.Current());
1516 Paral.AddWire(aLocalShape);
1521 Base.Orientation(TopAbs_FORWARD);
1522 Paral.Init(TopoDS::Face(Base));
1525 Standard_Real U, dU;
1526 Standard_Integer Nb;
1527 dU = Draw::Atof(a[4]);
1528 Nb = Draw::Atoi(a[3]);
1530 Standard_Real Alt = 0.;
1532 Alt = Draw::Atof(a[5]);
1534 Standard_Integer Compt = 1;
1536 for ( Standard_Integer i = 1; i <= Nb; i++)
1539 Paral.Perform(U,Alt);
1541 if ( !Paral.IsDone())
1543 di << " Error: Offset is not done." << "\n";
1548 Sprintf(name,"%s_%d", a[1], Compt++);
1549 char* temp = name; // portage WNT
1550 DBRep::Set(temp,Paral.Shape());
1557 //=======================================================================
1558 //function : pickface
1560 //=======================================================================
1562 Standard_Integer pickface(Draw_Interpretor& di,
1563 Standard_Integer , const char** )
1565 Standard_CString pick_name=".";
1567 TopoDS_Shape S = DBRep::Get(pick_name,TopAbs_FACE);
1568 if (S.IsNull()) return 1;
1570 char* name = new char[100];
1571 Sprintf(name,"PickedFace %s",pick_name);
1573 di.AppendElement(name);
1578 Standard_Integer edgeintersector(Draw_Interpretor& di,
1579 Standard_Integer n, const char** a)
1581 if (n < 5) return 1;
1584 TopoDS_Shape aLocalShape(DBRep::Get(a[2],TopAbs_EDGE));
1585 E[0] = TopoDS::Edge(aLocalShape);
1586 // E[0] = TopoDS::Edge(DBRep::Get(a[2],TopAbs_EDGE));
1587 if ( E[0].IsNull()) return 1;
1588 aLocalShape = DBRep::Get(a[3],TopAbs_EDGE);
1589 E[1] = TopoDS::Edge(aLocalShape);
1590 // E[1] = TopoDS::Edge(DBRep::Get(a[3],TopAbs_EDGE));
1591 if ( E[1].IsNull()) return 1;
1592 aLocalShape = DBRep::Get(a[4],TopAbs_FACE);
1593 TopoDS_Face F = TopoDS::Face(aLocalShape);
1594 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[4],TopAbs_FACE));
1595 if ( F.IsNull()) return 1;
1597 TopOpeBRep_EdgesIntersector EInter;
1599 //------------------------------------------------------
1600 // Calculate point of intersection 2D
1601 //-----------------------------------------------------
1602 EInter.SetFaces(F,F);
1603 Standard_Real TolInter = 1.e-7;
1604 if (n == 6) TolInter = Draw::Atof(a[5]);
1605 EInter.ForceTolerances(TolInter,TolInter);
1606 Standard_Boolean reducesegments = Standard_True;
1607 EInter.Perform (E[0],E[1],reducesegments);
1609 if (EInter.IsEmpty()) {
1610 //cout << " No intersection found" << endl;
1611 di << " No intersection found" << "\n";
1617 Standard_Integer NbV = 0;
1618 Standard_Real Tol = Precision::PConfusion();
1620 Standard_Boolean rejectreducedsegmentpoints = Standard_True;
1621 EInter.InitPoint(rejectreducedsegmentpoints);
1622 for (;EInter.MorePoint();EInter.NextPoint()) {
1623 const TopOpeBRep_Point2d& P2D = EInter.Point();
1624 gp_Pnt P = P2D.Value();
1625 TopoDS_Vertex V = BRepLib_MakeVertex(P);
1627 Sprintf(name,"%s_%d",a[1],NbV);
1629 for (Standard_Integer i = 1; i <= 2; i++) {
1630 //---------------------------------------------------------------
1631 // to be able to rank parameter on edge
1632 // it is necessary to code it internally
1633 //---------------------------------------------------------------
1634 Standard_Real U = P2D.Parameter(i);
1636 V.Orientation(TopAbs_INTERNAL);
1637 B.UpdateVertex(V,U,E[i-1],Tol);
1638 // B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
1640 //---------------------------------------------------------------
1641 // Orientation of vertex in the transition.
1642 //---------------------------------------------------------------
1643 TopAbs_Orientation OO = TopAbs_REVERSED;
1644 if (P2D.IsVertex(i)) {
1645 OO = P2D.Vertex(i).Orientation();
1647 else if (P2D.Transition(i).Before() == TopAbs_OUT) {
1648 OO = TopAbs_FORWARD;
1650 //cout << " Orientation of vertex " << NbV << " on " << a[i+1] << ": ";
1651 di << " Orientation of vertex " << NbV << " on " << a[i+1] << ": ";
1652 if (OO == TopAbs_FORWARD) {
1653 //cout << "FORWARD" << endl;
1654 di << "FORWARD" << "\n";
1656 //cout << "REVERSED" << endl;
1657 di << "REVERSED" << "\n";
1666 //=======================================================================
1667 //function : concatC0wire
1669 //=======================================================================
1671 Standard_Integer concatC0wire(Draw_Interpretor&, Standard_Integer n, const char** c)
1673 if ( n < 3 ) return 1;
1675 TopoDS_Shape S = DBRep::Get(c[2],TopAbs_WIRE) ;
1678 return 1; //test if the shape is empty
1680 TopoDS_Wire W = TopoDS::Wire(S) ;
1684 res = BRepAlgo::ConcatenateWireC0(W); //treatment
1685 DBRep::Set(c[1], res);
1689 //=======================================================================
1690 //function : concatwire
1691 //purpose : reduce the multiply degree of the knots to the minimum without
1692 // changing the geometry
1693 //=======================================================================
1695 static Standard_Integer concatwire(Draw_Interpretor&, Standard_Integer n, const char** c)
1697 GeomAbs_Shape Option=GeomAbs_C1;
1698 if ( n < 3 ) return 1;
1700 if(n==4) //check if it's C1 or G1
1701 if (! strcmp(c[3],"G1"))
1704 TopoDS_Shape S = DBRep::Get(c[2],TopAbs_WIRE) ;
1706 if (S.IsNull()) return 1 ; //test if the shape is empty
1708 TopoDS_Wire W = TopoDS::Wire(S) ;
1710 res=BRepAlgo::ConcatenateWire(W,Option); //processing
1711 DBRep::Set(c[1],res);
1715 //=======================================================================
1716 //function : build3d
1718 //=======================================================================
1720 Standard_Integer build3d(Draw_Interpretor& di,
1721 Standard_Integer n, const char** a)
1724 if ( (n <2) || (n>3) ) {
1725 //cout << " 1 or 2 arguments expected" << endl;
1726 di << " 1 or 2 arguments expected" << "\n";
1730 Standard_Boolean Ok;
1731 TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
1732 if (S.IsNull()) return 1;
1734 if (n==2) { Ok = BRepLib::BuildCurves3d(S); }
1735 else { Ok = BRepLib::BuildCurves3d(S,Draw::Atof(a[2])); }
1736 //if (!Ok) {cout << " one of the computation failed" << endl;}
1737 if (!Ok) {di << " one of the computation failed" << "\n";}
1742 //=======================================================================
1743 //function : reducepcurves
1744 //purpose : remove pcurves that are unused in this shape
1745 //=======================================================================
1747 Standard_Integer reducepcurves(Draw_Interpretor& di,
1748 Standard_Integer n, const char** a)
1750 if (n < 2) return 1;
1753 for (i = 1; i < n; i++)
1755 TopoDS_Shape aShape = DBRep::Get(a[i]);
1756 if (aShape.IsNull())
1757 //cout << a[i] << " is not a valid shape" << endl;
1758 di << a[i] << " is not a valid shape" << "\n";
1760 BRepTools::RemoveUnusedPCurves(aShape);
1766 //=======================================================================
1767 //function : CurveCommands
1769 //=======================================================================
1771 void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
1773 static Standard_Boolean done = Standard_False;
1775 done = Standard_True;
1777 DBRep::BasicCommands(theCommands);
1778 GeometryTest::CurveCommands(theCommands);
1780 const char* g = "TOPOLOGY Curve topology commands";
1782 theCommands.Add("vertex",
1783 "vertex name [x y z | p edge | poin]",__FILE__,
1786 theCommands.Add("etrim",
1787 "etrim edge v1 [v2]",__FILE__,
1790 theCommands.Add("range",
1791 "range edge [face] first last",__FILE__,
1794 theCommands.Add("polyline",
1795 "polyline name x1 y1 z1 x2 y2 z2 ...",__FILE__,
1798 theCommands.Add("polyvertex",
1799 "polyvertex name v1 v2 ...",__FILE__,
1802 theCommands.Add("wire",
1803 "wire wirename e1/w1 [e2/w2 ...]",__FILE__,
1806 theCommands.Add("profile",
1807 "profile, no args to get help",__FILE__,
1810 theCommands.Add("bsplineprof",
1811 "bsplineprof, no args to get help",__FILE__,
1814 theCommands.Add("2dprofile",
1815 "2dprofile, no args to get help",__FILE__,
1818 theCommands.Add("mkoffset",
1819 "mkoffset result face/compound of wires nboffset stepoffset [alt]",__FILE__,
1823 theCommands.Add("mkedge",
1824 "mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] ",__FILE__,
1827 theCommands.Add("mkcurve",
1828 "mkcurve curve edge",__FILE__,
1831 theCommands.Add("mkoricurve",
1832 "mkoricurve curve edge: \n the curve is colored according to the orientation of the edge",
1836 theCommands.Add("mk2dcurve",
1837 "mk2dcurve curve edge [face OR index]",__FILE__,
1840 theCommands.Add("mkpoint",
1841 "mkpoint point vertex",__FILE__,
1844 theCommands.Add("uisoedge",
1845 "uisoedge edge face u v1 v2",__FILE__,
1848 theCommands.Add("edge",
1849 "edge edgename v1 v2",__FILE__,
1852 theCommands.Add("visoedge",
1853 "visoedge edge face v u1 u2",__FILE__,
1856 theCommands.Add("transfert",
1857 "transfert edge1 edge2",__FILE__,
1860 theCommands.Add("pickface",
1861 "pickface",__FILE__,
1864 theCommands.Add("edgeintersector",
1865 "edgeintersector r E1 E2 F [Tol]",__FILE__,
1868 theCommands.Add("build3d",
1872 theCommands.Add("reducepcurves",
1873 "reducepcurves shape1 shape2 ...",
1876 theCommands.Add("concatC0wire",
1877 "concatC0wire result wire",
1882 theCommands.Add("concatwire",
1883 "concatwire result wire [option](G1/C1)",