1 // Created on: 1993-07-22
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
24 #include <BRepTest.hxx>
26 #include <Draw_Interpretor.hxx>
27 #include <Draw_Appli.hxx>
29 #include <BRepFill.hxx>
30 #include <BRepBuilderAPI_PipeError.hxx>
31 #include <BRepFill_Generator.hxx>
32 #include <BRepPrimAPI_MakePrism.hxx>
33 #include <BRepPrimAPI_MakeRevol.hxx>
34 #include <BRepOffsetAPI_MakePipe.hxx>
35 #include <BRepOffsetAPI_MakeEvolved.hxx>
36 #include <BRepOffsetAPI_ThruSections.hxx>
37 #include <BRepOffsetAPI_MakePipeShell.hxx>
38 #include <BRepOffsetAPI_MiddlePath.hxx>
40 #include <BRepLib_MakeWire.hxx>
42 #include <TopTools_ListIteratorOfListOfShape.hxx>
43 #include <TopExp_Explorer.hxx>
45 #include <Precision.hxx>
46 #include <Law_Interpol.hxx>
49 #include <gp_Pnt2d.hxx>
50 #include <TColgp_Array1OfPnt2d.hxx>
52 static BRepOffsetAPI_MakePipeShell* Sweep= 0;
56 #include <Geom_Curve.hxx>
57 #include <GeomAdaptor_HCurve.hxx>
58 #include <GeomFill_Pipe.hxx>
59 #include <Geom_Surface.hxx>
60 #include <BRepBuilderAPI_MakeFace.hxx>
61 #include <BRep_Tool.hxx>
63 //#endi#include <gp_Vec.hxx>
65 #include <Geom_Circle.hxx>
68 //=======================================================================
70 //=======================================================================
72 static Standard_Integer prism(Draw_Interpretor& , Standard_Integer n, const char** a)
76 TopoDS_Shape base = DBRep::Get(a[2]);
77 if (base.IsNull()) return 1;
79 gp_Vec V(atof(a[3]),atof(a[4]),atof(a[5]));
81 Standard_Boolean copy = Standard_False;
82 Standard_Boolean inf = Standard_False;
83 Standard_Boolean sinf = Standard_False;
86 copy = (*a[6] == 'c') || (*a[6] == 'C');
87 inf = (*a[6] == 'i') || (*a[6] == 'I');
88 sinf = (*a[6] == 's') || (*a[6] == 'S');
94 res = BRepPrimAPI_MakePrism(base,gp_Dir(V),inf);
96 res = BRepPrimAPI_MakePrism(base,V,copy);
104 //=======================================================================
106 //=======================================================================
108 static Standard_Integer revol(Draw_Interpretor& ,
109 Standard_Integer n, const char** a)
111 if (n < 10) return 1;
113 TopoDS_Shape base = DBRep::Get(a[2]);
114 if (base.IsNull()) return 1;
116 gp_Pnt P(atof(a[3]),atof(a[4]),atof(a[5]));
117 gp_Dir D(atof(a[6]),atof(a[7]),atof(a[8]));
120 Standard_Real angle = atof(a[9]) * (M_PI / 180.0);
122 Standard_Boolean copy = n > 10;
124 TopoDS_Shape res = BRepPrimAPI_MakeRevol(base,A,angle,copy);
126 DBRep::Set(a[1],res);
132 //=======================================================================
134 //=======================================================================
136 static Standard_Integer pipe(Draw_Interpretor& ,
137 Standard_Integer n, const char** a)
139 if ( n < 4) return 1;
141 TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_WIRE);
142 if ( Spine.IsNull()) return 1;
144 TopoDS_Shape Profile = DBRep::Get(a[3]);
145 if ( Profile.IsNull()) return 1;
147 TopoDS_Shape S = BRepOffsetAPI_MakePipe(TopoDS::Wire(Spine),Profile);
153 //=======================================================================
155 static Standard_Integer geompipe(Draw_Interpretor& ,
156 Standard_Integer n, const char** a)
158 TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_EDGE);
159 if ( Spine.IsNull()) return 1;
160 if ( n < 5) return 1;
161 TopoDS_Shape Profile = DBRep::Get(a[3],TopAbs_EDGE);
162 if ( Profile.IsNull()) return 1;
163 Standard_Real aSpFirst,aSpLast,aPrFirst,aPrLast;
164 Handle(Geom_Curve) SpineCurve = BRep_Tool::Curve(TopoDS::Edge(Spine),aSpFirst,aSpLast);
165 Handle(Geom_Curve) ProfileCurve = BRep_Tool::Curve(TopoDS::Edge(Profile),aPrFirst,aPrLast);
166 Handle(GeomAdaptor_HCurve) aAdaptCurve = new GeomAdaptor_HCurve(SpineCurve,aSpFirst,aSpLast);
167 Standard_Boolean ByACR = Standard_False;
168 Standard_Boolean rotate = Standard_False;
169 Standard_Real Radius = atof(a[4]);
172 ProfileCurve->D1(aSpFirst,ctr,norm);
173 gp_Vec xAxisStart(ctr,SpineCurve->Value(aSpFirst));
174 gp_Ax2 aAx2Start(ctr,norm,xAxisStart);
175 Handle(Geom_Circle) cStart=new Geom_Circle(aAx2Start,Radius);
176 Standard_Integer k =5;
178 ByACR = (atoi(a[k++]) ==1);
180 rotate = (atoi(a[k++])==1);
181 GeomFill_Pipe aPipe(ProfileCurve,aAdaptCurve,cStart,ByACR,rotate);
182 aPipe.Perform(Standard_True);
183 Handle(Geom_Surface) Sur=aPipe.Surface();
186 F = BRepBuilderAPI_MakeFace(Sur, Precision::Confusion());
191 //=======================================================================
194 //=======================================================================
196 Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char** a)
199 //cout << " 1) evolved result base profil : "<< endl;
200 //cout << " The relative position of the profil on the base" << endl;
201 //cout << " is given in the referencial axis. " << endl;
202 //cout << " 2) evolved result base profil o : "<< endl;
203 //cout << " This position is automatically computed." << endl;
204 di << " 1) evolved result base profil : "<< "\n";
205 di << " The relative position of the profil on the base" << "\n";
206 di << " is given in the referencial axis. " << "\n";
207 di << " 2) evolved result base profil o : "<< "\n";
208 di << " This position is automatically computed." << "\n";
212 if ( n < 4 ) return 1;
213 Standard_Boolean IsAFace = Standard_False;
214 Standard_Boolean Solid = (!strcmp(a[0],"evolvedsolid"));
218 TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_WIRE,Standard_False);
219 if ( Base.IsNull()) {
220 Base = DBRep::Get(a[2],TopAbs_FACE,Standard_False);
221 IsAFace = Standard_True;
223 if ( Base.IsNull()) return 1;
225 TopoDS_Shape InpuTShape(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
226 TopoDS_Wire Prof = TopoDS::Wire(InpuTShape);
227 // TopoDS_Wire Prof =
228 // TopoDS::Wire(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
229 if ( Prof.IsNull()) return 1;
233 = BRepOffsetAPI_MakeEvolved(TopoDS::Face(Base),Prof,GeomAbs_Arc,n == 4,Solid);
234 DBRep::Set(a[1],Volevo);
238 = BRepOffsetAPI_MakeEvolved(TopoDS::Wire(Base),Prof,GeomAbs_Arc,n == 4,Solid);
239 DBRep::Set(a[1],Volevo);
246 //=======================================================================
249 //=======================================================================
251 static Standard_Integer pruled(Draw_Interpretor& ,
252 Standard_Integer n, const char** a)
254 if ( n != 4) return 1;
256 Standard_Boolean YaWIRE = Standard_False;
257 TopoDS_Shape S1 = DBRep::Get(a[2],TopAbs_EDGE);
259 S1 = DBRep::Get(a[2],TopAbs_WIRE);
260 if (S1.IsNull()) return 1;
261 YaWIRE = Standard_True;
264 TopoDS_Shape S2 = DBRep::Get(a[3],TopAbs_EDGE);
266 S2 = DBRep::Get(a[3],TopAbs_WIRE);
267 if ( S2.IsNull()) return 1;
269 S1 = BRepLib_MakeWire(TopoDS::Edge(S1));
270 YaWIRE = Standard_True;
274 S2 = BRepLib_MakeWire(TopoDS::Edge(S2));
279 Result = BRepFill::Shell(TopoDS::Wire(S1),TopoDS::Wire(S2));
282 Result = BRepFill::Face(TopoDS::Edge(S1),TopoDS::Edge(S2));
285 DBRep::Set(a[1],Result);
290 //=======================================================================
292 //purpose : Create a surface between generating wires
293 //=======================================================================
295 Standard_Integer gener(Draw_Interpretor&, Standard_Integer n, const char** a)
297 if ( n < 4) return 1;
301 BRepFill_Generator Generator;
303 for ( Standard_Integer i = 2; i<= n-1 ; i++) {
304 Shape = DBRep::Get(a[i],TopAbs_WIRE);
308 Generator.AddWire(TopoDS::Wire(Shape));
313 TopoDS_Shell Shell = Generator.Shell();
315 DBRep::Set(a[1], Shell);
322 //=======================================================================
323 //function : thrusections
325 //=======================================================================
327 Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char** a)
331 Standard_Boolean check = Standard_True;
332 Standard_Boolean samenumber = Standard_True;
333 Standard_Integer index = 2;
335 if (!strcmp(a[1],"-N")) {
337 check = Standard_False;
343 Standard_Boolean issolid = ( atoi(a[index]) == 1 );
344 Standard_Boolean isruled = ( atoi(a[index+1]) == 1 );
346 BRepOffsetAPI_ThruSections Generator(issolid,isruled);
348 Standard_Integer NbEdges = 0;
349 Standard_Boolean IsFirstWire = Standard_False;
350 for ( Standard_Integer i = index+2; i<= n-1 ; i++) {
351 Standard_Boolean IsWire = Standard_True;
352 Shape = DBRep::Get(a[i], TopAbs_WIRE);
355 Generator.AddWire(TopoDS::Wire(Shape));
357 IsFirstWire = Standard_True;
359 IsFirstWire = Standard_False;
363 Shape = DBRep::Get(a[i], TopAbs_VERTEX);
364 IsWire = Standard_False;
366 Generator.AddVertex(TopoDS::Vertex(Shape));
371 Standard_Integer cpt = 0;
373 for (PE.Init(Shape, TopAbs_EDGE); PE.More(); PE.Next()) {
379 if (IsWire && cpt != NbEdges)
380 samenumber = Standard_False;
384 check = (check || !samenumber);
385 Generator.CheckCompatibility(check);
389 TopoDS_Shape Shell = Generator.Shape();
391 DBRep::Set(a[index-1], Shell);
396 //=======================================================================
398 //=======================================================================
399 static Standard_Integer mksweep(Draw_Interpretor& ,
400 Standard_Integer n, const char** a)
402 if ( n != 2) return 1;
403 TopoDS_Shape Spine = DBRep::Get(a[1],TopAbs_WIRE);
404 if ( Spine.IsNull()) return 1;
409 Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(Spine));
413 //=======================================================================
415 //=======================================================================
416 static Standard_Integer setsweep(Draw_Interpretor& di,
417 Standard_Integer n, const char** a)
420 //cout << "setsweep options [arg1 [arg2 [...]]] : options are :" << endl;
421 //cout << " -FR : Tangent and Normal are given by Frenet trihedron" <<endl;
422 //cout << " -CF : Tangente is given by Frenet," << endl;
423 //cout << " the Normal is computed to minimize the torsion " << endl;
424 //cout << " -DX Surf : Tangent and Normal are given by Darboux trihedron,"
426 //cout << " Surf have to be a shell or a face" <<endl;
427 //cout << " -CN dx dy dz : BiNormal is given by dx dy dz" << endl;
428 //cout << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<endl;
429 //cout << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<endl;
430 di << "setsweep options [arg1 [arg2 [...]]] : options are :" << "\n";
431 di << " -FR : Tangent and Normal are given by Frenet trihedron" <<"\n";
432 di << " -CF : Tangente is given by Frenet," << "\n";
433 di << " the Normal is computed to minimize the torsion " << "\n";
434 di << " -DX Surf : Tangent and Normal are given by Darboux trihedron," <<"\n";
435 di << " Surf have to be a shell or a face" <<"\n";
436 di << " -CN dx dy dz : BiNormal is given by dx dy dz" << "\n";
437 di << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<"\n";
438 di << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<"\n";
443 //cout << "You have forgotten the <<mksweep>> command !"<< endl;
444 di << "You have forgotten the <<mksweep>> command !"<< "\n";
447 if (!strcmp(a[1],"-FR")) {
448 Sweep->SetMode(Standard_True);
450 else if (!strcmp(a[1],"-CF")) {
451 Sweep->SetMode(Standard_False);
453 else if (!strcmp(a[1],"-DX")) {
455 //cout << "bad arguments !" << endl;
456 di << "bad arguments !" << "\n";
460 Surf = DBRep::Get(a[2],TopAbs_SHAPE);
462 //cout << a[2] <<"is not a shape !" << endl;
463 di << a[2] <<"is not a shape !" << "\n";
466 Sweep->SetMode(Surf);
468 else if (!strcmp(a[1],"-CN")) {
470 //cout << "bad arguments !" << endl;
471 di << "bad arguments !" << "\n";
474 gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4]));
477 else if (!strcmp(a[1],"-FX")) {
478 if ((n!=5)&&(n!=8)) {
479 //cout << "bad arguments !" << endl;
480 di << "bad arguments !" << "\n";
483 gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4]));
485 gp_Dir DN(atof(a[5]), atof(a[6]), atof(a[7]));
486 gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D, DN);
490 gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D);
494 else if (!strcmp(a[1],"-G")) // contour guide
498 //cout << "bad arguments !" << endl;
499 di << "bad arguments !" << "\n";
504 TopoDS_Shape Guide = DBRep::Get(a[2],TopAbs_WIRE);
505 Sweep->SetMode(TopoDS::Wire(Guide), atoi(a[3]), atoi(a[4]));
510 //cout << "The option "<< a[1] << " is unknown !" << endl;
511 di << "The option "<< a[1] << " is unknown !" << "\n";
518 //=======================================================================
520 //=======================================================================
521 static Standard_Integer addsweep(Draw_Interpretor& di,
522 Standard_Integer n, const char** a)
525 //cout << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << endl;
526 //cout << " -T : the wire/vertex have to be translated to assume contact"<< endl;
527 //cout << " with the spine" <<endl;
528 //cout << " -R : the wire have to be rotated to assume orthogonality"<<endl;
529 //cout << " with the spine's tangent" << endl;
530 di << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << "\n";
531 di << " -T : the wire/vertex have to be translated to assume contact"<< "\n";
532 di << " with the spine" <<"\n";
533 di << " -R : the wire have to be rotated to assume orthogonality"<<"\n";
534 di << " with the spine's tangent" << "\n";
539 //cout << "You have forgotten the <<mksweep>> command !"<< endl;
540 di << "You have forgotten the <<mksweep>> command !"<< "\n";
544 TopoDS_Shape Section;
545 TopoDS_Vertex Vertex;
546 Handle(Law_Interpol) thelaw;
548 Section = DBRep::Get(a[1], TopAbs_SHAPE);
549 if (Section.ShapeType() != TopAbs_WIRE &&
550 Section.ShapeType() != TopAbs_VERTEX)
552 //cout << a[1] <<"is not a wire and is not a vertex!" << endl;
553 di << a[1] <<"is not a wire and is not a vertex!" << "\n";
557 Standard_Boolean HasVertex=Standard_False,
562 Standard_Integer cur = 2;
564 TopoDS_Shape InputVertex(DBRep::Get(a[cur],TopAbs_VERTEX));
565 Vertex = TopoDS::Vertex(InputVertex);
566 // Vertex = TopoDS::Vertex(DBRep::Get(a[cur],TopAbs_VERTEX));
567 if (!Vertex.IsNull()) {
569 HasVertex = Standard_True;
572 // Reading of the translation option
573 if ((n>cur) && !strcmp(a[cur],"-T")) {
578 // Reading of the rotation option
579 if ((n>cur) && !strcmp(a[cur],"-R")) {
586 Standard_Integer nbreal = n-cur;
587 if ( (nbreal < 4) || (nbreal % 2 != 0) ) {
588 //cout << "bad arguments ! :" <<a[cur] << endl;
589 di << "bad arguments ! :" <<a[cur] << "\n";
590 } else { //law of interpolation
591 Standard_Integer ii, L= nbreal/2;
592 TColgp_Array1OfPnt2d ParAndRad(1, L);
593 for (ii=1; ii<=L; ii++, cur+=2) {
594 ParAndRad(ii).SetX(atof(a[cur]));
595 ParAndRad(ii).SetY(atof(a[cur+1]));
597 thelaw = new (Law_Interpol) ();
598 thelaw->Set(ParAndRad,
599 Abs(ParAndRad(1).Y() - ParAndRad(L).Y()) < Precision::Confusion());
604 if (thelaw.IsNull()) {
605 if (HasVertex) Sweep->Add(Section, Vertex, isT, isR);
606 else Sweep->Add(Section, isT, isR);
609 if (HasVertex) Sweep->SetLaw(Section, thelaw, Vertex, isT, isR);
610 else Sweep->SetLaw(Section, thelaw, isT, isR);
616 //=======================================================================
618 //=======================================================================
619 static Standard_Integer deletesweep(Draw_Interpretor& di,
620 Standard_Integer n, const char** a)
626 TopoDS_Shape InputShape(DBRep::Get(a[1],TopAbs_SHAPE));
627 Section = TopoDS::Wire(InputShape);
628 // Section = TopoDS::Wire(DBRep::Get(a[1],TopAbs_SHAPE));
629 if (Section.IsNull()) {
630 //cout << a[1] <<"is not a wire !" << endl;
631 di << a[1] <<"is not a wire !" << "\n";
635 Sweep->Delete(Section);
640 //=======================================================================
642 //=======================================================================
643 static Standard_Integer buildsweep(Draw_Interpretor& di,
644 Standard_Integer n, const char** a)
647 //cout << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << endl;
648 //cout << " -M : Discontinuities are treated by Modfication of"<< endl;
649 //cout << " the sweeping mode : it is the default" <<endl;
650 //cout << " -C : Discontinuities are treated like Right Corner" << endl;
651 //cout << " Treatement is Extent && Intersect" << endl;
652 //cout << " -R : Discontinuities are treated like Round Corner" << endl;
653 //cout << " Treatement is Intersect and Fill" << endl;
654 //cout << " -S : To build a Solid" << endl;
655 di << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << "\n";
656 di << " -M : Discontinuities are treated by Modfication of"<< "\n";
657 di << " the sweeping mode : it is the default" <<"\n";
658 di << " -C : Discontinuities are treated like Right Corner" << "\n";
659 di << " Treatement is Extent && Intersect" << "\n";
660 di << " -R : Discontinuities are treated like Round Corner" << "\n";
661 di << " Treatement is Intersect and Fill" << "\n";
662 di << " -S : To build a Solid" << "\n";
666 Standard_Boolean mksolid = Standard_False;
668 //cout << "You have forgotten the <<mksweep>> command !"<< endl;
669 di << "You have forgotten the <<mksweep>> command !"<< "\n";
673 if (!Sweep->IsReady()) {
674 //cout << "You have forgotten the <<addsweep>> command !"<< endl;
675 di << "You have forgotten the <<addsweep>> command !"<< "\n";
680 Standard_Integer cur=2;
682 BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
684 // Reading Transition
685 if (!strcmp(a[cur],"-C")) {
686 Transition = BRepBuilderAPI_RightCorner;
689 else if (!strcmp(a[cur],"-R")) {
690 Transition = BRepBuilderAPI_RoundCorner;
693 Sweep->SetTransitionMode(Transition);
696 if ((n>cur) && (!strcmp(a[cur],"-S")) ) mksolid = Standard_True;
698 // Calcul le resultat
700 if (!Sweep->IsDone()) {
701 //cout << "Buildsweep : Not Done" << endl;
702 di << "Buildsweep : Not Done" << "\n";
703 BRepBuilderAPI_PipeError Stat = Sweep->GetStatus();
704 if (Stat == BRepBuilderAPI_PlaneNotIntersectGuide) {
705 //cout << "Buildsweep : One Plane not intersect the guide" << endl;
706 di << "Buildsweep : One Plane not intersect the guide" << "\n";
708 if (Stat == BRepBuilderAPI_ImpossibleContact) {
709 //cout << "BuildSweep : One section can not be in contact with the guide" << endl;
710 di << "BuildSweep : One section can not be in contact with the guide" << "\n";
717 B = Sweep->MakeSolid();
718 //if (!B) cout << " BuildSweep : It is impossible to make a solid !" << endl;
719 if (!B) di << " BuildSweep : It is impossible to make a solid !" << "\n";
721 result = Sweep->Shape();
722 DBRep::Set(a[1],result);
728 //=======================================================================
730 //=======================================================================
731 static Standard_Integer simulsweep(Draw_Interpretor& di,
732 Standard_Integer n, const char** a)
734 if ( (n!=3) && (n!=4) ) return 1;
737 //cout << "You have forgotten the <<mksweep>> command !"<< endl;
738 di << "You have forgotten the <<mksweep>> command !"<< "\n";
742 if (!Sweep->IsReady()) {
743 //cout << "You have forgotten the <<addsweep>> command !"<< endl;
744 di << "You have forgotten the <<addsweep>> command !"<< "\n";
749 TopTools_ListOfShape List;
750 TopTools_ListIteratorOfListOfShape it;
751 Standard_Integer N, ii;
755 BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
756 // Lecture Transition
757 if (!strcmp(a[3],"-C")) {
758 Transition = BRepBuilderAPI_RightCorner;
760 else if (!strcmp(a[3],"-R")) {
761 Transition = BRepBuilderAPI_RoundCorner;
763 Sweep->SetTransitionMode(Transition);
766 // Calculate the result
767 Sweep->Simulate(N, List);
768 for (ii=1, it.Initialize(List); it.More(); it.Next(), ii++) {
769 sprintf(name,"%s_%d",a[1],ii);
770 DBRep::Set(name, it.Value());
776 //=======================================================================
778 //=======================================================================
779 static Standard_Integer middlepath(Draw_Interpretor& di,
780 Standard_Integer n, const char** a)
784 TopoDS_Shape aShape = DBRep::Get(a[2]);
785 if (aShape.IsNull()) return 1;
787 TopoDS_Shape StartShape = DBRep::Get(a[3]);
788 if (StartShape.IsNull()) return 1;
790 TopoDS_Shape EndShape = DBRep::Get(a[4]);
791 if (EndShape.IsNull()) return 1;
793 BRepOffsetAPI_MiddlePath Builder(aShape, StartShape, EndShape);
796 TopoDS_Shape Result = Builder.Shape();
797 DBRep::Set(a[1], Result);
802 //=======================================================================
803 //function : SweepCommands
805 //=======================================================================
807 void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
809 static Standard_Boolean done = Standard_False;
811 done = Standard_True;
813 DBRep::BasicCommands(theCommands);
815 const char* g = "Sweep commands";
817 theCommands.Add("prism",
818 "prism result base dx dy dz [Copy | Inf | Seminf]",
821 theCommands.Add("revol",
822 "revol result base px py pz dx dy dz angle [Copy]",
825 theCommands.Add("pipe",
826 "pipe result Wire_spine Profile",
829 theCommands.Add("evolved",
830 "evolved , no args to get help",
833 theCommands.Add("evolvedsolid",
834 "evolved , no args to get help",
837 theCommands.Add("pruled",
838 "pruled result Edge1/Wire1 Edge2/Wire2",
841 theCommands.Add("gener", "gener result wire1 wire2 [..wire..]",
844 theCommands.Add("thrusections", "thrusections [-N] result issolid isruled shape1 shape2 [..shape..], the option -N means no check on wires, shapes must be wires or vertices (only first or last)",
845 __FILE__,thrusections,g);
848 theCommands.Add("mksweep", "mksweep wire",
851 theCommands.Add("setsweep", "setsweep no args to get help",
852 __FILE__,setsweep,g);
854 theCommands.Add("addsweep",
855 "addsweep wire [vertex] [-M ] [-C] [auxiilaryshape]:no args to get help",
856 __FILE__,addsweep,g);
858 theCommands.Add("deletesweep",
859 "deletesweep wire, To delete a section",
860 __FILE__,deletesweep,g);
862 theCommands.Add("buildsweep", "builsweep [r] [option] [Tol] , no args to get help"
863 __FILE__,buildsweep,g);
865 theCommands.Add("simulsweep", "simulsweep r [n] [option]"
866 __FILE__,simulsweep,g);
867 theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]"
868 __FILE__,geompipe,g);
870 theCommands.Add("middlepath", "middlepath res shape startshape endshape",
871 __FILE__,middlepath,g);