1 // Created on: 1995-06-16
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1995-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 <Draw_Interpretor.hxx>
18 #include <Draw_Appli.hxx>
19 #include <DrawTrSurf.hxx>
21 #include <TopTools_ListOfShape.hxx>
22 #include <TopTools_ListIteratorOfListOfShape.hxx>
23 #include <TopTools_MapOfShape.hxx>
24 #include <TopTools_MapIteratorOfMapOfShape.hxx>
25 #include <TopExp_Explorer.hxx>
26 #include <TopoDS_Face.hxx>
27 #include <TopoDS_Wire.hxx>
28 #include <TopoDS_Shell.hxx>
29 #include <TopoDS_Compound.hxx>
30 #include <TopoDS_Edge.hxx>
33 #include <Geom_RectangularTrimmedSurface.hxx>
34 #include <Geom_Plane.hxx>
35 #include <Geom_CylindricalSurface.hxx>
38 #include <gp_Cylinder.hxx>
40 //#include <BRepFeat_LocalOperation.hxx>
41 #include <BRepFeat_Builder.hxx>
42 #include <BRepFeat_MakeCylindricalHole.hxx>
43 #include <BRepFeat_SplitShape.hxx>
44 #include <BRepFeat_Gluer.hxx>
46 #include <BRepFeat.hxx>
47 #include <BRepFeat_MakePrism.hxx>
48 #include <BRepFeat_MakeRevol.hxx>
49 #include <BRepFeat_MakePipe.hxx>
50 #include <BRepFeat_MakeDPrism.hxx>
51 #include <BRepFeat_MakeLinearForm.hxx>
52 #include <BRepFeat_MakeRevolutionForm.hxx>
54 #include <LocOpe_FindEdges.hxx>
55 #include <LocOpe_FindEdgesInFace.hxx>
57 #include <BRepOffset_MakeOffset.hxx>
58 #include <BRepOffset_MakeSimpleOffset.hxx>
59 #include <BRep_Tool.hxx>
60 #include <BRep_Builder.hxx>
62 #include <DBRep_DrawableShape.hxx>
63 #include <BRepTest.hxx>
64 #include <BRepTest_Objects.hxx>
66 #include <BRepFilletAPI_MakeFillet.hxx>
67 #include <ChFi3d_FilletShape.hxx>
68 #include <Message.hxx>
70 #include <Precision.hxx>
73 //#define strcasecmp _stricmp Already defined
74 Standard_IMPORT Draw_Viewer dout;
77 static BRepFeat_MakeCylindricalHole& getHole()
79 static BRepFeat_MakeCylindricalHole theHole;
82 static Standard_Boolean WithControl = Standard_True;
84 Standard_Boolean DownCastingEnforcing = Standard_False;
86 static BRepFeat_MakePrism& getPrism()
88 static BRepFeat_MakePrism thePrism;
91 static BRepFeat_MakeDPrism& getDPrism()
93 static BRepFeat_MakeDPrism theDPrism;
96 static BRepFeat_MakeRevol& getRevol()
98 static BRepFeat_MakeRevol theRevol;
101 static BRepFeat_MakePipe& getPipe()
103 static BRepFeat_MakePipe thePipe;
106 static BRepFeat_MakeLinearForm& getLienarForm()
108 static BRepFeat_MakeLinearForm theLF;
111 static BRepFeat_MakeRevolutionForm& getRevolutionForm()
113 static BRepFeat_MakeRevolutionForm theRF;
117 //Input shapes for Prism, DPrism, Revol, Pipe
118 static TopoDS_Shape theSbase, thePbase;
119 static TopoDS_Face theSkface;
121 static Standard_Boolean dprdef = Standard_False;
122 static Standard_Boolean prdef = Standard_False;
123 static Standard_Boolean rvdef = Standard_False;
124 static Standard_Boolean pidef = Standard_False;
125 static Standard_Boolean lfdef = Standard_False;
126 static Standard_Boolean rfdef = Standard_False;
128 static Standard_Real t3d = 1.e-4;
129 static Standard_Real t2d = 1.e-5;
130 static Standard_Real ta = 1.e-2;
131 static Standard_Real fl = 1.e-3;
132 static Standard_Real tapp_angle = 1.e-2;
133 static GeomAbs_Shape blend_cont = GeomAbs_C1;
134 static BRepFilletAPI_MakeFillet* Rakk = 0;
138 static void Print(Draw_Interpretor& di,
139 const BRepFeat_Status St)
141 di << " Error Status : ";
143 case BRepFeat_NoError:
147 case BRepFeat_InvalidPlacement:
148 di << "Invalid placement";
151 case BRepFeat_HoleTooLong:
152 di << "Hole too long";
157 static Standard_Integer Loc(Draw_Interpretor& theCommands,
158 Standard_Integer narg, const char** a)
160 if (narg < 6) return 1;
161 TopoDS_Shape S = DBRep::Get(a[2]);
162 TopoDS_Shape T = DBRep::Get(a[3]);
164 Standard_Boolean Fuse;
165 if (!strcasecmp("F", a[4])) {
166 Fuse = Standard_True;
168 else if (!strcasecmp("C", a[4])) {
169 Fuse = Standard_False;
175 TopTools_ListOfShape LF;
176 for (Standard_Integer i = 0; i <= narg - 6; i++) {
177 TopoDS_Shape aLocalShape(DBRep::Get(a[i + 5], TopAbs_FACE));
178 LF.Append(aLocalShape);
179 // LF.Append(TopoDS::Face(DBRep::Get(a[i+5],TopAbs_FACE)));
182 //BRepFeat_LocalOperation BLoc(S);
183 //BLoc.Perform(T,LF,Fuse);
184 //BLoc.BuildPartsOfTool();
185 TopTools_ListOfShape parts;
186 BRepFeat_Builder BLoc;
188 BLoc.SetOperation(Fuse);
189 //BRepFeat_LocalOperation BLoc;
190 //BLoc.Init(S,T,Fuse);
192 BLoc.PartsOfTool(parts);
196 strcpy(newname, a[1]);
198 while (*p != '\0') p++;
201 TopTools_ListIteratorOfListOfShape its(parts);
204 for (; its.More(); its.Next()) {
207 DBRep::Set(newname, its.Value());
211 Standard_Integer qq, ww, ee, button;
214 TopoDS_Shape aLocalShape(DBRep::Get(".", TopAbs_SHELL));
215 S = TopoDS::Shell(aLocalShape);
216 // S = TopoDS::Shell(DBRep::Get(".",TopAbs_SHELL));
217 Draw::LastPick(qq, ww, ee, button);
222 //BLoc.RemovePart(S);
235 } while (button != 3);
238 BLoc.PerformResult();
239 if (!BLoc.HasErrors()) {
241 DBRep::Set(a[1], BLoc.Shape());
245 theCommands << "Local operation not done";
251 static Standard_Integer HOLE1(Draw_Interpretor& theCommands,
252 Standard_Integer narg, const char** a)
254 if (narg < 10 || narg == 11) return 1;
255 TopoDS_Shape S = DBRep::Get(a[2]);
257 gp_Pnt Or(Draw::Atof(a[3]), Draw::Atof(a[4]), Draw::Atof(a[5]));
258 gp_Dir Di(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
260 Standard_Real Radius = Draw::Atof(a[9]);
262 getHole().Init(S, gp_Ax1(Or, Di));
265 getHole().Perform(Radius);
268 Standard_Real pfrom = Draw::Atof(a[10]);
269 Standard_Real pto = Draw::Atof(a[11]);
270 getHole().Perform(Radius, pfrom, pto, WithControl);
274 if (!getHole().HasErrors())
277 DBRep::Set(a[1], getHole().Shape());
281 theCommands << "Echec de MakeCylindricalHole";
282 Print(theCommands, getHole().Status());
286 static Standard_Integer HOLE2(Draw_Interpretor& theCommands,
287 Standard_Integer narg, const char** a)
289 if (narg < 10) return 1;
290 TopoDS_Shape S = DBRep::Get(a[2]);
292 gp_Pnt Or(Draw::Atof(a[3]), Draw::Atof(a[4]), Draw::Atof(a[5]));
293 gp_Dir Di(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
295 Standard_Real Radius = Draw::Atof(a[9]);
297 getHole().Init(S, gp_Ax1(Or, Di));
298 getHole().PerformThruNext(Radius, WithControl);
301 if (!getHole().HasErrors())
304 DBRep::Set(a[1], getHole().Shape());
308 theCommands << "Echec de MakeCylindricalHole";
309 Print(theCommands, getHole().Status());
313 static Standard_Integer HOLE3(Draw_Interpretor& theCommands,
314 Standard_Integer narg, const char** a)
316 if (narg < 10) return 1;
317 TopoDS_Shape S = DBRep::Get(a[2]);
319 gp_Pnt Or(Draw::Atof(a[3]), Draw::Atof(a[4]), Draw::Atof(a[5]));
320 gp_Dir Di(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
322 Standard_Real Radius = Draw::Atof(a[9]);
324 getHole().Init(S, gp_Ax1(Or, Di));
325 getHole().PerformUntilEnd(Radius, WithControl);
327 if (!getHole().HasErrors()) {
329 DBRep::Set(a[1], getHole().Shape());
333 theCommands << "Echec de MakeCylindricalHole";
334 Print(theCommands, getHole().Status());
339 static Standard_Integer HOLE4(Draw_Interpretor& theCommands,
340 Standard_Integer narg, const char** a)
342 if (narg < 11) return 1;
343 TopoDS_Shape S = DBRep::Get(a[2]);
345 gp_Pnt Or(Draw::Atof(a[3]), Draw::Atof(a[4]), Draw::Atof(a[5]));
346 gp_Dir Di(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
348 Standard_Real Radius = Draw::Atof(a[9]);
349 Standard_Real Length = Draw::Atof(a[10]);
351 getHole().Init(S, gp_Ax1(Or, Di));
352 getHole().PerformBlind(Radius, Length, WithControl);
354 if (!getHole().HasErrors())
357 DBRep::Set(a[1], getHole().Shape());
361 theCommands << "Echec de MakeCylindricalHole";
362 Print(theCommands, getHole().Status());
366 static Standard_Integer CONTROL(Draw_Interpretor& theCommands,
367 Standard_Integer narg, const char** a)
370 WithControl = strcmp("0", a[1]) != 0;
373 theCommands << "Mode avec controle";
376 theCommands << "Mode sans controle";
381 //=======================================================================
382 //function : reportOffsetState
383 //purpose : Print state of offset operation by error code.
384 //=======================================================================
385 static void reportOffsetState(Draw_Interpretor& theCommands,
386 const BRepOffset_Error theErrorCode)
388 switch (theErrorCode)
390 case BRepOffset_NoError:
392 theCommands << "OK. Offset performed successfully.";
395 case BRepOffset_BadNormalsOnGeometry:
397 theCommands << "ERROR. Degenerated normal on input data.";
400 case BRepOffset_C0Geometry:
402 theCommands << "ERROR. C0 continuity of input data.";
405 case BRepOffset_NullOffset:
407 theCommands << "ERROR. Null offset of all faces.";
410 case BRepOffset_NotConnectedShell:
412 theCommands << "ERROR. Incorrect set of faces to remove, the remaining shell is not connected.";
415 case BRepOffset_CannotTrimEdges:
417 theCommands << "ERROR. Can not trim edges.";
420 case BRepOffset_CannotFuseVertices:
422 theCommands << "ERROR. Can not fuse vertices.";
425 case BRepOffset_CannotExtentEdge:
427 theCommands << "ERROR. Can not extent edge.";
432 theCommands << "ERROR. offsetperform operation not done.";
438 //=======================================================================
441 //=======================================================================
443 static Standard_Integer PRW(Draw_Interpretor& theCommands,
444 Standard_Integer narg, const char** a)
446 if (narg < 9) return 1;
447 TopoDS_Shape S = DBRep::Get(a[3]);
448 BRepFeat_MakePrism thePFace;
450 TopoDS_Shape FFrom, FUntil;
451 Standard_Integer borne;
452 Standard_Boolean fuse;
453 if (a[1][0] == 'f' || a[1][0] == 'F') {
454 fuse = Standard_True;
456 else if (a[1][0] == 'c' || a[1][0] == 'C') {
457 fuse = Standard_False;
463 if (a[4][0] == '.' || IsAlphabetic(a[4][0])) {
467 if (a[5][0] == '.' || IsAlphabetic(a[5][0])) {
471 V.SetCoord(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
472 FFrom = DBRep::Get(a[4], TopAbs_SHAPE);
473 FUntil = DBRep::Get(a[5], TopAbs_SHAPE);
477 V.SetCoord(Draw::Atof(a[5]), Draw::Atof(a[6]), Draw::Atof(a[7]));
478 FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
483 V.SetCoord(Draw::Atof(a[4]), Draw::Atof(a[5]), Draw::Atof(a[6]));
486 Standard_Real Length = V.Magnitude();
487 if (Length < Precision::Confusion()) {
491 TopoDS_Shape aLocalShape(DBRep::Get(a[borne], TopAbs_FACE));
492 TopoDS_Face F = TopoDS::Face(aLocalShape);
493 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[borne],TopAbs_FACE));
494 BRepFeat_SplitShape Spls(F);
495 for (Standard_Integer i = borne + 1; i < narg; i++) {
497 if (a[i][0] != '-') {
498 aLocalShape = DBRep::Get(a[i], TopAbs_WIRE);
499 wir = TopoDS::Wire(aLocalShape);
500 // wir = TopoDS::Wire(DBRep::Get(a[i],TopAbs_WIRE));
505 const char* Temp = a[i] + 1;
506 aLocalShape = DBRep::Get(Temp, TopAbs_WIRE);
507 wir = TopoDS::Wire(aLocalShape);
508 // wir = TopoDS::Wire(DBRep::Get(Temp,TopAbs_WIRE));
515 TopoDS_Shape ToPrism;
516 const TopTools_ListOfShape& lleft = Spls.DirectLeft();
517 if (lleft.Extent() == 1) {
518 thePFace.Init(S, lleft.First(), F, V, fuse, Standard_True);
519 ToPrism = lleft.First();
525 TopTools_ListIteratorOfListOfShape it;
526 for (it.Initialize(lleft); it.More(); it.Next()) {
527 B.Add(Sh, TopoDS::Face(it.Value()));
529 Sh.Closed(BRep_Tool::IsClosed(Sh));
530 thePFace.Init(S, Sh, F, V, fuse, Standard_True);
534 // Recherche des faces de glissement, si on n`a pas sketche sur une face
535 // du shape de depart
537 // for (TopExp_Explorer exp(S,TopAbs_FACE);exp.More();exp.Next()) {
538 TopExp_Explorer exp(S, TopAbs_FACE);
539 for (; exp.More(); exp.Next()) {
540 if (exp.Current().IsSame(F)) {
546 LocOpe_FindEdgesInFace FEIF;
547 for (exp.Init(S, TopAbs_FACE); exp.More(); exp.Next()) {
548 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
549 Handle(Geom_Surface) Su = BRep_Tool::Surface(fac);
550 if (Su->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
551 Su = Handle(Geom_RectangularTrimmedSurface)::
552 DownCast(Su)->BasisSurface();
554 if (Su->DynamicType() == STANDARD_TYPE(Geom_Plane)) {
555 gp_Pln pl = Handle(Geom_Plane)::DownCast(Su)->Pln();
556 if (pl.Contains(gp_Lin(pl.Location(), V),
557 Precision::Confusion(),
558 Precision::Angular())) {
559 FEIF.Set(ToPrism, fac);
560 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
561 thePFace.Add(FEIF.Edge(), fac);
565 else if (Su->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface)) {
567 Handle(Geom_CylindricalSurface)::DownCast(Su)->Cylinder();
568 if (V.IsParallel(cy.Axis().Direction(), Precision::Angular())) {
569 FEIF.Set(ToPrism, fac);
570 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
571 thePFace.Add(FEIF.Edge(), fac);
579 thePFace.Perform(Length);
581 else if (borne == 8) {
582 thePFace.Perform(FUntil);
584 else if (borne == 9) {
585 if (!(FFrom.IsNull() || FUntil.IsNull())) {
586 thePFace.Perform(FFrom, FUntil);
588 else if (FFrom.IsNull()) {
589 if (!FUntil.IsNull()) {
590 thePFace.PerformFromEnd(FUntil);
593 thePFace.PerformThruAll();
597 // il faudrait inverser V et appeler PerfomFromEnd...
598 //std::cout << "Not Implemented" << std::endl;
599 theCommands << "Not Implemented\n";
602 if (!thePFace.IsDone()) {
603 theCommands << "Local operation not done";
607 DBRep::Set(a[2], thePFace);
613 //=======================================================================
616 //=======================================================================
618 static Standard_Integer PRF(Draw_Interpretor& theCommands,
619 Standard_Integer narg, const char** a)
621 if (narg < 8) return 1;
622 TopoDS_Shape S = DBRep::Get(a[3]);
623 BRepFeat_MakePrism thePFace;
624 Standard_Integer borne;
626 TopoDS_Shape FFrom, FUntil;
627 Standard_Boolean fuse;
628 if (a[1][0] == 'f' || a[1][0] == 'F') {
629 fuse = Standard_True;
631 else if (a[1][0] == 'c' || a[1][0] == 'C') {
632 fuse = Standard_False;
639 if (a[4][0] == '.' || IsAlphabetic(a[4][0])) {
643 if (a[5][0] == '.' || IsAlphabetic(a[5][0])) {
648 V.SetCoord(Draw::Atof(a[6]), Draw::Atof(a[7]), Draw::Atof(a[8]));
649 FFrom = DBRep::Get(a[4], TopAbs_SHAPE);
650 FUntil = DBRep::Get(a[5], TopAbs_SHAPE);
654 V.SetCoord(Draw::Atof(a[5]), Draw::Atof(a[6]), Draw::Atof(a[7]));
655 FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
660 V.SetCoord(Draw::Atof(a[4]), Draw::Atof(a[5]), Draw::Atof(a[6]));
662 Standard_Real Length = V.Magnitude();
663 if (Length < Precision::Confusion()) {
667 TopoDS_Shape ToPrism;
668 if (narg == borne + 1) {
669 TopoDS_Shape aLocalShape(DBRep::Get(a[borne], TopAbs_FACE));
670 TopoDS_Face F = TopoDS::Face(aLocalShape);
671 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[borne],TopAbs_FACE));
672 thePFace.Init(S, F, F, V, fuse, Standard_True);
679 for (Standard_Integer i = borne; i < narg; i++) {
680 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_FACE));
681 TopoDS_Face F = TopoDS::Face(aLocalShape);
682 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
687 She.Closed(BRep_Tool::IsClosed(She));
688 thePFace.Init(S, She, TopoDS_Face(), V, fuse, Standard_False);
692 // Recherche des faces de glissement, on ne prisme pas une face
693 // du shape de depart
695 // for (TopExp_Explorer exp(ToPrism,TopAbs_FACE);exp.More();exp.Next()) {
696 TopExp_Explorer exp(ToPrism, TopAbs_FACE);
697 for (; exp.More(); exp.Next()) {
698 // for (TopExp_Explorer exp2(S,TopAbs_FACE);exp2.More();exp2.Next()) {
699 TopExp_Explorer exp2(S, TopAbs_FACE);
700 for (; exp2.More(); exp2.Next()) {
701 if (exp2.Current().IsSame(exp.Current())) {
711 LocOpe_FindEdgesInFace FEIF;
712 for (exp.Init(S, TopAbs_FACE); exp.More(); exp.Next()) {
713 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
714 Handle(Geom_Surface) Su = BRep_Tool::Surface(fac);
715 if (Su->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
716 Su = Handle(Geom_RectangularTrimmedSurface)::
717 DownCast(Su)->BasisSurface();
719 if (Su->DynamicType() == STANDARD_TYPE(Geom_Plane)) {
720 gp_Pln pl = Handle(Geom_Plane)::DownCast(Su)->Pln();
721 if (pl.Contains(gp_Lin(pl.Location(), V),
722 Precision::Confusion(),
723 Precision::Angular())) {
724 FEIF.Set(ToPrism, fac);
725 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
726 thePFace.Add(FEIF.Edge(), fac);
730 else if (Su->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface)) {
732 Handle(Geom_CylindricalSurface)::DownCast(Su)->Cylinder();
733 if (V.IsParallel(cy.Axis().Direction(), Precision::Angular())) {
734 FEIF.Set(ToPrism, fac);
735 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
736 thePFace.Add(FEIF.Edge(), fac);
744 thePFace.Perform(Length);
746 else if (borne == 8) {
747 thePFace.Perform(FUntil);
749 else if (borne == 9) {
750 if (!(FFrom.IsNull() || FUntil.IsNull())) {
751 thePFace.Perform(FFrom, FUntil);
753 else if (FFrom.IsNull()) {
754 if (!FUntil.IsNull()) {
755 thePFace.PerformFromEnd(FUntil);
758 thePFace.PerformThruAll();
761 else { //FUntil.IsNull()
762 // il faudrait inverser V et appeler PerfomFromEnd...
763 //std::cout << "Not Implemented" << std::endl;
764 theCommands << "Not Implemented\n";
767 if (!thePFace.IsDone()) {
768 theCommands << "Local operation not done";
772 DBRep::Set(a[2], thePFace);
779 //=======================================================================
782 //=======================================================================
784 static Standard_Integer SPLS(Draw_Interpretor&,
785 Standard_Integer narg, const char** a)
787 Standard_Integer newnarg;
791 Message::SendFail() << "Invalid number of arguments. Should be : splitshape result shape [splitedges] "
792 "[face wire/edge/compound [wire/edge/compound ...] "
793 "[face wire/edge/compound [wire/edge/compound...] ...] "
794 "[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
797 TopoDS_Shape S = DBRep::Get(a[2]);
800 Message::SendFail() << "Invalid input shape " << a[2];
803 BRepFeat_SplitShape Spls(S);
804 Standard_Boolean pick = Standard_False;
807 Standard_Integer i = 3;
809 for (newnarg = 3; newnarg < narg; newnarg++) {
810 if (a[newnarg][0] == '@') {
816 (newnarg != narg && ((narg - newnarg) <= 2 || (narg - newnarg) % 2 != 1))) {
819 Standard_Boolean isSplittingEdges = Standard_False;
820 TopTools_SequenceOfShape aSplitEdges;
822 pick = (a[i][0] == '.');
824 TopoDS_Shape aSh = DBRep::Get(a[i]);
827 Message::SendFail() << "Invalid input shape " << a[i];
832 if (aSh.ShapeType() == TopAbs_FACE)
833 EF = TopoDS::Face(aSh);
836 if (aSh.ShapeType() == TopAbs_COMPOUND || aSh.ShapeType() == TopAbs_WIRE || aSh.ShapeType() == TopAbs_EDGE)
838 TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
839 for (; aExpE.More(); aExpE.Next())
840 aSplitEdges.Append(aExpE.Current());
842 isSplittingEdges = !aSplitEdges.IsEmpty();
848 while (i < newnarg) {
850 DBRep_DrawableShape::LastPick(EF, u, v);
852 if (!isSplittingEdges && !EF.IsNull() && EF.ShapeType() == TopAbs_FACE) {
853 // face wire/edge ...
855 while (i < newnarg) {
857 Standard_Boolean rever = Standard_False;
858 if (a[i][0] == '-') {
861 pick = (a[i][1] == '.');
862 const char* Temp = a[i] + 1;
863 W = DBRep::Get(Temp, TopAbs_SHAPE, Standard_False);
864 rever = Standard_True;
867 pick = (a[i][0] == '.');
868 W = DBRep::Get(a[i], TopAbs_SHAPE, Standard_False);
871 return 1; // on n`a rien recupere
873 TopAbs_ShapeEnum wtyp = W.ShapeType();
874 if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE && wtyp != TopAbs_COMPOUND && pick) {
875 DBRep_DrawableShape::LastPick(W, u, v);
876 wtyp = W.ShapeType();
878 if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE && wtyp != TopAbs_COMPOUND) {
879 EF = DBRep::Get(a[i]);
886 if (wtyp == TopAbs_WIRE) {
887 Spls.Add(TopoDS::Wire(W), TopoDS::Face(EF));
889 else if (wtyp == TopAbs_EDGE) {
890 Spls.Add(TopoDS::Edge(W), TopoDS::Face(EF));
893 Spls.Add(TopoDS::Compound(W), TopoDS::Face(EF));
901 if (isSplittingEdges)
903 TopoDS_Shape aSh = DBRep::Get(a[i]);
906 Message::SendFail() << "Invalid input shape " << a[i];
909 TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
910 for (; aExpE.More(); aExpE.Next())
911 aSplitEdges.Append(aExpE.Current());
915 Message::SendFail() << "Invalid input arguments. Should be : splitshape result shape [splitedges] "
916 "[face wire/edge/compound [wire/edge/compound ...] "
917 "[face wire/edge/compound [wire/edge/compound...] ...] "
918 "[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
925 if (isSplittingEdges)
926 Spls.Add(aSplitEdges);
928 // ici, i vaut newnarg
929 for (; i < narg; i += 2) {
931 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_EDGE));
932 Es = TopoDS::Edge(aLocalShape);
933 // Es = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
937 aLocalShape = DBRep::Get(a[i + 1], TopAbs_EDGE);
938 Ew = TopoDS::Edge(aLocalShape);
939 // Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
941 Message::SendFail() << "Invalid input shape " << a[i + 1];
944 Spls.Add(TopoDS::Edge(Ew), TopoDS::Edge(Es));
948 DBRep::Set(a[1], Spls);
952 //=======================================================================
953 //function : thickshell
955 //=======================================================================
956 Standard_Integer thickshell(Draw_Interpretor& theCommands,
957 Standard_Integer n, const char** a)
960 TopoDS_Shape S = DBRep::Get(a[2]);
961 if (S.IsNull()) return 1;
963 Standard_Real Of = Draw::Atof(a[3]);
965 GeomAbs_JoinType JT = GeomAbs_Arc;
968 if (!strcmp(a[4], "i"))
969 JT = GeomAbs_Intersection;
970 if (!strcmp(a[4], "t"))
971 JT = GeomAbs_Tangent;
974 Standard_Boolean Inter = Standard_False; //Standard_True;
975 Standard_Real Tol = Precision::Confusion();
977 Tol = Draw::Atof(a[5]);
979 BRepOffset_MakeOffset B;
980 B.Initialize(S, Of, Tol, BRepOffset_Skin, Inter, 0, JT, Standard_True);
984 const BRepOffset_Error aRetCode = B.Error();
985 reportOffsetState(theCommands, aRetCode);
987 DBRep::Set(a[1], B.Shape());
991 //=======================================================================
992 //function : offsetshape
994 //=======================================================================
996 Standard_Integer offsetshape(Draw_Interpretor& theCommands,
997 Standard_Integer n, const char** a)
1000 TopoDS_Shape S = DBRep::Get(a[2]);
1001 if (S.IsNull()) return 1;
1003 Standard_Real Of = Draw::Atof(a[3]);
1004 Standard_Boolean Inter = (!strcmp(a[0], "offsetcompshape"));
1005 GeomAbs_JoinType JT = GeomAbs_Arc;
1006 if (!strcmp(a[0], "offsetinter"))
1008 JT = GeomAbs_Intersection;
1009 Inter = Standard_True;
1012 BRepOffset_MakeOffset B;
1013 Standard_Integer IB = 4;
1014 Standard_Real Tol = Precision::Confusion();
1017 TopoDS_Shape SF = DBRep::Get(a[4], TopAbs_FACE);
1021 Tol = Draw::Atof(a[4]);
1024 B.Initialize(S, Of, Tol, BRepOffset_Skin, Inter, 0, JT);
1025 //------------------------------------------
1026 // recuperation et chargement des bouchons.
1027 //----------------------------------------
1028 Standard_Boolean YaBouchon = Standard_False;
1030 for (Standard_Integer i = IB; i < n; i++)
1032 TopoDS_Shape SF = DBRep::Get(a[i], TopAbs_FACE);
1035 YaBouchon = Standard_True;
1036 B.AddFace(TopoDS::Face(SF));
1040 if (!YaBouchon) B.MakeOffsetShape();
1041 else B.MakeThickSolid();
1043 const BRepOffset_Error aRetCode = B.Error();
1044 reportOffsetState(theCommands, aRetCode);
1046 DBRep::Set(a[1], B.Shape());
1051 static BRepOffset_MakeOffset TheOffset;
1052 static Standard_Real TheRadius;
1053 static Standard_Boolean theYaBouchon;
1054 static Standard_Real TheTolerance = Precision::Confusion();
1055 static Standard_Boolean TheInter = Standard_False;
1056 static GeomAbs_JoinType TheJoin = GeomAbs_Arc;
1057 static Standard_Boolean RemoveIntEdges = Standard_False;
1059 Standard_Integer offsetparameter(Draw_Interpretor& di,
1060 Standard_Integer n, const char** a)
1063 di << " offsetparameter Tol Inter(c/p) JoinType(a/i/t) [RemoveInternalEdges(r/k)]\n";
1064 di << " Current Values\n";
1065 di << " --> Tolerance : " << TheTolerance << "\n";
1066 di << " --> TheInter : ";
1073 di << "\n --> TheJoin : ";
1076 case GeomAbs_Arc: di << "Arc"; break;
1077 case GeomAbs_Intersection: di << "Intersection"; break;
1082 di << "\n --> Internal Edges : ";
1083 if (RemoveIntEdges) {
1094 if (n < 4) return 1;
1096 TheTolerance = Draw::Atof(a[1]);
1097 TheInter = strcmp(a[2], "p") != 0;
1099 if (!strcmp(a[3], "a")) TheJoin = GeomAbs_Arc;
1100 else if (!strcmp(a[3], "i")) TheJoin = GeomAbs_Intersection;
1101 else if (!strcmp(a[3], "t")) TheJoin = GeomAbs_Tangent;
1103 RemoveIntEdges = (n >= 5) ? !strcmp(a[4], "r") : Standard_False;
1108 //=======================================================================
1109 //function : offsetinit
1111 //=======================================================================
1113 Standard_Integer offsetload(Draw_Interpretor&,
1114 Standard_Integer n, const char** a)
1116 if (n < 2) return 1;
1117 TopoDS_Shape S = DBRep::Get(a[1]);
1118 if (S.IsNull()) return 1;
1120 Standard_Real Of = Draw::Atof(a[2]);
1122 // Standard_Boolean Inter = Standard_True;
1124 TheOffset.Initialize(S, Of, TheTolerance, BRepOffset_Skin, TheInter, 0, TheJoin,
1125 Standard_False, RemoveIntEdges);
1126 //------------------------------------------
1127 // recuperation et chargement des bouchons.
1128 //----------------------------------------
1129 for (Standard_Integer i = 3; i < n; i++) {
1130 TopoDS_Shape SF = DBRep::Get(a[i], TopAbs_FACE);
1132 TheOffset.AddFace(TopoDS::Face(SF));
1135 if (n < 4) theYaBouchon = Standard_False; //B.MakeOffsetShape();
1136 else theYaBouchon = Standard_True; //B.MakeThickSolid ();
1142 //=======================================================================
1143 //function : offsetonface
1145 //=======================================================================
1147 Standard_Integer offsetonface(Draw_Interpretor&, Standard_Integer n, const char** a)
1149 if (n < 3) return 1;
1151 for (Standard_Integer i = 1; i < n; i += 2) {
1152 TopoDS_Shape SF = DBRep::Get(a[i], TopAbs_FACE);
1154 Standard_Real Of = Draw::Atof(a[i + 1]);
1155 TheOffset.SetOffsetOnFace(TopoDS::Face(SF), Of);
1162 //=======================================================================
1163 //function : offsetperform
1165 //=======================================================================
1167 Standard_Integer offsetperform(Draw_Interpretor& theCommands,
1168 Standard_Integer theNArg, const char** a)
1170 if (theNArg < 2) return 1;
1173 TheOffset.MakeThickSolid();
1175 TheOffset.MakeOffsetShape();
1177 if (TheOffset.IsDone())
1179 DBRep::Set(a[1], TheOffset.Shape());
1183 const BRepOffset_Error aRetCode = TheOffset.Error();
1184 reportOffsetState(theCommands, aRetCode);
1187 // Store the history of Boolean operation into the session
1188 if (BRepTest_Objects::IsHistoryNeeded())
1190 TopTools_ListOfShape aLA;
1191 aLA.Append(TheOffset.InitShape());
1192 BRepTest_Objects::SetHistory<BRepOffset_MakeOffset>(aLA, TheOffset);
1199 //=======================================================================
1202 //=======================================================================
1204 static Standard_Integer ROW(Draw_Interpretor& theCommands,
1205 Standard_Integer narg, const char** a)
1207 if (narg < 13) return 1;
1208 TopoDS_Shape S = DBRep::Get(a[3]);
1209 BRepFeat_MakeRevol theRFace;
1212 Standard_Real Angle = 0;
1213 TopoDS_Shape FFrom, FUntil;
1214 Standard_Integer i, borne;
1215 Standard_Boolean fuse;
1217 if (a[1][0] == 'f' || a[1][0] == 'F') {
1218 fuse = Standard_True;
1220 else if (a[1][0] == 'c' || a[1][0] == 'C') {
1221 fuse = Standard_False;
1227 FFrom = DBRep::Get(a[4], TopAbs_SHAPE);
1228 if (FFrom.IsNull()) {
1229 Angle = Draw::Atof(a[4]);
1230 Angle *= M_PI / 180.;
1234 FUntil = DBRep::Get(a[5], TopAbs_SHAPE);
1235 if (FUntil.IsNull()) {
1250 Or.SetCoord(Draw::Atof(a[i]), Draw::Atof(a[i + 1]), Draw::Atof(a[i + 2]));
1251 D.SetCoord(Draw::Atof(a[i + 3]), Draw::Atof(a[i + 4]), Draw::Atof(a[i + 5]));
1252 gp_Ax1 theAxis(Or, D);
1254 TopoDS_Shape aLocalShape(DBRep::Get(a[borne], TopAbs_FACE));
1255 TopoDS_Face F = TopoDS::Face(aLocalShape);
1256 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[borne],TopAbs_FACE));
1257 BRepFeat_SplitShape Spls(F);
1258 for (i = borne + 1; i < narg; i++) {
1260 if (a[i][0] != '-') {
1261 aLocalShape = DBRep::Get(a[i], TopAbs_WIRE);
1262 wir = TopoDS::Wire(aLocalShape);
1263 // wir = TopoDS::Wire(DBRep::Get(a[i],TopAbs_WIRE));
1266 if (a[i][1] == '\0')
1268 const char* Temp = a[i] + 1;
1269 aLocalShape = DBRep::Get(Temp, TopAbs_WIRE);
1270 wir = TopoDS::Wire(aLocalShape);
1271 // wir = TopoDS::Wire(DBRep::Get(Temp,TopAbs_WIRE));
1278 TopoDS_Shape ToRotate;
1279 const TopTools_ListOfShape& lleft = Spls.DirectLeft();
1280 if (lleft.Extent() == 1) {
1281 theRFace.Init(S, lleft.First(), F, theAxis, fuse, Standard_True);
1282 ToRotate = lleft.First();
1288 TopTools_ListIteratorOfListOfShape it;
1289 for (it.Initialize(lleft); it.More(); it.Next()) {
1290 B.Add(Sh, TopoDS::Face(it.Value()));
1292 Sh.Closed(BRep_Tool::IsClosed(Sh));
1293 theRFace.Init(S, Sh, F, theAxis, fuse, Standard_True);
1297 // Recherche des faces de glissement
1298 // for (TopExp_Explorer exp(S,TopAbs_FACE);exp.More();exp.Next()) {
1299 TopExp_Explorer exp(S, TopAbs_FACE);
1300 for (; exp.More(); exp.Next()) {
1301 if (exp.Current().IsSame(F)) {
1307 LocOpe_FindEdgesInFace FEIF;
1308 for (exp.Init(S, TopAbs_FACE); exp.More(); exp.Next()) {
1309 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
1310 Handle(Geom_Surface) Su = BRep_Tool::Surface(fac);
1311 if (Su->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1312 Su = Handle(Geom_RectangularTrimmedSurface)::
1313 DownCast(Su)->BasisSurface();
1315 if (Su->DynamicType() == STANDARD_TYPE(Geom_Plane)) {
1316 gp_Pln pl = Handle(Geom_Plane)::DownCast(Su)->Pln();
1317 if (pl.Axis().IsParallel(theAxis, Precision::Angular())) {
1318 FEIF.Set(ToRotate, fac);
1319 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
1320 theRFace.Add(FEIF.Edge(), fac);
1324 else if (Su->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface)) {
1326 Handle(Geom_CylindricalSurface)::DownCast(Su)->Cylinder();
1327 if (cy.Axis().IsCoaxial(theAxis,
1328 Precision::Angular(), Precision::Confusion())) {
1329 FEIF.Set(ToRotate, fac);
1330 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
1331 theRFace.Add(FEIF.Edge(), fac);
1339 if (FUntil.IsNull()) {
1340 theRFace.Perform(Angle);
1343 theRFace.Perform(FUntil);
1346 else { // borne == 12
1347 theRFace.Perform(FFrom, FUntil);
1350 if (!theRFace.IsDone()) {
1351 theCommands << "Local operation not done";
1355 DBRep::Set(a[2], theRFace);
1361 //=======================================================================
1364 //=======================================================================
1366 static Standard_Integer ROF(Draw_Interpretor& theCommands,
1367 Standard_Integer narg, const char** a)
1369 if (narg < 12) return 1;
1370 TopoDS_Shape S = DBRep::Get(a[3]);
1371 BRepFeat_MakeRevol theRFace;
1374 Standard_Real Angle = 0;
1375 TopoDS_Shape FFrom, FUntil;
1376 Standard_Integer i, borne;
1377 Standard_Boolean fuse;
1379 if (a[1][0] == 'f' || a[1][0] == 'F') {
1380 fuse = Standard_True;
1382 else if (a[1][0] == 'c' || a[1][0] == 'C') {
1383 fuse = Standard_False;
1389 FFrom = DBRep::Get(a[4], TopAbs_SHAPE);
1390 if (FFrom.IsNull()) {
1391 Angle = Draw::Atof(a[4]);
1392 Angle *= M_PI / 180.;
1396 FUntil = DBRep::Get(a[5], TopAbs_SHAPE);
1397 if (FUntil.IsNull()) {
1412 Or.SetCoord(Draw::Atof(a[i]), Draw::Atof(a[i + 1]), Draw::Atof(a[i + 2]));
1413 D.SetCoord(Draw::Atof(a[i + 3]), Draw::Atof(a[i + 4]), Draw::Atof(a[i + 5]));
1414 gp_Ax1 theAxis(Or, D);
1416 TopoDS_Shape ToRotate;
1417 if (narg == borne + 1) {
1418 TopoDS_Shape aLocalShape(DBRep::Get(a[borne], TopAbs_FACE));
1419 TopoDS_Face F = TopoDS::Face(aLocalShape);
1420 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[borne],TopAbs_FACE));
1421 theRFace.Init(S, F, F, theAxis, fuse, Standard_True);
1429 for (i = borne; i < narg; i++) {
1430 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_FACE));
1431 TopoDS_Face F = TopoDS::Face(aLocalShape);
1432 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
1437 She.Closed(BRep_Tool::IsClosed(She));
1438 theRFace.Init(S, She, TopoDS_Face(), theAxis, fuse, Standard_False);
1442 // for (TopExp_Explorer exp(ToRotate,TopAbs_FACE);exp.More();exp.Next()) {
1443 TopExp_Explorer exp(ToRotate, TopAbs_FACE);
1444 for (; exp.More(); exp.Next()) {
1445 // for (TopExp_Explorer exp2(S,TopAbs_FACE);exp2.More();exp2.Next()) {
1446 TopExp_Explorer exp2(S, TopAbs_FACE);
1447 for (; exp2.More(); exp2.Next()) {
1448 if (exp2.Current().IsSame(exp.Current())) {
1458 LocOpe_FindEdgesInFace FEIF;
1459 for (exp.Init(S, TopAbs_FACE); exp.More(); exp.Next()) {
1460 const TopoDS_Face& fac = TopoDS::Face(exp.Current());
1461 Handle(Geom_Surface) Su = BRep_Tool::Surface(fac);
1462 if (Su->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1463 Su = Handle(Geom_RectangularTrimmedSurface)::
1464 DownCast(Su)->BasisSurface();
1466 if (Su->DynamicType() == STANDARD_TYPE(Geom_Plane)) {
1467 gp_Pln pl = Handle(Geom_Plane)::DownCast(Su)->Pln();
1468 if (pl.Axis().IsParallel(theAxis, Precision::Angular())) {
1469 FEIF.Set(ToRotate, fac);
1470 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
1471 theRFace.Add(FEIF.Edge(), fac);
1475 else if (Su->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface)) {
1477 Handle(Geom_CylindricalSurface)::DownCast(Su)->Cylinder();
1478 if (cy.Axis().IsCoaxial(theAxis,
1479 Precision::Angular(), Precision::Confusion())) {
1480 FEIF.Set(ToRotate, fac);
1481 for (FEIF.Init(); FEIF.More(); FEIF.Next()) {
1482 theRFace.Add(FEIF.Edge(), fac);
1490 if (FUntil.IsNull()) {
1491 theRFace.Perform(Angle);
1494 theRFace.Perform(FUntil);
1497 else { // borne == 12
1498 theRFace.Perform(FFrom, FUntil);
1501 if (!theRFace.IsDone()) {
1502 theCommands << "Local operation not done";
1506 DBRep::Set(a[2], theRFace);
1512 //=======================================================================
1514 //purpose : Commande glue
1515 //=======================================================================
1517 static Standard_Integer GLU(Draw_Interpretor&,
1518 Standard_Integer narg, const char** a)
1520 if (narg < 6 || narg % 2 != 0) return 1;
1521 TopoDS_Shape Sne = DBRep::Get(a[2]);
1522 TopoDS_Shape Sba = DBRep::Get(a[3]);
1524 Standard_Boolean pick;
1526 BRepFeat_Gluer theGl(Sne, Sba);
1527 TopoDS_Shape Fne, Fba;
1529 LocOpe_FindEdges fined;
1531 Standard_Integer i = 4;
1532 Standard_Boolean first = Standard_True;
1534 pick = (a[i][0] == '.');
1535 Fne = DBRep::Get(a[i]);
1539 TopAbs_ShapeEnum sht = Fne.ShapeType();
1540 if (pick && sht != TopAbs_FACE && sht != TopAbs_EDGE) {
1542 DBRep_DrawableShape::LastPick(Fne, u, v);
1543 sht = Fne.ShapeType();
1545 if (first && sht != TopAbs_FACE) {
1548 first = Standard_False;
1549 pick = (a[i + 1][0] == '.');
1550 Fba = DBRep::Get(a[i + 1]);
1554 if (pick && Fba.ShapeType() != sht) {
1556 DBRep_DrawableShape::LastPick(Fba, u, v);
1558 if (Fba.ShapeType() != sht) {
1561 if (sht == TopAbs_FACE) {
1562 const TopoDS_Face& f1 = TopoDS::Face(Fne);
1563 const TopoDS_Face& f2 = TopoDS::Face(Fba);
1565 fined.Set(Fne, Fba);
1566 for (fined.InitIterator(); fined.More(); fined.Next()) {
1567 theGl.Bind(fined.EdgeFrom(), fined.EdgeTo());
1571 theGl.Bind(TopoDS::Edge(Fne), TopoDS::Edge(Fba));
1576 DBRep::Set(a[1], theGl);
1581 static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
1582 Standard_Integer narg, const char** a)
1585 if (strcasecmp(a[0], "FEATPRISM") &&
1586 strcasecmp(a[0], "FEATDPRISM") &&
1587 strcasecmp(a[0], "FEATREVOL") &&
1588 strcasecmp(a[0], "FEATPIPE") &&
1589 strcasecmp(a[0], "FEATLF") &&
1590 strcasecmp(a[0], "FEATRF")) {
1594 if ((!strcasecmp(a[0], "FEATPRISM") && narg != 9) ||
1595 (!strcasecmp(a[0], "FEATREVOL") && narg != 12) ||
1596 (!strcasecmp(a[0], "FEATDPRISM") && narg != 7) ||
1597 (!strcasecmp(a[0], "FEATPIPE") && narg != 7) ||
1598 (!strcasecmp(a[0], "FEATLF") && narg != 12) ||
1599 (!strcasecmp(a[0], "FEATRF") && narg != 14)) {
1600 theCommands << "invalid number of arguments";
1604 TopoDS_Shape Sbase = DBRep::Get(a[1]);
1605 if (Sbase.IsNull()) {
1606 theCommands << "null basis shape";
1609 Standard_Integer Ifuse = Draw::Atoi(a[narg - 2]);
1610 Standard_Integer Imodif = Draw::Atoi(a[narg - 1]);
1612 Standard_Integer Fuse = Ifuse;
1613 Standard_Boolean Modify = (Imodif != 0);
1619 Handle(Geom_Plane) P;
1621 BRepFeat_StatusError se;
1623 if (strcasecmp(a[0], "FEATLF") && strcasecmp(a[0], "FEATRF")) {
1624 Pbase = DBRep::Get(a[2]);
1625 if (Pbase.IsNull()) {
1626 theCommands << "null shape to transform";
1629 TopoDS_Shape aLocalShape(DBRep::Get(a[3], TopAbs_FACE));
1630 Skface = TopoDS::Face(aLocalShape);
1631 // Skface = TopoDS::Face(DBRep::Get(a[3],TopAbs_FACE));
1632 if (Skface.IsNull()) {
1633 theCommands << "null face of Sketch";
1638 TopoDS_Shape aLocalShape(DBRep::Get(a[2], TopAbs_WIRE));
1639 W = TopoDS::Wire(aLocalShape);
1640 // W = TopoDS::Wire(DBRep::Get(a[2], TopAbs_WIRE));
1642 theCommands << "null profile for rib or slot";
1645 Handle(Geom_Surface) s = DrawTrSurf::GetSurface(a[3]);
1646 P = Handle(Geom_Plane)::DownCast(s);
1648 theCommands << "null plane to transform";
1652 if (narg == 9 || narg == 12 || narg == 14) {
1653 // Standard_Real X,Y,Z,X1,Y1,Z1;
1654 Standard_Real X, Y, Z;
1655 X = Draw::Atof(a[4]);
1656 Y = Draw::Atof(a[5]);
1657 Z = Draw::Atof(a[6]);
1659 if (narg == 9) { // prism
1660 prdef = Standard_True;
1664 getPrism().Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
1666 else if (narg == 14) {
1667 rfdef = Standard_True;
1669 X = Draw::Atof(a[7]);
1670 Y = Draw::Atof(a[8]);
1671 Z = Draw::Atof(a[9]);
1672 Standard_Real H1 = Draw::Atof(a[10]);
1673 Standard_Real H2 = Draw::Atof(a[11]);
1674 gp_Ax1 ax1(Or, gp_Dir(X, Y, Z));
1675 getRevolutionForm().Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
1676 if (!getRevolutionForm().IsDone())
1678 se = getRevolutionForm().CurrentStatusError();
1679 //BRepFeat::Print(se,std::cout) << std::endl;
1680 Standard_SStream aSStream;
1681 BRepFeat::Print(se, aSStream);
1682 theCommands << aSStream << "\n";
1686 else if (narg == 12 && strcasecmp(a[0], "FEATLF")) {
1687 rvdef = Standard_True;
1689 X = Draw::Atof(a[7]);
1690 Y = Draw::Atof(a[8]);
1691 Z = Draw::Atof(a[9]);
1695 getRevol().Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
1699 lfdef = Standard_True;
1700 gp_Vec Direct(X, Y, Z);
1701 X = Draw::Atof(a[7]);
1702 Y = Draw::Atof(a[8]);
1703 Z = Draw::Atof(a[9]);
1704 getLienarForm().Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
1705 if (!getLienarForm().IsDone())
1707 se = getLienarForm().CurrentStatusError();
1708 //BRepFeat::Print(se,std::cout) << std::endl;
1709 Standard_SStream aSStream;
1710 BRepFeat::Print(se, aSStream);
1711 theCommands << aSStream << "\n";
1716 else if (narg == 7) {
1717 if (!strcasecmp(a[0], "FEATDPRISM")) {
1718 if (Pbase.ShapeType() != TopAbs_FACE) {
1719 theCommands << "Invalid DPrism base";
1722 Standard_Real Angle = Draw::Atof(a[4])*M_PI / 360;
1723 dprdef = Standard_True;
1727 getDPrism().Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
1730 TopoDS_Shape aLocalShape(DBRep::Get(a[4], TopAbs_WIRE));
1731 TopoDS_Wire Spine = TopoDS::Wire(aLocalShape);
1732 // TopoDS_Wire Spine = TopoDS::Wire(DBRep::Get(a[4],TopAbs_WIRE));
1733 if (Spine.IsNull()) {
1734 TopoDS_Shape Edspine = DBRep::Get(a[4], TopAbs_EDGE);
1735 if (Edspine.IsNull()) {
1736 theCommands << "null spine";
1741 B.Add(Spine, Edspine);
1743 pidef = Standard_True;
1747 getPipe().Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
1755 static Standard_Integer ADD(Draw_Interpretor&,
1756 Standard_Integer narg, const char** a)
1759 if (narg < 4 || narg % 2 != 0) {
1762 if (!strcasecmp("PRISM", a[1])) {
1766 for (i = 2; i < narg; i += 2) {
1767 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_EDGE));
1768 TopoDS_Edge edg = TopoDS::Edge(aLocalShape);
1769 // TopoDS_Edge edg = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
1773 aLocalShape = DBRep::Get(a[i + 1], TopAbs_FACE);
1774 TopoDS_Face fac = TopoDS::Face(aLocalShape);
1775 // TopoDS_Face fac = TopoDS::Face(DBRep::Get(a[i+1],TopAbs_FACE));
1779 getPrism().Add(edg, fac);
1782 else if (!strcasecmp("REVOL", a[1])) {
1786 for (i = 2; i < narg; i += 2) {
1787 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_EDGE));
1788 TopoDS_Edge edg = TopoDS::Edge(aLocalShape);
1789 // TopoDS_Edge edg = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
1793 aLocalShape = DBRep::Get(a[i + 1], TopAbs_FACE);
1794 TopoDS_Face fac = TopoDS::Face(aLocalShape);
1795 // TopoDS_Face fac = TopoDS::Face(DBRep::Get(a[i+1],TopAbs_FACE));
1799 getRevol().Add(edg, fac);
1802 else if (!strcasecmp("PIPE", a[1])) {
1806 for (i = 2; i < narg; i += 2) {
1807 TopoDS_Shape aLocalShape(DBRep::Get(a[i], TopAbs_EDGE));
1808 TopoDS_Edge edg = TopoDS::Edge(aLocalShape);
1809 // TopoDS_Edge edg = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
1813 aLocalShape = DBRep::Get(a[i + 1], TopAbs_FACE);
1814 TopoDS_Face fac = TopoDS::Face(aLocalShape);
1815 // TopoDS_Face fac = TopoDS::Face(DBRep::Get(a[i+1],TopAbs_FACE));
1819 getPipe().Add(edg, fac);
1830 static Standard_Integer PERF(Draw_Interpretor& theCommands,
1831 Standard_Integer narg, const char** a)
1836 if (strcasecmp(a[0], "FEATPERFORM") &&
1837 strcasecmp(a[0], "FEATPERFORMVAL")) {
1841 TopTools_ListOfShape anArgs;
1842 Standard_Integer Kas;
1843 if (!strcasecmp("PRISM", a[1])) {
1846 theCommands << "prism not defined";
1850 else if (!strcasecmp("REVOL", a[1])) {
1853 theCommands << "revol not defined";
1857 else if (!strcasecmp("PIPE", a[1])) {
1860 theCommands << "pipe not defined";
1863 if (!strcasecmp(a[0], "FEATPERFORMVAL")) {
1864 theCommands << "invalid command for pipe";
1868 else if (!strcasecmp("DPRISM", a[1])) {
1871 theCommands << "dprism not defined";
1875 else if (!strcasecmp("LF", a[1])) {
1878 theCommands << "lf not defined";
1881 if (!strcasecmp(a[0], "FEATPERFORMVAL")) {
1882 theCommands << "invalid command for lf";
1886 else if (!strcasecmp("RF", a[1])) {
1889 theCommands << "rf not defined";
1892 if (!strcasecmp(a[0], "FEATPERFORMVAL")) {
1893 theCommands << "invalid command for rf";
1898 theCommands << "unknown argument : " << a[1];
1902 if (!strcasecmp(a[0], "FEATPERFORMVAL")) {
1903 if (narg != 4 && narg != 5) {
1904 theCommands << "invalid number of arguments";
1908 Standard_Real Val = Draw::Atof(a[3]);
1910 getPrism().Perform(Val);
1912 else if (Kas == 2) {
1913 Val *= (M_PI / 180.);
1914 getRevol().Perform(Val);
1916 else if (Kas == 4) {
1917 getDPrism().Perform(Val);
1919 else if (Kas == 5) {
1920 theCommands << "invalid command for lf";
1923 else if (Kas == 6) {
1924 theCommands << "invalid command for rf";
1928 else if (narg == 5) {
1929 Standard_Real Val = Draw::Atof(a[3]);
1930 TopoDS_Shape FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
1932 getPrism().PerformUntilHeight(FUntil, Val);
1934 else if (Kas == 2) {
1935 Val *= (M_PI / 180.);
1936 getRevol().PerformUntilAngle(FUntil, Val);
1938 else if (Kas == 4) {
1939 getDPrism().PerformUntilHeight(FUntil, Val);
1942 theCommands << "invalid command for ribs or slots";
1947 else if (!strcasecmp(a[0], "FEATPERFORM")) {
1948 if (narg == 3) { // Thru all
1951 getPrism().PerformThruAll();
1954 getRevol().PerformThruAll();
1957 getPipe().Perform();
1960 getDPrism().PerformThruAll();
1963 getLienarForm().Perform();
1966 getRevolutionForm().Perform();
1973 else if (narg == 4) { // Until
1974 TopoDS_Shape Funtil = DBRep::Get(a[3], TopAbs_SHAPE);
1978 if (Funtil.IsNull()) {
1979 getPrism().PerformUntilEnd();
1982 getPrism().Perform(Funtil);
1988 if (!Funtil.IsNull()) {
1989 getRevol().Perform(Funtil);
1998 if (!Funtil.IsNull())
2000 getPipe().Perform(Funtil);
2003 theCommands << "invalid command for ribs pipe";
2010 if (!Funtil.IsNull()) {
2011 getDPrism().Perform(Funtil);
2014 getDPrism().PerformUntilEnd();
2020 theCommands << "invalid command for lf";
2026 theCommands << "invalid command for rf";
2034 else if (narg == 5) {
2035 TopoDS_Shape Ffrom = DBRep::Get(a[3], TopAbs_SHAPE);
2036 TopoDS_Shape Funtil = DBRep::Get(a[4], TopAbs_SHAPE);
2037 if (Funtil.IsNull()) {
2045 getPrism().PerformFromEnd(Funtil);
2049 getPrism().Perform(Ffrom, Funtil);
2055 if (Ffrom.IsNull()) {
2058 getRevol().Perform(Ffrom, Funtil);
2063 if (Ffrom.IsNull()) {
2066 getPipe().Perform(Ffrom, Funtil);
2071 if (Ffrom.IsNull()) {
2072 getDPrism().PerformFromEnd(Funtil);
2075 getDPrism().Perform(Ffrom, Funtil);
2086 BRepFeat_StatusError se;
2089 if (!getPrism().IsDone())
2091 se = getPrism().CurrentStatusError();
2092 //BRepFeat::Print(se,std::cout) << std::endl;
2093 Standard_SStream aSStream;
2094 BRepFeat::Print(se, aSStream);
2095 theCommands << aSStream << "\n";
2098 DBRep::Set(a[2], getPrism());
2101 if (BRepTest_Objects::IsHistoryNeeded())
2104 anArgs.Append(theSbase);
2105 anArgs.Append(thePbase);
2106 anArgs.Append(theSkface);
2107 BRepTest_Objects::SetHistory(anArgs, getPrism());
2111 if (!getRevol().IsDone())
2113 se = getRevol().CurrentStatusError();
2114 //BRepFeat::Print(se,std::cout) << std::endl;
2115 Standard_SStream aSStream;
2116 BRepFeat::Print(se, aSStream);
2117 theCommands << aSStream << "\n";
2121 if (BRepTest_Objects::IsHistoryNeeded())
2124 anArgs.Append(theSbase);
2125 anArgs.Append(thePbase);
2126 anArgs.Append(theSkface);
2127 BRepTest_Objects::SetHistory(anArgs, getRevol());
2129 DBRep::Set(a[2], getRevol());
2133 if (!getPipe().IsDone())
2135 se = getPipe().CurrentStatusError();
2136 //BRepFeat::Print(se,std::cout) << std::endl;
2137 Standard_SStream aSStream;
2138 BRepFeat::Print(se, aSStream);
2139 theCommands << aSStream << "\n";
2143 if (BRepTest_Objects::IsHistoryNeeded())
2146 anArgs.Append(theSbase);
2147 anArgs.Append(thePbase);
2148 anArgs.Append(theSkface);
2149 BRepTest_Objects::SetHistory(anArgs, getPipe());
2151 DBRep::Set(a[2], getPipe());
2155 if (!getDPrism().IsDone())
2157 se = getDPrism().CurrentStatusError();
2158 //BRepFeat::Print(se,std::cout) << std::endl;
2159 Standard_SStream aSStream;
2160 BRepFeat::Print(se, aSStream);
2161 theCommands << aSStream << "\n";
2165 if (BRepTest_Objects::IsHistoryNeeded())
2168 anArgs.Append(theSbase);
2169 anArgs.Append(thePbase);
2170 anArgs.Append(theSkface);
2171 BRepTest_Objects::SetHistory(anArgs, getDPrism());
2173 DBRep::Set(a[2], getDPrism());
2177 if (!getLienarForm().IsDone())
2179 se = getLienarForm().CurrentStatusError();
2180 //BRepFeat::Print(se,std::cout) << std::endl;
2181 Standard_SStream aSStream;
2182 BRepFeat::Print(se, aSStream);
2183 theCommands << aSStream << "\n";
2186 DBRep::Set(a[2], getLienarForm());
2190 if (!getRevolutionForm().IsDone())
2192 se = getRevolutionForm().CurrentStatusError();
2193 //BRepFeat::Print(se,std::cout) << std::endl;
2194 Standard_SStream aSStream;
2195 BRepFeat::Print(se, aSStream);
2196 theCommands << aSStream << "\n";
2199 DBRep::Set(a[2], getRevolutionForm());
2208 static Standard_Integer BOSS(Draw_Interpretor& theCommands,
2209 Standard_Integer narg, const char** a)
2211 if (strcasecmp(a[0], "ENDEDGES") && strcasecmp(a[0], "FILLET")
2212 && strcasecmp(a[0], "BOSSAGE")) {
2216 if ((!strcasecmp(a[0], "ENDEDGES") && narg != 5) ||
2217 (!strcasecmp(a[0], "FILLET") && (narg < 5 || narg % 2 != 1)) ||
2218 (!strcasecmp(a[0], "BOSSAGE") && narg != 6)) {
2219 theCommands.PrintHelp(a[0]);
2223 Standard_Integer Kas = 0;
2224 Standard_Integer dprsig = 0;
2225 if (!strcasecmp("ENDEDGES", a[0])) {
2227 dprsig = Draw::Atoi(a[4]);
2229 else if (!strcasecmp("FILLET", a[0])) {
2232 else if (!strcasecmp("BOSSAGE", a[0])) {
2234 dprsig = Draw::Atoi(a[5]);
2237 TopoDS_Shape theShapeTop;
2238 TopoDS_Shape theShapeBottom;
2240 if (Kas == 1 || Kas == 3) {
2241 if (!strcasecmp("DPRISM", a[1])) {
2243 theCommands << "dprism not defined";
2248 theCommands << "unknown argument : " << a[1];
2252 getDPrism().BossEdges(dprsig);
2254 TopTools_ListOfShape theTopEdges, theLatEdges;
2255 theTopEdges = getDPrism().TopEdges();
2256 theLatEdges = getDPrism().LatEdges();
2258 TopTools_ListIteratorOfListOfShape it;
2261 B.MakeCompound(TopoDS::Compound(theShapeTop));
2262 it.Initialize(theTopEdges);
2263 for (; it.More(); it.Next()) {
2264 TopExp_Explorer exp;
2265 for (exp.Init(it.Value(), TopAbs_EDGE); exp.More(); exp.Next()) {
2266 B.Add(theShapeTop, exp.Current());
2269 DBRep::Set(a[2], theShapeTop);
2272 B.MakeCompound(TopoDS::Compound(theShapeBottom));
2273 it.Initialize(theLatEdges);
2274 for (; it.More(); it.Next()) {
2275 B.Add(theShapeBottom, it.Value());
2277 DBRep::Set(a[3], theShapeBottom);
2279 if (Kas == 1) return 0;
2282 if (Kas == 2 || Kas == 3) {
2284 // Standard_Integer nrad;
2287 V = DBRep::Get(a[2], TopAbs_SHAPE);
2289 else if (Kas == 3) {
2293 if (V.IsNull()) return 1;
2294 ChFi3d_FilletShape FSh = ChFi3d_Rational;
2297 Rakk = new BRepFilletAPI_MakeFillet(V, FSh);
2298 Rakk->SetParams(ta, t3d, t2d, t3d, t2d, fl);
2299 Rakk->SetContinuity(blend_cont, tapp_angle);
2303 Standard_Integer nbedge = 0;
2306 for (Standard_Integer ii = 1; ii < (narg - 1) / 2; ii++) {
2307 Rad = Draw::Atof(a[2 * ii + 1]);
2308 if (Rad == 0.) continue;
2309 S = DBRep::Get(a[(2 * ii + 2)], TopAbs_SHAPE);
2310 TopExp_Explorer exp;
2311 for (exp.Init(S, TopAbs_EDGE); exp.More(); exp.Next()) {
2312 E = TopoDS::Edge(exp.Current());
2320 else if (Kas == 3) {
2321 Rad = Draw::Atof(a[3]);
2324 TopExp_Explorer exp;
2325 for (exp.Init(S, TopAbs_EDGE); exp.More(); exp.Next()) {
2326 E = TopoDS::Edge(exp.Current());
2333 Rad = Draw::Atof(a[4]);
2336 TopExp_Explorer exp;
2337 for (exp.Init(S, TopAbs_EDGE); exp.More(); exp.Next()) {
2338 E = TopoDS::Edge(exp.Current());
2347 if (!nbedge) return 1;
2349 if (!Rakk->IsDone()) return 1;
2350 TopoDS_Shape res = Rakk->Shape();
2353 DBRep::Set(a[1], res);
2355 else if (Kas == 3) {
2356 DBRep::Set(a[2], res);
2360 // Save history for fillet
2361 if (BRepTest_Objects::IsHistoryNeeded())
2363 TopTools_ListOfShape anArg;
2365 BRepTest_Objects::SetHistory(anArg, *Rakk);
2374 //=============================================================================
2375 //function : ComputeSimpleOffset
2376 //purpose : Computes simple offset.
2377 //=============================================================================
2378 static Standard_Integer ComputeSimpleOffset(Draw_Interpretor& theCommands,
2379 Standard_Integer narg,
2384 theCommands << "offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]\n";
2389 TopoDS_Shape aShape = DBRep::Get(a[2]);
2390 if (aShape.IsNull())
2392 theCommands << "Input shape is null";
2395 const Standard_Real anOffsetValue = Draw::Atof(a[3]);
2396 if (Abs(anOffsetValue) < gp::Resolution())
2398 theCommands << "Null offset value";
2402 Standard_Boolean makeSolid = (narg > 4 && !strcasecmp(a[4], "solid"));
2403 int iTolArg = (makeSolid ? 5 : 4);
2404 Standard_Real aTol = (narg > iTolArg ? Draw::Atof(a[iTolArg]) : Precision::Confusion());
2406 BRepOffset_MakeSimpleOffset aMaker(aShape, anOffsetValue);
2407 aMaker.SetTolerance(aTol);
2408 aMaker.SetBuildSolidFlag(makeSolid);
2411 if (!aMaker.IsDone())
2413 theCommands << "ERROR:" << aMaker.GetErrorMessage() << "\n";
2417 DBRep::Set(a[1], aMaker.GetResultShape());
2422 //=======================================================================
2423 //function : FeatureCommands
2425 //=======================================================================
2427 void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
2429 static Standard_Boolean done = Standard_False;
2431 done = Standard_True;
2433 DBRep::BasicCommands(theCommands);
2435 const char* g = "TOPOLOGY Feature commands";
2437 theCommands.Add("localope",
2438 " Performs a local top. operation : localope result shape tool F/C (fuse/cut) face [face...]",
2441 theCommands.Add("hole",
2442 " Performs a hole : hole result shape Or.X Or.Y Or.Z Dir.X Dir.Y Dir.Z Radius [Pfrom Pto]",
2443 __FILE__, HOLE1, g);
2445 theCommands.Add("firsthole",
2446 " Performs the first hole : firsthole result shape Or.X Or.Y Or.Z Dir.X Dir.Y Dir.Z Radius",
2447 __FILE__, HOLE2, g);
2449 theCommands.Add("holend",
2450 " Performs the hole til end : holend result shape Or.X Or.Y Or.Z Dir.X Dir.Y Dir.Z Radius",
2451 __FILE__, HOLE3, g);
2453 theCommands.Add("blindhole",
2454 " Performs the blind hole : blindhole result shape Or.X Or.Y Or.Z Dir.X Dir.Y Dir.Z Radius Length",
2455 __FILE__, HOLE4, g);
2457 theCommands.Add("holecontrol",
2458 "Sets/Unsets or display controls on holes : holecontrol [0/1]",
2459 __FILE__, CONTROL, g);
2461 theCommands.Add("wprism",
2462 "Prisms wires on a face : wprism f[use]/c[ut] result shape [[FaceFrom] FaceUntil] VecX VecY VecZ SkecthFace wire1 [wire2 ....]",
2466 theCommands.Add("fprism",
2467 "Prisms a set of faces of a shape : fprism f[use]/c[ut] result shape [[FaceFrom] FaceUntil] VecX VecY VecZ face1 [face2...]",
2471 theCommands.Add("wrotate",
2472 "Rotates wires on a face : wrotate f[use]/c[ut] result shape Angle/[FFrom] FUntil OX OY OZ DX DY DZ SkecthFace wire1 [wire2 ....]",
2476 theCommands.Add("frotate",
2477 "Rotates a set of faces of a shape : frotate f[use]/c[ut] result shape Angle/[FaceFrom] FaceUntil OX OY OZ DX DY DZ face1 [face2...]",
2481 theCommands.Add("splitshape",
2482 "splitshape result shape [splitedges] [face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
2486 theCommands.Add("thickshell",
2487 "thickshell r shape offset [jointype [tol] ]",
2488 __FILE__, thickshell, g);
2490 theCommands.Add("offsetshape",
2491 "offsetshape r shape offset [tol] [face ...]",
2492 __FILE__, offsetshape, g);
2494 theCommands.Add("offsetcompshape",
2495 "offsetcompshape r shape offset [face ...]",
2496 __FILE__, offsetshape, g);
2498 theCommands.Add("offsetparameter",
2499 "offsetparameter Tol Inter(c/p) JoinType(a/i/t) [RemoveInternalEdges(r/k)]",
2500 __FILE__, offsetparameter);
2502 theCommands.Add("offsetload",
2503 "offsetload shape offset bouchon1 bouchon2 ...",
2504 __FILE__, offsetload, g);
2506 theCommands.Add("offsetonface",
2507 "offsetonface face1 offset1 face2 offset2 ...",
2508 __FILE__, offsetonface, g);
2510 theCommands.Add("offsetperform",
2511 "offsetperform result",
2512 __FILE__, offsetperform, g);
2514 theCommands.Add("glue",
2515 "glue result shapenew shapebase facenew facebase [facenew facebase...] [edgenew edgebase [edgenew edgebase...]]",
2519 theCommands.Add("featprism",
2520 "Defines the arguments for a prism : featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)",
2523 theCommands.Add("featrevol",
2524 "Defines the arguments for a revol : featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)",
2527 theCommands.Add("featpipe",
2528 "Defines the arguments for a pipe : featpipe shape element skface spine Fuse(0/1/2) Modify(0/1)",
2531 theCommands.Add("featdprism",
2532 "Defines the arguments for a drafted prism : featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)",
2535 theCommands.Add("featlf",
2536 "Defines the arguments for a linear rib or slot : featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)",
2539 theCommands.Add("featrf",
2540 "Defines the arguments for a rib or slot of revolution : featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)",
2543 theCommands.Add("addslide",
2544 " Adds sliding elements : addslide prism/revol/pipe edge face [edge face...]",
2547 theCommands.Add("featperform",
2548 " Performs the prism revol dprism linform or pipe :featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]",
2551 theCommands.Add("featperformval",
2552 " Performs the prism revol dprism or linform with a value :featperformval prism/revol/dprism/lf result value",
2555 theCommands.Add("endedges",
2556 " Return top and bottom edges of dprism :endedges dprism shapetop shapebottom First/LastShape (1/2)",
2559 theCommands.Add("fillet",
2560 " Perform fillet on compounds of edges :fillet result object rad1 comp1 rad2 comp2 ...",
2563 theCommands.Add("bossage",
2564 " Perform fillet on top and bottom edges of dprism :bossage dprism result radtop radbottom First/LastShape (1/2)",
2567 theCommands.Add("offsetshapesimple",
2568 "offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
2569 __FILE__, ComputeSimpleOffset);