1 // Created on: 1994-12-13
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1994-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 <Standard_Stream.hxx>
18 #include <Standard_Macro.hxx>
20 #include <BRepTest.hxx>
23 #include <Draw_Appli.hxx>
24 #include <Draw_Interpretor.hxx>
25 #include <Draw_Box.hxx>
27 #include <BRepBuilderAPI.hxx>
28 #include <BRepBuilderAPI_FindPlane.hxx>
29 #include <BRepBuilderAPI_Copy.hxx>
30 #include <BRepBuilderAPI_Transform.hxx>
31 #include <BRepBuilderAPI_GTransform.hxx>
32 #include <BRepBuilderAPI_NurbsConvert.hxx>
35 #include <gp_GTrsf.hxx>
36 #include <BRepOffsetAPI_NormalProjection.hxx>
37 #include <BRepLib.hxx>
38 #include <BRep_Builder.hxx>
39 #include <BRepBndLib.hxx>
40 #include <Bnd_Box.hxx>
41 #include <Bnd_Box2d.hxx>
42 #include <Message.hxx>
43 #include <TopExp_Explorer.hxx>
45 #include <BRepTools_WireExplorer.hxx>
47 #include <GCPnts_QuasiUniformAbscissa.hxx>
48 #include <Geom2dAdaptor_Curve.hxx>
49 #include <GeomAdaptor_Curve.hxx>
50 #include <ProjLib_ComputeApproxOnPolarSurface.hxx>
51 #include <DrawTrSurf.hxx>
52 #include <Geom_Plane.hxx>
54 #include <OSD_Timer.hxx>
55 #include <Draw_Segment3D.hxx>
56 #include <Draw_Marker3D.hxx>
57 #include <Draw_MarkerShape.hxx>
58 #include <BRepPrimAPI_MakeBox.hxx>
59 #include <BRepTools_PurgeLocations.hxx>
60 #include <BRepTools.hxx>
61 #include <Standard_Dump.hxx>
65 Standard_IMPORT Draw_Viewer dout;
67 //=======================================================================
68 //function : ConvertBndToShape
69 //purpose : Creates TopoDS_Solid from theBox
70 //=======================================================================
71 static void ConvertBndToShape(const Bnd_OBB& theBox,
72 const char* const theName)
76 DBRep::Set (theName, TopoDS_Shape());
80 const gp_Pnt &aBaryCenter = theBox.Center();
81 const gp_XYZ &aXDir = theBox.XDirection(),
82 &aYDir = theBox.YDirection(),
83 &aZDir = theBox.ZDirection();
84 Standard_Real aHalfX = theBox.XHSize(),
85 aHalfY = theBox.YHSize(),
86 aHalfZ = theBox.ZHSize();
88 gp_Ax2 anAxes(aBaryCenter, aZDir, aXDir);
89 anAxes.SetLocation(aBaryCenter.XYZ() - aHalfX*aXDir - aHalfY*aYDir - aHalfZ*aZDir);
90 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(anAxes, 2.0*aHalfX, 2.0*aHalfY, 2.0*aHalfZ);
91 DBRep::Set(theName, aBox);
94 //=======================================================================
96 //=======================================================================
98 static Standard_Integer addpcurve(Draw_Interpretor& , Standard_Integer n, const char** a)
101 TopoDS_Shape E = DBRep::Get(a[1]);
102 if (E.IsNull()) return 1;
103 Handle(Geom2d_Curve) PC = DrawTrSurf::GetCurve2d(a[2]);
104 TopoDS_Shape F = DBRep::Get(a[3]);
105 Standard_Real tol = 1.e-7;
107 tol = Draw::Atof(a[4]);
110 BB.UpdateEdge(TopoDS::Edge(E), PC, TopoDS::Face(F),tol);
116 //=======================================================================
118 //=======================================================================
120 static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const char** a)
122 if (n <= 1) return 1;
125 Standard_Integer last = n;
126 const char* aName = a[0];
128 Standard_Boolean isBasic = Standard_False;
129 Standard_Boolean isForced = Standard_False;
130 Standard_Boolean isCopy = Standard_False;
132 // Check "copy" flag.
133 if (!strcmp(a[n-1], "-copy")) {
134 isCopy = Standard_True;
138 if (!strcmp(aName,"reset")) {
141 isBasic = (aName[0] == 'b');
142 isForced = (aName[0] == 'f');
146 if (!strcmp(aName,"move")) {
148 TopoDS_Shape SL = DBRep::Get(a[n-1]);
149 if (SL.IsNull()) return 0;
150 T = SL.Location().Transformation();
152 isBasic = Standard_True;
154 else if (!strcmp(aName,"translate")) {
156 T.SetTranslation(gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1])));
159 else if (!strcmp(aName,"rotate")) {
161 T.SetRotation(gp_Ax1(gp_Pnt(Draw::Atof(a[n-7]),Draw::Atof(a[n-6]),Draw::Atof(a[n-5])),
162 gp_Vec(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2]))),
163 Draw::Atof(a[n-1])* (M_PI / 180.0));
166 else if (!strcmp(aName,"mirror")) {
168 T.SetMirror(gp_Ax2(gp_Pnt(Draw::Atof(a[n-6]),Draw::Atof(a[n-5]),Draw::Atof(a[n-4])),
169 gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1]))));
173 else if (!strcmp(aName,"scale")) {
175 T.SetScale(gp_Pnt(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2])),Draw::Atof(a[n-1]));
180 if (T.Form() == gp_Identity || isBasic || isForced) {
181 Standard_Boolean isExeption = Standard_True;
184 isExeption = Standard_False;
186 TopLoc_Location L(T);
187 for (Standard_Integer i = 1; i < last; i++) {
188 TopoDS_Shape S = DBRep::Get(a[i]);
191 Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
198 if (!strcmp(aName, "move") || !strcmp(aName, "reset"))
200 DBRep::Set(a[i], S.Located(L, isExeption));
204 DBRep::Set(a[i], S.Moved(L, isExeption));
207 catch (const Standard_DomainError&)
209 TCollection_AsciiString aScale(T.ScaleFactor());
210 Message::SendWarning() << "Operation is not done: " << aName << " is not a valid transformation - scale = " << aScale;
217 BRepBuilderAPI_Transform trf(T);
218 for (Standard_Integer i = 1; i < last; i++) {
219 TopoDS_Shape S = DBRep::Get(a[i]);
221 Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
225 trf.Perform(S, isCopy);
228 DBRep::Set(a[i],trf.Shape());
235 ///=======================================================================
237 //=======================================================================
239 static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const char** a)
243 di << "Syntax error: wrong number of arguments";
250 // gp_Mat rot(Draw::Atof(a[last-3]),0,0,0,Draw::Atof(a[last-2]),0,0,0,Draw::Atof(a[last-1]));
251 gp_Mat rot(Draw::Atof(a[3]),0,0,0,Draw::Atof(a[4]),0,0,0,Draw::Atof(a[5]));
252 GT.SetVectorialPart(rot);
253 BRepBuilderAPI_GTransform gtrf(GT);
254 BRepBuilderAPI_NurbsConvert nbscv;
255 // Standard_Integer last = n - 3;
256 // for (Standard_Integer i = 1; i < last; i++) {
257 // TopoDS_Shape aShape = DBRep::Get(a[i]);
258 TopoDS_Shape aShape = DBRep::Get(a[2]);
261 di << "Syntax error: '" << a[2] << "' is not a valid shape";
265 gtrf.Perform (aShape);
268 di << "Error: transformation failed";
272 DBRep::Set (a[1], gtrf.Shape());
276 //=======================================================================
278 //=======================================================================
280 static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char** a)
282 Standard_Boolean copyGeom = Standard_True;
283 Standard_Boolean copyMesh = Standard_False;
284 Standard_Integer iFirst = 1; // index of first shape argument
288 for (Standard_Integer i = 1; i <= 2; i++)
294 copyGeom = Standard_False;
297 else if (a[i][1] == 'm')
299 copyMesh = Standard_True;
305 if (n < 3 || (n - iFirst) % 2) {
306 Message::SendFail() << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]\n"
307 << "Option -n forbids copying of geometry (it will be shared)\n"
308 << "Option -m forces copying of mesh (disabled by default)";
312 BRepBuilderAPI_Copy cop;
313 Standard_Integer nbPairs = (n - iFirst) / 2;
314 for (Standard_Integer i=0; i < nbPairs; i++) {
315 cop.Perform(DBRep::Get(a[i+iFirst]), copyGeom, copyMesh);
316 DBRep::Set(a[i+iFirst+1],cop.Shape());
317 di << a[i+iFirst+1] << " ";
323 //=======================================================================
325 //=======================================================================
327 static Standard_Integer nurbsconvert(Draw_Interpretor& di,Standard_Integer n,const char** a)
330 if ((n-1)%2 != 0) return 1;
331 BRepBuilderAPI_NurbsConvert nbscv;
332 for (Standard_Integer i=0; i<(n-1)/2; i++) {
333 TopoDS_Shape S = DBRep::Get(a[2*i+2]);
335 //std::cout << a[2*i+2] << " is not a valid shape" << std::endl;
336 di << a[2*i+2] << " is not a valid shape\n";
341 DBRep::Set(a[2*i+1],nbscv.Shape());
353 //=======================================================================
354 // make a 3D edge curve
355 //=======================================================================
357 static Standard_Integer mkedgecurve (Draw_Interpretor& ,Standard_Integer n,const char** a)
361 Standard_Real Tolerance = Draw::Atof(a[2]) ;
363 TopoDS_Shape S = DBRep::Get(a[1]);
365 if (S.IsNull()) return 1;
367 BRepLib::BuildCurves3d(S,
372 //=======================================================================
374 //=======================================================================
376 static Standard_Integer sameparameter(Draw_Interpretor& di,Standard_Integer n,const char** a)
380 di << "Use sameparameter [result] shape [toler]\n";
381 di << "shape is an initial shape\n";
382 di << "result is a result shape. if skipped = > initial shape will be modified\n";
383 di << "toler is tolerance (default is 1.e-7)";
386 Standard_Real aTol = 1.e-7;
387 Standard_Boolean force = !strcmp(a[0],"fsameparameter");
389 Standard_Real aTol1 = Draw::Atof(a[n-1]);
390 Standard_Boolean IsUseTol = aTol1>0;
394 TopoDS_Shape anInpS = DBRep::Get(IsUseTol ? a[n-2] : a[n-1]);
398 if ((n == 4 && IsUseTol) || (n == 3 && !IsUseTol))
400 TopoDS_Shape aResultSh;
401 BRepTools_ReShape aResh;
402 BRepLib::SameParameter(anInpS,aResh,aTol,force);
403 aResultSh = aResh.Apply(anInpS);
404 DBRep::Set(a[1],aResultSh);
408 BRepLib::SameParameter(anInpS,aTol,force);
409 DBRep::Set(a[1],anInpS);
414 //=======================================================================
415 //function : updatetol
417 //=======================================================================
418 static Standard_Integer updatetol(Draw_Interpretor& di,Standard_Integer n,const char** a)
422 di << "Use updatetololerance [result] shape [param]\n";
423 di << "shape is an initial shape\n";
424 di << "result is a result shape. if skipped = > initial shape will be modified\n";
425 di << "if [param] is absent - not verify of face tolerance, else - perform it";
428 TopoDS_Shape aSh1 = DBRep::Get(a[n-1]);
429 Standard_Boolean IsF = aSh1.IsNull();
431 TopoDS_Shape anInpS = IsF ? DBRep::Get(a[n-2]) : aSh1;
435 if ((n == 4 && IsF) || (n == 3 && !IsF))
437 TopoDS_Shape aResultSh;
438 BRepTools_ReShape aResh;
439 BRepLib::UpdateTolerances(anInpS,aResh, IsF);
440 aResultSh = aResh.Apply(anInpS);
441 DBRep::Set(a[1],aResultSh);
445 BRepLib::UpdateTolerances(anInpS, IsF);
446 DBRep::Set(a[1],anInpS);
452 //=======================================================================
453 //function : OrienSolid
455 //=======================================================================
456 static Standard_Integer orientsolid(Draw_Interpretor& ,Standard_Integer n,const char** a)
460 TopoDS_Shape S = DBRep::Get(a[1]);
461 if (S.IsNull()) return 1;
462 if (S.ShapeType()!=TopAbs_SOLID) return 1;
464 BRepLib::OrientClosedSolid(TopoDS::Solid(S));
471 //=======================================================================
472 //function : getcoords
474 //=======================================================================
475 static Standard_Integer getcoords(Draw_Interpretor& di,Standard_Integer n,const char** a)
480 for (Standard_Integer i = 1; i < n; i++)
482 const TopoDS_Shape aShape = DBRep::Get (a[i]);
487 if (aShape.ShapeType() == TopAbs_VERTEX)
489 const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
490 gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
492 di << a[i] << " (x,y,z) : " << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n";
499 //! Parse 6 real values for defining AABB.
500 static Standard_Boolean parseMinMax (const char** theArgVec, Bnd_Box& theBox)
502 const TCollection_AsciiString aMin[3] = { theArgVec[0], theArgVec[1], theArgVec[2] };
503 const TCollection_AsciiString aMax[3] = { theArgVec[3], theArgVec[4], theArgVec[5] };
504 if (!aMin[0].IsRealValue()
505 || !aMin[1].IsRealValue()
506 || !aMin[2].IsRealValue()
507 || !aMax[0].IsRealValue()
508 || !aMax[1].IsRealValue()
509 || !aMax[2].IsRealValue())
511 return Standard_False;
514 const gp_Pnt aPntMin (aMin[0].RealValue(), aMin[1].RealValue(), aMin[2].RealValue());
515 const gp_Pnt aPntMax (aMax[0].RealValue(), aMax[1].RealValue(), aMax[2].RealValue());
517 theBox.Add (aPntMin);
518 theBox.Add (aPntMax);
519 return Standard_True;
522 //=======================================================================
523 //function : BoundBox
525 //=======================================================================
526 static Standard_Integer BoundBox(Draw_Interpretor& theDI,
527 Standard_Integer theNArg,
528 const char** theArgVal)
530 // 1. Parse arguments
535 Standard_Boolean doPrint = Standard_False;
536 Standard_Boolean doDumpJson = Standard_False;
537 Standard_Boolean useOldSyntax = Standard_False;
538 Standard_Boolean isOBB = Standard_False;
539 Standard_Boolean isTriangulationReq = Standard_True;
540 Standard_Boolean isOptimal = Standard_False;
541 Standard_Boolean isTolerUsed = Standard_False;
542 Standard_Boolean isFinitePart = Standard_False;
543 Standard_Boolean hasToDraw = Standard_True;
545 TCollection_AsciiString anOutVars[6];
546 TCollection_AsciiString aResShapeName;
547 for (Standard_Integer anArgIter = 1; anArgIter < theNArg; ++anArgIter)
549 TCollection_AsciiString anArgCase (theArgVal[anArgIter]);
550 anArgCase.LowerCase();
551 if (anArgCase == "-obb")
553 isOBB = Standard_True;
555 else if (anArgCase == "-aabb")
557 isOBB = Standard_False;
559 else if (anArgCase == "-shape"
560 && anArgIter + 1 < theNArg
561 && aResShapeName.IsEmpty())
563 aResShapeName = theArgVal[++anArgIter];
564 hasToDraw = Standard_False;
566 else if (anArgCase == "-dump"
567 || anArgCase == "-print")
569 doPrint = Standard_True;
571 else if (anArgCase == "-dumpjson")
573 doDumpJson = Standard_True;
575 else if (anArgCase == "-save"
576 && anArgIter + 6 < theNArg
577 && anOutVars[0].IsEmpty())
579 for (int aCompIter = 0; aCompIter < 6; ++aCompIter)
581 anOutVars[aCompIter] = theArgVal[anArgIter + aCompIter + 1];
585 else if (anArgCase == "-notriangulation")
587 isTriangulationReq = Standard_False;
589 else if (anArgCase == "-optimal")
591 isOptimal = Standard_True;
593 else if (anArgCase == "-exttoler")
595 isTolerUsed = Standard_True;
597 else if (anArgCase == "-nodraw")
599 hasToDraw = Standard_False;
601 else if (anArgCase == "-finite"
602 || anArgCase == "-finitepart")
604 isFinitePart = Standard_True;
606 else if (aShape.IsNull()
607 && !DBRep::Get (theArgVal[anArgIter]).IsNull())
609 aShape = DBRep::Get (theArgVal[anArgIter]);
611 else if (anAABB.IsVoid()
612 && anArgIter + 5 < theNArg
613 && parseMinMax (theArgVal + anArgIter, anAABB))
619 Message::SendFail() << "Syntax error at argument '" << theArgVal[anArgIter] << "'";
627 Message::SendFail() << "Syntax error: input is not specified (neither shape nor coordinates)";
630 else if (!anAABB.IsVoid()
631 && (isOBB || isOptimal || isTolerUsed))
633 Message::SendFail() << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB";
637 && !anOutVars[0].IsEmpty())
639 Message::SendFail() << "Error: Option -save works only with axes-aligned boxes";
643 // enable printing (old syntax) if neither saving to shape nor to DRAW variables is requested
644 if (! doPrint && ! doDumpJson && anOutVars[0].IsEmpty() && aResShapeName.IsEmpty())
646 doPrint = Standard_True;
647 useOldSyntax = Standard_True;
650 // 2. Compute box and save results
651 Handle(Draw_Box) aDB;
655 BRepBndLib::AddOBB(aShape, anOBB, isTriangulationReq, isOptimal, isTolerUsed);
659 theDI << "Void box.\n";
663 const gp_Pnt &aBaryCenter= anOBB.Center();
664 const gp_XYZ &aXDir = anOBB.XDirection(),
665 &aYDir = anOBB.YDirection(),
666 &aZDir = anOBB.ZDirection();
667 theDI << "Oriented bounding box\n";
668 theDI << "Center: " << aBaryCenter.X() << " " <<
669 aBaryCenter.Y() << " " <<
670 aBaryCenter.Z() << "\n";
671 theDI << "X-axis: " << aXDir.X() << " " << aXDir.Y() << " " << aXDir.Z() << "\n";
672 theDI << "Y-axis: " << aYDir.X() << " " << aYDir.Y() << " " << aYDir.Z() << "\n";
673 theDI << "Z-axis: " << aZDir.X() << " " << aZDir.Y() << " " << aZDir.Z() << "\n";
674 theDI << "Half X: " << anOBB.XHSize() << "\n"
675 << "Half Y: " << anOBB.YHSize() << "\n"
676 << "Half Z: " << anOBB.ZHSize() << "\n";
681 Standard_SStream aStream;
682 anOBB.DumpJson (aStream);
684 theDI << "Oriented bounding box\n";
685 theDI << Standard_Dump::FormatJson (aStream);
691 aDB = new Draw_Box (anOBB, Draw_orange);
694 if (!aResShapeName.IsEmpty())
696 ConvertBndToShape (anOBB, aResShapeName.ToCString());
701 if (!aShape.IsNull())
706 BRepBndLib::AddOptimal (aShape, anAABB, isTriangulationReq, isTolerUsed);
710 BRepBndLib::Add (aShape, anAABB, isTriangulationReq);
716 theDI << "Void box.\n";
720 if (isFinitePart && anAABB.IsOpen())
722 anAABB = anAABB.FinitePart();
724 const gp_Pnt aMin = anAABB.CornerMin();
725 const gp_Pnt aMax = anAABB.CornerMax();
732 theDI << aMin.X() << " " << aMin.Y() << " " << aMin.Z() << " "
733 << aMax.X() << " " << aMax.Y() << " " << aMax.Z() << "\n";
737 theDI << "Axes-aligned bounding box\n";
738 theDI << "X-range: " << aMin.X() << " " << aMax.X() << "\n"
739 << "Y-range: " << aMin.Y() << " " << aMax.Y() << "\n"
740 << "Z-range: " << aMin.Z() << " " << aMax.Z() << "\n";
742 && anAABB.HasFinitePart())
744 Bnd_Box aFinitAabb = anAABB.FinitePart();
745 const gp_Pnt aFinMin = aFinitAabb.CornerMin();
746 const gp_Pnt aFinMax = aFinitAabb.CornerMax();
747 theDI << "Finite part\n";
748 theDI << "X-range: " << aFinMin.X() << " " << aFinMax.X() << "\n"
749 << "Y-range: " << aFinMin.Y() << " " << aFinMax.Y() << "\n"
750 << "Z-range: " << aFinMin.Z() << " " << aFinMax.Z() << "\n";
757 Standard_SStream aStream;
758 anAABB.DumpJson (aStream);
760 theDI << "Bounding box\n";
761 theDI << Standard_Dump::FormatJson (aStream);
764 // save DRAW variables
765 if (!anOutVars[0].IsEmpty())
767 Draw::Set (anOutVars[0].ToCString(), aMin.X());
768 Draw::Set (anOutVars[1].ToCString(), aMin.Y());
769 Draw::Set (anOutVars[2].ToCString(), aMin.Z());
770 Draw::Set (anOutVars[3].ToCString(), aMax.X());
771 Draw::Set (anOutVars[4].ToCString(), aMax.Y());
772 Draw::Set (anOutVars[5].ToCString(), aMax.Z());
775 // add presentation to DRAW viewer
778 aDB = new Draw_Box (anAABB, Draw_orange);
783 if (!aResShapeName.IsEmpty())
785 ConvertBndToShape (anAABB, aResShapeName.ToCString());
796 //=======================================================================
797 //function : IsBoxesInterfered
799 //=======================================================================
800 static Standard_Integer IsBoxesInterfered(Draw_Interpretor& theDI,
801 Standard_Integer theNArg,
802 const char** theArgVal)
806 theDI << "Use: isbbinterf shape1 shape2 [-o].\n";
810 const TopoDS_Shape aShape1 = DBRep::Get(theArgVal[1]);
811 const TopoDS_Shape aShape2 = DBRep::Get(theArgVal[2]);
813 Standard_Boolean isOBB = (theNArg > 3) && (!strcmp(theArgVal[3], "-o"));
817 Bnd_OBB anOBB1, anOBB2;
818 BRepBndLib::AddOBB(aShape1, anOBB1);
819 BRepBndLib::AddOBB(aShape2, anOBB2);
821 if(anOBB1.IsOut(anOBB2))
823 theDI << "The shapes are NOT interfered by OBB.\n";
827 theDI << "The shapes are interfered by OBB.\n";
832 Bnd_Box anAABB1, anAABB2;
833 BRepBndLib::Add(aShape1, anAABB1);
834 BRepBndLib::Add(aShape2, anAABB2);
836 if(anAABB1.IsOut(anAABB2))
838 theDI << "The shapes are NOT interfered by AABB.\n";
842 theDI << "The shapes are interfered by AABB.\n";
849 //=======================================================================
850 //function : gbounding
852 //=======================================================================
853 #include <GeomAdaptor_Surface.hxx>
854 #include <BndLib_AddSurface.hxx>
855 #include <BndLib_Add3dCurve.hxx>
856 #include <BndLib_Add2dCurve.hxx>
857 #include <Draw_Segment2D.hxx>
858 static Standard_Integer gbounding(Draw_Interpretor& di,Standard_Integer n,const char** a)
860 if (n != 2 && n != 3)
862 di << "Usage: gbounding surf/curve/curve2d [-o] \n";
863 di << "[-o] turn on Optimal mode ('off' by default) \n";
868 Standard_Boolean IsOptimal = Standard_False;
869 if (n == 3 && !strcmp(a[2], "-o"))
870 IsOptimal = Standard_True;
872 Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
876 Standard_Boolean Is3d = Standard_True;
877 Handle(Geom_Curve) C;
878 Handle(Geom_Surface) S;
879 Handle_Geom2d_Curve C2d;
880 S = DrawTrSurf::GetSurface(a[1]);
884 GeomAdaptor_Surface aGAS(S);
886 BndLib_AddSurface::AddOptimal(aGAS, Precision::Confusion(), B);
888 BndLib_AddSurface::Add(aGAS, Precision::Confusion(), B);
892 C = DrawTrSurf::GetCurve(a[1]);
896 GeomAdaptor_Curve aGAC(C);
898 BndLib_Add3dCurve::AddOptimal(aGAC, Precision::Confusion(), B);
900 BndLib_Add3dCurve::Add(aGAC, Precision::Confusion(), B);
904 C2d = DrawTrSurf::GetCurve2d(a[1]);
908 Is3d = Standard_False;
910 BndLib_Add2dCurve::AddOptimal(C2d, C2d->FirstParameter(), C2d->LastParameter(), Precision::Confusion(), B2d);
912 BndLib_Add2dCurve::Add(C2d, C2d->FirstParameter(), C2d->LastParameter(), Precision::Confusion(), B2d);
916 di << "Wrong argument \n";
924 B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
925 DB = new Draw_Box(B, Draw_vert);
927 di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax;
931 B2d.Get(axmin,aymin,axmax,aymax);
932 gp_Pnt2d p1(axmin, aymin);
933 gp_Pnt2d p2(axmax, aymin);
934 gp_Pnt2d p3(axmax, aymax);
935 gp_Pnt2d p4(axmin, aymax);
936 Draw_Segment2D* S1 = new Draw_Segment2D(p1, p2, Draw_vert);
937 Draw_Segment2D* S2 = new Draw_Segment2D(p2, p3, Draw_vert);
938 Draw_Segment2D* S3 = new Draw_Segment2D(p3, p4, Draw_vert);
939 Draw_Segment2D* S4 = new Draw_Segment2D(p4, p1, Draw_vert);
940 dout << S1 << S2 << S3 << S4;
941 di << axmin<<" "<< aymin<<" "<< axmax<<" "<< aymax;
947 //=======================================================================
948 //function : findplane
950 //=======================================================================
951 static Standard_Integer findplane(Draw_Interpretor& di,Standard_Integer n,const char** a)
954 TopoDS_Shape S = DBRep::Get(a[1]);
955 if (S.IsNull()) return 1;
956 Standard_Real tolerance = 1.0e-5 ;
957 BRepBuilderAPI_FindPlane a_plane_finder(S,
959 if (a_plane_finder.Found()) {
960 //std::cout << " a plane is found " ;
961 di << " a plane is found \n";
962 const Handle(Geom_Geometry)& aSurf = a_plane_finder.Plane(); // to avoid ambiguity
963 DrawTrSurf::Set(a[2],aSurf) ;
967 //=======================================================================
968 //function : precision
970 //=======================================================================
972 static Standard_Integer precision(Draw_Interpretor& di,Standard_Integer n,const char** a)
977 //std::cout << " Current Precision = " << BRepBuilderAPI::Precision() << std::endl;
978 di << " Current Precision = " << BRepBuilderAPI::Precision() << "\n";
981 BRepBuilderAPI::Precision(Draw::Atof(a[1]));
987 //=======================================================================
988 //function : reperage shape (Int lin Shape) + pointe double click + maxtol
990 //=======================================================================
991 #include <IntCurvesFace_ShapeIntersector.hxx>
992 #include <gp_Lin.hxx>
994 static Standard_Integer reperageshape(Draw_Interpretor& di, Standard_Integer narg , const char** a)
996 Standard_Integer details=0;
998 if(narg==3) details=1;
999 const char *id1 = a[1];
1000 TopoDS_Shape TheShape1 = DBRep::Get(id1);
1002 //std::cout << "Pick positions with button "<<std::endl;
1003 di << "Pick positions with button \n";
1004 Standard_Integer id,X,Y,b;
1007 dout.Select(id,X,Y,b);
1011 Standard_Real z = dout.Zoom(id);
1012 P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z, 0.0);
1014 P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,-1.0);
1018 gp_Ax1 Axe(P1,gp_Vec(P1,P2));
1019 IntCurvesFace_ShapeIntersector Inter;
1020 Inter.Load(TheShape1,1e-7);
1022 Inter.Perform(Axe,-RealLast(),RealLast());
1024 //std::cout<<"\n --> ";
1027 for(Standard_Integer i=1; i<=Inter.NbPnt(); i++) {
1028 Standard_Integer numface=1;
1029 TopExp_Explorer ExF;
1030 for(ExF.Init(TheShape1,TopAbs_FACE);
1032 ExF.Next(),numface++) {
1033 TopoDS_Face Face=TopoDS::Face(ExF.Current());
1034 if(Face.IsEqual(Inter.Face(i))) {
1035 //std::cout<<" "<<a[1]<<"_"<<numface;
1036 di<<" "<<a[1]<<"_"<<numface;
1040 const gp_Pnt& P = Inter.Pnt(i);
1041 Standard_Real PMin = Inter.WParameter(i);
1043 //std::cout<<" w:"<<PMin<<std::endl;
1044 di<<" w:"<<PMin<< "\n";
1046 if(Inter.Transition(i) == IntCurveSurface_In) {
1047 if(Inter.State(i) == TopAbs_IN) {
1048 Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_rouge,2);
1049 dout << p; dout.Flush();
1051 else if(Inter.State(i) == TopAbs_ON) {
1052 Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_vert,2);
1053 dout << p; dout.Flush();
1057 if(Inter.Transition(i) == IntCurveSurface_Out) {
1058 if(Inter.State(i) == TopAbs_IN) {
1059 Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_rouge,2);
1060 dout << p; dout.Flush();
1062 else if(Inter.State(i) == TopAbs_ON) {
1063 Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_vert,2);
1064 dout << p; dout.Flush();
1070 //std::cout<<std::endl;
1076 static Standard_Integer maxtolerance(Draw_Interpretor& theCommands,
1077 Standard_Integer n, const char** a) {
1079 TopoDS_Shape TheShape = DBRep::Get(a[1]);
1080 if(TheShape.IsNull()) return(1);
1082 Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV;
1083 Standard_Integer nbF,nbE,nbV;
1084 TMF=TME=TMV=-RealLast();
1085 TmF=TmE=TmV=RealLast();
1087 TopTools_MapOfShape mapS;
1090 for(TopExp_Explorer ex(TheShape,TopAbs_FACE);
1093 TopoDS_Face Face=TopoDS::Face(ex.Current());
1094 T=BRep_Tool::Tolerance(Face);
1100 nbF = mapS.Extent();
1103 for(TopExp_Explorer ex(TheShape,TopAbs_EDGE);
1106 TopoDS_Edge Edge=TopoDS::Edge(ex.Current());
1107 T=BRep_Tool::Tolerance(Edge);
1113 nbE = mapS.Extent();
1116 for(TopExp_Explorer ex(TheShape,TopAbs_VERTEX);
1119 TopoDS_Vertex Vertex=TopoDS::Vertex(ex.Current());
1120 T=BRep_Tool::Tolerance(Vertex);
1126 nbV = mapS.Extent();
1128 Standard_SStream sss;
1129 sss << "\n## Tolerances on the shape " << a[1] << " (nbFaces:" << nbF
1130 << " nbEdges:" << nbE << " nbVtx:" << nbV << ")\n" ;
1132 sss.setf(std::ios::scientific);
1133 if(TmF<=TMF) sss << "\n Face : Min " << std::setw(8) << TmF <<" Max " << std::setw(8) << TMF << " \n ";
1134 if(TmE<=TME) sss << "\n Edge : Min " << std::setw(8) << TmE <<" Max " << std::setw(8) << TME << " \n ";
1135 if(TmV<=TMV) sss << "\n Vertex : Min " << std::setw(8) << TmV <<" Max " << std::setw(8) << TMV << " \n ";
1142 static Standard_Integer vecdc(Draw_Interpretor& di,Standard_Integer ,const char** ) {
1143 //std::cout << "Pick positions with button "<<std::endl;
1144 di << "Pick positions with button \n";
1146 Standard_Integer id,X,Y,b;
1148 gp_Pnt P1,P2,PP1,PP2;
1150 //-----------------------------------------------------------
1151 dout.Select(id,X,Y,b); dout.GetTrsf(id,T);
1153 Standard_Real z = dout.Zoom(id);
1154 P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
1157 dout.Select(id,X,Y,b); dout.GetTrsf(id,T);
1158 T.Invert(); z = dout.Zoom(id);
1160 P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
1162 Standard_Real xa,ya,za;
1163 if(Abs(P1.X())>Abs(P2.X())) xa = P1.X(); else xa = P2.X();
1164 if(Abs(P1.Y())>Abs(P2.Y())) ya = P1.Y(); else ya = P2.Y();
1165 if(Abs(P1.Z())>Abs(P2.Z())) za = P1.Z(); else za = P2.Z();
1166 P1.SetCoord(xa,ya,za);
1167 Handle(Draw_Marker3D) D0 = new Draw_Marker3D(gp_Pnt(P1.X(),
1170 Draw_Square,Draw_blanc,1);
1174 //-----------------------------------------------------------
1175 dout.Select(id,X,Y,b);
1179 PP1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
1181 dout.Select(id,X,Y,b);
1185 PP2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
1187 if(Abs(PP1.X())>Abs(PP2.X())) xa = PP1.X(); else xa = PP2.X();
1188 if(Abs(PP1.Y())>Abs(PP2.Y())) ya = PP1.Y(); else ya = PP2.Y();
1189 if(Abs(PP1.Z())>Abs(PP2.Z())) za = PP1.Z(); else za = PP2.Z();
1190 PP1.SetCoord(xa,ya,za);
1191 Handle(Draw_Segment3D) d = new Draw_Segment3D(P1,PP1,Draw_blanc);
1194 //std::cout<<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<<std::endl;
1195 di <<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<< "\n";
1197 static Standard_Integer nboxvecdp=0;
1198 //std::cout<<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z());
1199 //std::cout<<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<<std::endl;
1201 //std::cout<<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X())
1202 // +(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y())
1203 // +(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<<std::endl;
1205 di <<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z());
1206 di <<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<< "\n";
1208 di <<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X())
1209 +(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y())
1210 +(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<< "\n";
1213 //=======================================================================
1215 //=======================================================================
1217 #include <TopTools_SequenceOfShape.hxx>
1218 static Standard_Integer nproject(Draw_Interpretor& di, Standard_Integer n, const char** a)
1220 if ( n < 4) return 1;
1221 TopoDS_Shape InpShape;
1222 Standard_Integer arg = 2, i;
1223 TopTools_SequenceOfShape Args;
1225 Standard_Real Tol = 1.e-4;
1226 Standard_Real Tol2d;
1227 Standard_Real MaxDistance = 1.e-3;
1228 GeomAbs_Shape Continuity = GeomAbs_C2;
1229 Standard_Integer MaxDeg = 14;
1230 Standard_Integer MaxSeg = 16;
1232 while((n > arg) && !(InpShape = DBRep::Get(a[arg])).IsNull()){
1233 Args.Append(InpShape);
1236 if(Args.Length() < 2) return 1;
1238 BRepOffsetAPI_NormalProjection OrtProj(Args.Last());
1240 for(i = 1; i < Args.Length(); i++)
1241 OrtProj.Add(Args(i));
1244 if (!strcmp(a[arg],"-g")) {
1245 OrtProj.SetLimit(Standard_False);
1250 if (!strcmp(a[arg],"-d")) {
1253 MaxDistance = Draw::Atof(a[arg++]);
1254 OrtProj.SetMaxDistance(MaxDistance);
1257 Tol = Max(Draw::Atof(a[arg++]),1.e-10);
1261 if (Draw::Atoi(a[arg]) == 0) Continuity = GeomAbs_C0;
1262 else if (Draw::Atoi(a[arg]) == 1) Continuity = GeomAbs_C1;
1268 MaxDeg = Draw::Atoi(a[arg++]);
1269 if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14;
1272 if(n > arg) MaxSeg = Draw::Atoi(a[arg]);
1274 Tol2d = Pow(Tol, 2./3);
1276 OrtProj.SetParams(Tol, Tol2d, Continuity, MaxDeg, MaxSeg);
1278 TopTools_ListOfShape Wire;
1279 Standard_Boolean IsWire=OrtProj.BuildWire(Wire);
1281 //std::cout << " BuildWire OK " << std::endl;
1282 di << " BuildWire OK \n";
1284 DBRep::Set(a[1], OrtProj.Shape());
1288 //==========================================================================
1290 // exploration of a wire
1291 //==========================================================================
1292 static Standard_Integer wexplo (Draw_Interpretor&,
1293 Standard_Integer argc, const char** argv)
1296 if (argc < 2) return 1;
1298 TopoDS_Shape C1 = DBRep::Get (argv[1],TopAbs_WIRE);
1301 if (argc > 2) C2 = DBRep::Get (argv[2],TopAbs_FACE);
1303 if (C1.IsNull()) return 1;
1305 BRepTools_WireExplorer we;
1306 if (C2.IsNull()) we.Init(TopoDS::Wire(C1));
1307 else we.Init(TopoDS::Wire(C1),TopoDS::Face(C2));
1309 Standard_Integer k = 1;
1311 TopoDS_Edge E = we.Current();
1312 Sprintf(name,"WEDGE_%d",k);
1321 static Standard_Integer scalexyz(Draw_Interpretor& /*di*/, Standard_Integer n, const char** a)
1323 if (n < 6) return 1;
1325 TopoDS_Shape aShapeBase = DBRep::Get(a[2]);
1326 if (aShapeBase.IsNull()) return 1;
1328 Standard_Real aFactorX = Draw::Atof(a[3]);
1329 Standard_Real aFactorY = Draw::Atof(a[4]);
1330 Standard_Real aFactorZ = Draw::Atof(a[5]);
1333 gp_Mat rot (aFactorX, 0, 0,
1336 aGTrsf.SetVectorialPart(rot);
1337 BRepBuilderAPI_GTransform aBRepGTrsf (aShapeBase, aGTrsf, Standard_False);
1338 if (!aBRepGTrsf.IsDone())
1339 throw Standard_ConstructionError("Scaling not done");
1340 TopoDS_Shape Result = aBRepGTrsf.Shape();
1342 DBRep::Set(a[1], Result);
1346 //=======================================================================
1347 //function : compareshapes
1349 //=======================================================================
1350 static Standard_Integer compareshapes(Draw_Interpretor& di,
1355 di << "Compare shapes. Usage: compare shape1 shape2\n";
1359 TopoDS_Shape aS1 = DBRep::Get(a[1]);
1360 TopoDS_Shape aS2 = DBRep::Get(a[2]);
1362 if (aS1.IsSame(aS2)) {
1363 di << "same shapes\n";
1364 if (aS1.IsEqual(aS2)) {
1365 di << "equal shapes\n";
1369 di << "shapes are not same\n";
1374 //=======================================================================
1375 //function : issubshape
1377 //=======================================================================
1378 static Standard_Integer issubshape(Draw_Interpretor& di,
1383 di << "Check if the shape is sub-shape of other shape and get its index in the shape.\n";
1384 di << "Usage: issubshape subshape shape\n";
1388 TopoDS_Shape aSubShape = DBRep::Get(a[1]);
1389 TopoDS_Shape aShape = DBRep::Get(a[2]);
1391 if (aSubShape.IsNull() || aShape.IsNull()) {
1392 di << "null shapes\n";
1395 // find index of the sub-shape in the shape
1396 TopTools_MapOfShape aMShapes;
1397 // try to find the SubShape in Shape
1398 TopExp_Explorer anExp(aShape, aSubShape.ShapeType());
1399 for (; anExp.More(); anExp.Next()) {
1400 const TopoDS_Shape& aSS = anExp.Current();
1401 if (aMShapes.Add(aSS)) {
1402 if (aSS.IsSame(aSubShape)) {
1409 di << a[1] << " is sub-shape of " << a[2] << ". Index in the shape: " << aMShapes.Extent() << ".\n";
1412 di << a[1] << " is NOT sub-shape of " << a[2] << ".\n";
1417 //=======================================================================
1418 //function : purgeloc
1420 //=======================================================================
1421 static Standard_Integer purgeloc(Draw_Interpretor& di, Standard_Integer /*n*/, const char** a)
1424 TopoDS_Shape aShapeBase = DBRep::Get(a[2]);
1425 if (aShapeBase.IsNull()) return 1;
1428 BRepTools_PurgeLocations aRemLoc;
1429 Standard_Boolean isDone = aRemLoc.Perform(aShapeBase);
1430 TopoDS_Shape Result = aRemLoc.GetResult();
1432 DBRep::Set(a[1], Result);
1435 di << "All problematic locations are purged \n";
1439 di << "Not all problematic locations are purged \n";
1443 //=======================================================================
1444 //function : checkloc
1446 //=======================================================================
1448 static Standard_Integer checkloc(Draw_Interpretor& di, Standard_Integer /*n*/, const char** a)
1451 TopoDS_Shape aShapeBase = DBRep::Get(a[1]);
1452 if (aShapeBase.IsNull()) return 1;
1454 TopTools_ListOfShape aLS;
1455 BRepTools::CheckLocations(aShapeBase, aLS);
1458 di << "There are no problematic shapes" << "\n";
1461 TopTools_ListIteratorOfListOfShape anIt(aLS);
1463 for (i = 1; anIt.More(); anIt.Next(), ++i)
1465 TCollection_AsciiString aName(a[1]);
1468 DBRep::Set(aName.ToCString(), anIt.Value());
1475 void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
1477 static Standard_Boolean done = Standard_False;
1479 done = Standard_True;
1481 DBRep::BasicCommands(theCommands);
1483 const char* g = "TOPOLOGY Basic shape commands";
1485 theCommands.Add("addpcurve",
1486 "addpcurve edge 2dcurve face [tol (default 1.e-7)]",
1490 theCommands.Add("reset",
1491 "reset name1 name2 ..., remove location",
1495 theCommands.Add("tmove",
1496 "tmove name1 name2 ... name, set location from name [-copy]",
1500 theCommands.Add("ttranslate",
1501 "ttranslate name1 name2 ... dx dy dz [-copy]",
1505 theCommands.Add("trotate",
1506 "trotate name1 name2 ... x y z dx dy dz angle [-copy]",
1510 theCommands.Add("tmirror",
1511 "tmirror name x y z dx dy dz [-copy]",
1515 theCommands.Add("tscale",
1516 "tscale name x y z scale [-copy]",
1520 theCommands.Add("tcopy",
1521 "tcopy [-n(ogeom)] [-m(esh)] name1 result1 [name2 result2 ...]",
1525 theCommands.Add("bmove",
1526 "bmove name1 name2 ... name, set location from name",
1530 theCommands.Add("fmove",
1531 "fmove name1 name2 ... name, set location from name",
1535 theCommands.Add("btranslate",
1536 "btranslate name1 name2 ... dx dy dz",
1540 theCommands.Add("brotate",
1541 "brotate name1 name2 ... x y z dx dy dz angle",
1545 theCommands.Add("bmirror",
1546 "bmirror name x y z dx dy dz",
1550 theCommands.Add("fmirror",
1551 "fmirror name x y z dx dy dz",
1555 theCommands.Add("bscale",
1556 "bscale name x y z scale",
1560 theCommands.Add("fscale",
1561 "fscale name x y z scale",
1565 theCommands.Add("precision",
1566 "precision [preci]",
1570 theCommands.Add("mkedgecurve",
1571 "mkedgecurve name tolerance",
1575 theCommands.Add("fsameparameter",
1576 "fsameparameter shapename [tol (default 1.e-7)], \nforce sameparameter on all edges of the shape",
1580 theCommands.Add("sameparameter",
1581 "sameparameter [result] shape [tol]",
1585 theCommands.Add("updatetolerance",
1586 "updatetolerance [result] shape [param] \n if [param] is absent - not verify of face tolerance, else - perform it",
1590 theCommands.Add("solidorientation",
1591 "orientsolid myClosedSolid",
1595 theCommands.Add("getcoords",
1596 "getcoords vertex1 vertex 2... ; shows coords of input vertices",
1600 theCommands.Add ("bounding",
1601 "bounding {shape | xmin ymin zmin xmax ymax zmax}"
1602 "\n\t\t: [-obb] [-noTriangulation] [-optimal] [-extToler]"
1603 "\n\t\t: [-dump] [-print] [-dumpJson] [-shape name] [-nodraw] [-finitePart]"
1604 "\n\t\t: [-save xmin ymin zmin xmax ymax zmax]"
1606 "\n\t\t: Computes a bounding box. Two types of the source data are supported:"
1607 "\n\t\t: a shape or AABB corners (xmin, ymin, zmin, xmax, ymax, zmax)."
1609 "\n\t\t: Calculation options (applicable only if input is a shape):"
1610 "\n\t\t: -obb Compute Oriented Bounding Box (OBB) instead of AABB."
1611 "\n\t\t: -noTriangulation Force use of exact geometry for calculation"
1612 "\n\t\t: even if triangulation is present."
1613 "\n\t\t: -optimal Force calculation of optimal (more tight) AABB."
1614 "\n\t\t: In case of OBB:"
1615 "\n\t\t: - for PCA approach applies to initial AABB used in OBB calculation"
1616 "\n\t\t: - for DiTo approach modifies the DiTo algorithm to check more axes."
1617 "\n\t\t: -extToler Include tolerance of the shape in the resulting box."
1619 "\n\t\t: Output options:"
1620 "\n\t\t: -dump Prints the information about computed Bounding Box."
1621 "\n\t\t: -print Prints the information about computed Bounding Box."
1622 "\n\t\t: It is enabled by default (with plain old syntax for AABB)"
1623 "\n\t\t: if neither -shape nor -save is specified."
1624 "\n\t\t: -dumpJson Prints DumpJson information about Bounding Box."
1625 "\n\t\t: -shape Stores computed box as solid in DRAW variable with specified name."
1626 "\n\t\t: -save Stores min and max coordinates of AABB in specified variables."
1627 "\n\t\t: -noDraw Avoid drawing resulting Bounding Box in DRAW viewer."
1628 "\n\t\t: -finite Return finite part of infinite box.",
1629 __FILE__, BoundBox, g);
1632 theCommands.Add("gbounding",
1633 "gbounding surf/curve/curve2d [-o] ",
1637 theCommands.Add("isbbinterf", "isbbinterf shape1 shape2 [-o]\n"
1638 "Checks whether the bounding-boxes created from "
1639 "the given shapes are interfered. If \"-o\"-option "
1640 "is switched on then the oriented boxes will be checked. "
1641 "Otherwise, axes-aligned boxes will be checked.",
1642 __FILE__, IsBoxesInterfered, g);
1644 theCommands.Add("nurbsconvert",
1645 "nurbsconvert result name [result name]",
1649 theCommands.Add("deform",
1650 "deform newname name CoeffX CoeffY CoeffZ",
1654 theCommands.Add("findplane",
1655 "findplane name planename ",
1659 theCommands.Add("maxtolerance",
1660 "maxtolerance shape ",
1664 theCommands.Add("reperageshape",
1665 "reperage shape -> list of shape (result of interstion shape , line)",
1669 theCommands.Add("vecdc",
1670 "vecdc + Pointe double click ",
1674 theCommands.Add("nproject","nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol [continuity [maxdeg [maxseg]]]",
1678 theCommands.Add("wexplo","wexplo wire [face] create WEDGE_i",
1682 theCommands.Add("scalexyz",
1683 "scalexyz res shape factor_x factor_y factor_z",
1687 theCommands.Add("compare",
1688 "Compare shapes. Usage: compare shape1 shape2",
1692 theCommands.Add("issubshape",
1693 "issubshape subshape shape\n"
1694 "\t\tCheck if the shape is sub-shape of other shape and get its index in the shape.",
1697 theCommands.Add("purgeloc",
1698 "purgeloc res shape ",
1702 theCommands.Add("checkloc",