1 // Created on: 2002-03-20
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
26 #include <Draw_Interpretor.hxx>
28 #include <DrawTrSurf.hxx>
29 #include <AIS_InteractiveContext.hxx>
30 #include <ViewerTest.hxx>
31 #include <AIS_Shape.hxx>
32 #include <TopoDS_Shape.hxx>
34 #include <Geom_Axis2Placement.hxx>
36 #include <gp_Trsf.hxx>
37 #include <AIS_Trihedron.hxx>
38 #include <BRepPrimAPI_MakeBox.hxx>
39 #include <Graphic3d_MaterialAspect.hxx>
40 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
41 #include <TopoDS_Solid.hxx>
42 #include <BRepPrimAPI_MakeSphere.hxx>
43 #include <BRepPrimAPI_MakeCone.hxx>
44 #include <BRepPrimAPI_MakeCylinder.hxx>
45 #include <IGESToBRep_Reader.hxx>
46 #include <TopExp_Explorer.hxx>
48 #include <GCPnts_UniformDeflection.hxx>
49 #include <BRepAdaptor_Curve.hxx>
50 #include <IGESToBRep.hxx>
51 #include <V3d_Viewer.hxx>
52 #include <BRepAdaptor_CompCurve.hxx>
53 #include <GCPnts_AbscissaPoint.hxx>
54 #include <Standard_ErrorHandler.hxx>
55 #include <Standard_Overflow.hxx>
56 #include <Standard_Underflow.hxx>
57 #include <Standard_DivideByZero.hxx>
58 #include <OSD_SIGSEGV.hxx>
59 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
60 #include <OSD_Exception_STACK_OVERFLOW.hxx>
62 #include <STEPCAFControl_Writer.hxx>
63 #include <STEPControl_StepModelType.hxx>
64 #include <Interface_Static.hxx>
65 #include <IFSelect_ReturnStatus.hxx>
66 #include <Standard_Failure.hxx>
67 #include <TColgp_HArray1OfPnt2d.hxx>
68 #include <Geom2dAPI_Interpolate.hxx>
69 #include <Geom2d_BSplineCurve.hxx>
70 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
71 #include <Geom2d_BezierCurve.hxx>
72 #include <BRep_Tool.hxx>
73 #include <GeomProjLib.hxx>
74 #include <Geom2dAPI_InterCurveCurve.hxx>
75 #include <IntRes2d_IntersectionSegment.hxx>
76 #include <TDataStd_RealArray.hxx>
77 #include <TDF_CopyLabel.hxx>
78 #include <NCollection_Vector.hxx>
79 #include <TColStd_Array1OfInteger.hxx>
80 #include <Geom_BSplineCurve.hxx>
81 #include <TColgp_Array1OfPnt.hxx>
82 #include <AIS_ListOfInteractive.hxx>
83 #include <AIS_ListIteratorOfListOfInteractive.hxx>
84 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
85 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
86 #include <BRepBuilderAPI_MakePolygon.hxx>
87 #include <gp_GTrsf.hxx>
88 #include <Poly_Triangulation.hxx>
89 #include <IGESControl_Reader.hxx>
90 #include <IGESData_IGESModel.hxx>
91 #include <IGESData_IGESEntity.hxx>
92 #include <V3d_View.hxx>
93 #include <BRepFeat_SplitShape.hxx>
94 #include <BRepAlgoAPI_Section.hxx>
99 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
101 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
104 static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
106 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
107 if(myAISContext.IsNull()) {
108 di << "use 'vinit' command before " << argv[0] ;
112 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
115 trsf1.SetTranslation(gp_Vec(100, 100, 0));
116 aTrihedronAxis->Transform(trsf1);
117 Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
118 myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
119 myTrihedron->SetSize(100);
120 myAISContext->Display(myTrihedron, Standard_True);
122 // TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
123 TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
124 Handle(AIS_Shape) AS = new AIS_Shape(shape1);
125 AS->SetDisplayMode(1);
126 Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
127 AS->SetMaterial(mat);
128 AS->SetColor(Quantity_NOC_RED);
129 myAISContext->Display(AS);
132 TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
134 myAISContext->ResetLocation(AS);
135 myAISContext->SetLocation(AS , TouchTrsf) ;
136 myAISContext->Redisplay(AS, Standard_True);
141 // Remove as bad version of QAAddOrRemoveSelected from QADraw
142 //static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
145 // di<<"Usage : " << argv[0] << " shape islocal\n";
149 // Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
151 // // ViewerTest_DoubleMapOfInteractiveAndName& aMap =
152 // // ViewerTest::GetDataMapOfAIS ();
153 // ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
155 // TCollection_AsciiString aName(argv[1]);
156 // Handle(AIS_InteractiveObject) AISObj;
158 // if(aMap.IsBound2(aName)) {
159 // AISObj = aMap.Find2(aName);
160 // if(AISObj.IsNull()){
161 // di<<"No interactive object \n";
165 // Standard_Integer aNum = -1;
167 // if(atoi(argv[2])) {
168 // aNum = anAISCtx->OpenLocalContext();
171 // if(anAISCtx->HasOpenedContext()){
172 // anAISCtx->InitSelected();
173 // anAISCtx->AddOrRemoveSelected(AISObj);
176 // anAISCtx->InitCurrent();
177 // anAISCtx->AddOrRemoveCurrentObject(AISObj);
181 // // anAISCtx->CloseLocalContext(aNum);
186 // //select this shape:
188 // di<<"Use 'vdisplay' before";
193 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
196 di<<"Usage: OCC136\n";
200 //create some primitives:
202 Standard_Real Size=100;
203 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
205 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
207 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
209 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
210 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
212 anAx2.SetLocation(gp_Pnt(Size,0,0));
213 anAx2.SetDirection(gp_Dir(-1,-1,1));
214 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
216 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
217 if(anAISCtx.IsNull()){
218 di<<"Null interactive context. Use 'vinit' at first.\n";
222 if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
223 anAISCtx->EraseAll();
225 //load primitives to context
226 Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
227 anAISCtx->Display(aSh1);
229 Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
230 anAISCtx->Display(aSh2);
232 Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
233 anAISCtx->Display(aSh3);
235 Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
236 anAISCtx->Display(aSh4);
239 anAISCtx->InitCurrent();
240 anAISCtx->AddOrRemoveCurrentObject(aSh1);
241 anAISCtx->AddOrRemoveCurrentObject(aSh2);
242 anAISCtx->AddOrRemoveCurrentObject(aSh3);
243 anAISCtx->AddOrRemoveCurrentObject(aSh4);
245 //remove all this objects from context
246 anAISCtx->Clear(aSh1, Standard_False);
247 anAISCtx->Clear(aSh2, Standard_False);
248 anAISCtx->Clear(aSh3, Standard_False);
249 anAISCtx->Clear(aSh4, Standard_False);
253 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
255 printf("Usage: %s iges_input [name]\n",argv[0]);
258 Standard_Character *Ch;
261 Ch = new Standard_Character[strlen(argv[2])+3];
263 IGESToBRep_Reader IR;
264 IR.LoadFile (argv[1]);
267 TopoDS_Shape aTopShape = IR.OneShape();
268 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
269 Standard_Integer i=0;
270 for( ; ex.More(); ex.Next()){
271 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
272 BRepAdaptor_Curve aCurve(E);
273 GCPnts_UniformDeflection plin(aCurve, 0.1);
274 di << "Num points = " << plin.NbPoints() << "\n";
277 sprintf(Ch,"%s_%i",argv[2],1);
284 static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
288 di << "Usage : " << a[0] << " file.igs" << "\n";
292 Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
294 if(myContext.IsNull()) {
295 di << "use 'vinit' command before " << a[0] << "\n";
300 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
301 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
303 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
306 Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
307 sprintf(file1,"%s/%s",DD,a[1]);
309 IGESToBRep_Reader reader;
310 Standard_Integer status = reader.LoadFile(file1);
313 reader.TransferRoots();
314 TopoDS_Shape shape = reader.OneShape();
316 Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
318 Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
320 if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
321 importedShape->SetDisplayMode(AIS_WireFrame);
322 else importedShape->SetDisplayMode(AIS_Shaded);
323 myContext->Display(importedShape);
326 printf("\n End of my IGES to 3D-viewer *****************>\n");
331 //====================================================
333 // Following code is inserted from
334 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
335 // ( 75455 Apr 16 18:59)
337 //====================================================
340 #include <BRepTools_WireExplorer.hxx>
341 #include <BRep_Tool.hxx>
342 #include <GCPnts_UniformAbscissa.hxx>
343 #include <TopExp.hxx>
346 // usage : OCC105 shape
349 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
351 //Value Pnt = -338.556216693211 -394.465571897208 0
353 //Value Pnt = -307.47165394 -340.18073533 0
355 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
358 di<<"Usage : OCC105 shape\n";
361 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
362 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
363 Standard_Real l = 0.5; //atof(argv[2]);
364 // Find the first vertex of the wire
365 BRepTools_WireExplorer wire_exp(myTopoDSWire);
368 TopoDS_Vertex vw1, vw2;
369 TopExp::Vertices(myTopoDSWire,vw1,vw2);
370 TopoDS_Vertex ve1, ve2;
371 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
372 TopExp::Vertices(edge,ve1,ve2);
373 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
376 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
380 for ( ; wire_exp.More(); wire_exp.Next())
382 di << "\n\n New Edge \n" << "\n";
383 Standard_Real newufirst, newulast;
384 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
385 Standard_Real ufirst, ulast;
386 Handle(Geom_Curve) acurve;
387 TopoDS_Vertex ve1, ve2;
388 TopExp::Vertices(edge,ve1,ve2);
389 if (ve1.IsSame(vlast))
391 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
398 // assert(ve2.IsSame(vlast));
399 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
400 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
401 newufirst = acurve->ReversedParameter( ufirst );
402 newulast = acurve->ReversedParameter( ulast );
403 acurve = acurve->Reversed( );
407 GeomAdaptor_Curve curve;
408 GCPnts_UniformAbscissa algo;
410 algo.Initialize( curve, l, newufirst, newulast );
412 di << "Not Done!!!" << "\n";
413 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
414 Standard_Real t = algo.Parameter(Index);
415 gp_Pnt pt3 = curve.Value(t);
416 di << "Parameter t = " << t << "\n";
417 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
424 #include <TColStd_SequenceOfTransient.hxx>
425 #include <GeomFill_Pipe.hxx>
426 static int pipe_OCC9 (Draw_Interpretor& di,
427 Standard_Integer n, const char ** a)
430 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
434 TColStd_SequenceOfTransient aCurveSeq;
436 for (i=2 ; i<=4; i++) {
437 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
439 di << a[i] << " is not a curve" << "\n";
442 aCurveSeq.Append(aC);
445 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
446 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
447 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
451 aPipe.Perform(atof (a[6]), Standard_True);
453 aPipe.Perform(Standard_True/*, Standard_True*/);
456 Handle(Geom_Surface) aSurf = aPipe.Surface();
458 DrawTrSurf::Set(a[1], aSurf);
462 //======================================================================
464 // usage : OCC125 shell
465 //======================================================================
466 #include <ShapeFix_Shell.hxx>
468 Standard_Integer OCC125(Draw_Interpretor& di ,
473 di<<" Use OCC125 shell";
477 TopoDS_Shape S = DBRep::Get(a[1]);
480 di<<" Null shape is not allowed";
486 if (aT!=TopAbs_SHELL) {
487 di<<" Shape Type must be SHELL";
491 const TopoDS_Shell& aShell = TopoDS::Shell(S);
493 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
495 isAccountMultiConex=Standard_True;
496 bNonManifold=Standard_False;
498 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
499 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
501 di<<"bResult="<<(Standard_Integer)bResult;
504 aShape=aFix->Shape();
506 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
509 DBRep::Set (aRName.ToCString(), aShape);
510 di<<aRName.ToCString();
515 #include <BRepLib_FindSurface.hxx>
516 #include <BRepBuilderAPI_MakeFace.hxx>
517 Standard_Integer OCC157(Draw_Interpretor& di,
520 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
523 di << "bad number of arguments" <<"\n";
527 // try to read a shape:
528 TopoDS_Shape inputShape=DBRep::Get(a[2]);
529 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
530 di << "Invalid input shape"<< "\n";
533 Standard_Real toler = atof(a[3]);
534 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
535 BRepLib_FindSurface FS(aWire, toler, Standard_True);
537 di<<"OCC157: OK; Planar surface is found"<<"\n";
538 Handle(Geom_Surface) aSurf = FS.Surface();
539 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
540 if(aMakeFace.IsDone()) {
541 TopoDS_Face aFace = aMakeFace.Face();
542 DBRep::Set(a[1],aFace);
545 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
550 // #include <MyCommandsCMD.h>
551 #include <ShapeFix_Shape.hxx>
552 #include <BRepOffset_MakeOffset.hxx>
553 #include <BRepOffsetAPI_MakeOffset.hxx>
554 #include <BRepOffset_Mode.hxx>
555 #include <GeomAbs_JoinType.hxx>
556 #include <AIS_Shape.hxx>
558 #include <BRepTools.hxx>
560 Standard_Integer OCC165(Draw_Interpretor& di ,
565 //=======================================================================
567 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
569 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
571 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
574 //=======================================================================
576 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
580 di <<"Usage : " << a[0] << " [file]"<<"\n";
585 #define _OFFSET_TELCO_
586 #ifdef _OFFSET_TELCO_
588 Standard_CString file = a[1];
590 BRep_Builder aBuilder;
591 TopoDS_Shape theShape;
592 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
593 BRepTools::Read(theShape, file, aBuilder);
594 DBRep::Set("shape", theShape);
596 TopoDS_Wire theWire = TopoDS::Wire(theShape);
598 Standard_Real anOffset = 1.5;
602 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
603 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
604 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
606 BRepBuilderAPI_MakePolygon theSquare;
607 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
609 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
611 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
613 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
617 TopoDS_Wire theWire = theSquare.Wire();
619 Standard_Real anOffset = 10;
622 #endif /* _OFFSET_TELCO_ */
625 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
626 DBRep::Set("face", theFace);
629 Standard_Real anAlt = 0.;
630 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
631 //GeomAbs_Intersection; //GeomAbs_Arc;
632 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
633 aMakeOffset.AddWire(theWire);
635 aMakeOffset.Perform(anOffset, anAlt);
637 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
638 DBRep::Set("offset", theOffsetShapePos);
643 #include<BRepAlgoAPI_Cut.hxx>
644 #include<BRepAlgo_Cut.hxx>
646 #include<BRepPrimAPI_MakeHalfSpace.hxx>
647 #include<Handle_Geom_CartesianPoint.hxx>
648 #include<Geom_CartesianPoint.hxx>
649 #include<AIS_Point.hxx>
651 #include <BRepBuilderAPI_MakeEdge.hxx>
652 #include <BRepBuilderAPI_MakeWire.hxx>
653 #include <BRepBuilderAPI_MakeFace.hxx>
655 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
659 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
660 if(myAISContext.IsNull()) {
661 di << "use 'vinit' command before " << argv[0] << "\n";
666 gp_Pnt pt1_(250.,250.,0.);
667 gp_Pnt pt2_(-250.,250.,0.);
668 gp_Pnt pt3_(-250.,-250.,0.);
669 gp_Pnt pt4_(250.,-250.,0.);
670 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
671 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
672 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
673 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
675 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
676 BRepBuilderAPI_MakeFace face_(wire_);
677 TopoDS_Face sh_ = face_.Face();
683 g_pnt = gp_Pnt(0,0,-100);
685 g_pnt = gp_Pnt(0,0,100);
687 myAISContext->EraseAll(Standard_False);
688 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
689 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
690 myAISContext->Display(AISPoint);
692 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
693 TopoDS_Solid sol1_ = half_.Solid();
694 // Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
695 // AISHalf->SetColor(Quantity_NOC_GREEN);
696 // myAISContext->Display(AISHalf);
698 DBRep::Set("Face",sol1_);
700 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
702 Standard_Real x=0., y=0., z=-80.;
704 BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
705 // Handle(AIS_Shape) AISBox = new AIS_Shape(box);
706 // AISBox->SetColor(Quantity_NOC_BLUE1);
707 // myAISContext->Display(AISBox);
709 DBRep::Set("Box",box.Shape());
711 // BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
712 // //BRepAlgoAPI_Cut cut( box.Shape(), sol1_ );
713 // TopoDS_Shape sh1_ = cut.Shape();
714 // Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
715 // AISCut->SetColor(Quantity_NOC_RED);
716 // myAISContext->Display(AISCut);
718 // DBRep::Set("Cut",sh1_);
723 #include<GProp_GProps.hxx>
724 #include<BRepGProp.hxx>
726 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
731 di <<"Usage : " << argv[0] << " file"<<"\n";
734 Standard_CString file = argv[1];
736 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
737 if(myAISContext.IsNull()) {
738 di << "use 'vinit' command before " << argv[0] << "\n";
743 BRep_Builder builder;
744 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
745 BRepTools::Read(sh, file, builder);
748 builder.MakeWire(wire);
750 TopoDS_Vertex vt1, vt2;
751 TopExp_Explorer wex(sh, TopAbs_EDGE);
752 for(;wex.More();wex.Next())
754 ed = TopoDS::Edge(wex.Current());
755 TopExp::Vertices(ed, vt1, vt2);
756 builder.UpdateVertex(vt1, 0.01);
757 builder.UpdateVertex(vt2, 0.01);
758 builder.UpdateEdge(ed, 0.01);
759 builder.Add(wire, ed);
763 BRepGProp::LinearProperties(ed, lprop);
764 printf("\n length = %f", lprop.Mass());
766 DBRep::Set("Wire",wire);
767 // Handle(AIS_Shape) res = new AIS_Shape( wire );
768 // aContext->SetColor( res, Quantity_NOC_RED );
769 // aContext->Display( res );
771 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
772 // off.Perform(0.5, 0);
774 // printf("\n IsDone = %d", off.IsDone());
776 // res = new AIS_Shape( sh );
777 // aContext->SetColor( res, Quantity_NOC_GREEN );
778 // aContext->Display( res );
784 static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
787 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
788 if(myAISContext.IsNull()) {
789 di << "use 'vinit' command before " << argv[0];
793 BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
794 Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
795 myAISContext->Display(anAISBox, 1);
796 anAISBox->SetSelectionMode(-1);
797 Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
798 myAISContext->CloseLocalContext(myLocContInd);
799 Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
806 #include <TDocStd_Document.hxx>
807 #include <DDocStd.hxx>
808 #include <PCDM_StoreStatus.hxx>
809 #include <TDocStd_Application.hxx>
811 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
814 di << "Usage: " << a[0] << " Doc" << "\n";
818 Handle(TDocStd_Document) D;
819 if (!DDocStd::GetDocument(a[1],D)) return 1;
821 Handle(TDocStd_Application) A;
822 if (!DDocStd::Find(A)) return 1;
824 TCollection_ExtendedString theStatusMessage;
826 di << "this document has never been saved" << "\n";
829 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
830 if (theStatus != PCDM_SS_OK ) {
831 switch ( theStatus ) {
832 case PCDM_SS_DriverFailure: {
833 di << " Could not store , no driver found to make it " <<"\n" ;
836 case PCDM_SS_WriteFailure: {
837 di << " Write access failure " << "\n" ;
840 case PCDM_SS_Failure: {
841 di << " Write failure " << "\n" ;
849 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
852 di << "Usage: " << a[0] << " Doc Path" << "\n";
856 Handle(TDocStd_Document) D;
857 if (!DDocStd::GetDocument(a[1],D)) return 1;
859 TCollection_ExtendedString path (a[2]);
860 Handle(TDocStd_Application) A;
861 if (!DDocStd::Find(A)) return 1;
863 TCollection_ExtendedString theStatusMessage;
864 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
865 if (theStatus != PCDM_SS_OK ) {
866 switch ( theStatus ) {
867 case PCDM_SS_DriverFailure: {
868 di << " Could not store , no driver found to make it " <<"\n" ;
871 case PCDM_SS_WriteFailure: {
872 di << " Write access failure " << "\n" ;
875 case PCDM_SS_Failure: {
876 di << " Write failure " << "\n" ;
885 #include <BRepClass3d_SolidClassifier.hxx>
887 Standard_Integer OCC299bug (Draw_Interpretor& di,
894 di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
898 TopoDS_Shape aS = DBRep::Get(a[1]);
900 sprintf(sbf, " Null Shape is not allowed here\n");
905 if (aS.ShapeType()!=TopAbs_SOLID) {
906 sprintf(sbf, " Shape type must be SOLID\n");
911 Standard_Real aTol=1.e-7;
912 TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
913 TopAbs_State aState = TopAbs_UNKNOWN;
914 gp_Pnt aP(8., 9., 10.);
916 if (!DrawTrSurf::GetPoint(a[2], aP) ) {
917 sprintf(sbf, " Null Point is not allowed here\n");
927 BRepClass3d_SolidClassifier aSC(aS);
928 aSC.Perform(aP,aTol);
930 aState = aSC.State();
932 sprintf(sbf, "The point is "); di<<sbf;
936 sprintf(sbf, sIN.ToCString());
939 sprintf(sbf, sOUT.ToCString());
942 sprintf(sbf, sON.ToCString());
945 sprintf(sbf, sUNKNOWN.ToCString());
948 sprintf(sbf, sUNKNOWN.ToCString());
953 sprintf(sbf, " shape\n");
959 #include <OSD_Process.hxx>
960 #include <OSD_Path.hxx>
962 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
965 di << "Usage: " << a[0] << "\n";
969 OSD_Path d = p.CurrentDirectory();
970 TCollection_AsciiString s;
972 di << "*" << s.ToCString() << "*" << "\n";
975 di << "*" << s.ToCString() << "*" <<"\n";
979 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
982 di << "Usage: " << a[0] << "\n";
985 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
986 di << p.Trek().ToCString() << "\n";
988 di << p.Trek().ToCString() << "\n";
992 #include <BRepAlgoAPI_Fuse.hxx>
993 #include <BRepAlgoAPI_Common.hxx>
994 #include <BRepAlgo_Fuse.hxx>
995 #include <BRepAlgo_Common.hxx>
997 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
1000 // cout << "Usage: " << a[0] << endl;
1003 if(nb < 1 || nb > 2) {
1004 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1007 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1009 Standard_Integer IsB = atoi(a[1]);
1011 IsBRepAlgoAPI = Standard_False;
1015 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
1016 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
1018 TopoDS_Shape shape1 = box1.Shape();
1019 TopoDS_Shape shape2 = box2.Shape();
1021 //#if ! defined(BRepAlgoAPI_def01)
1022 // TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1023 // TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
1025 // TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
1026 // TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
1028 TopoDS_Shape fuse,comm;
1029 if (IsBRepAlgoAPI) {
1030 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
1031 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
1032 fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1033 comm = BRepAlgoAPI_Common( shape1, shape2 );
1035 di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
1036 fuse = BRepAlgo_Fuse( shape1, shape2 );
1037 di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
1038 comm = BRepAlgo_Common( shape1, shape2 );
1044 #include <ShapeAnalysis_Edge.hxx>
1046 static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
1050 di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
1053 TopoDS_Shape Sh1 = DBRep::Get(a[1]);
1054 TopoDS_Shape Sh2 = DBRep::Get(a[2]);
1055 if(Sh1.IsNull() || Sh2.IsNull()) {
1057 di<<"Invalid arguments"<<"\n";
1060 TopoDS_Edge e1 = TopoDS::Edge(Sh1);
1061 TopoDS_Edge e2 = TopoDS::Edge(Sh2);
1062 if(e1.IsNull() || e2.IsNull()) {
1064 di<<"Invalid type of arguments"<<"\n";
1067 Standard_Real aTol = Precision::Confusion();
1068 Standard_Real aDistDomain = 0.0;
1069 Standard_Integer k = 3;
1071 aTol = atof(a[k++]);
1073 aDistDomain = atof(a[k++]);
1075 ShapeAnalysis_Edge sae;
1076 if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
1077 if(aDistDomain ==0.0) {
1079 di<<"Edges is overlaping comletly"<<"\n";
1082 di<<"Edges is overlaped"<<"\n";
1083 di<<"with tolerance = "<<aTol<<"\n";
1084 di<<"on segment length = "<<aDistDomain<<"\n";
1088 di<<"Edges is not overlaped"<<"\n";
1094 #include <DDocStd_DrawDocument.hxx>
1095 #include <TDataStd_Name.hxx>
1097 #include <XCAFDoc_ShapeTool.hxx>
1098 #include <XCAFDoc_DocumentTool.hxx>
1099 #include <TDF_LabelSequence.hxx>
1100 #include <TPrsStd_AISPresentation.hxx>
1101 #include <TDF_Data.hxx>
1102 #include <TDF_Label.hxx>
1103 #include <XCAFPrs_Driver.hxx>
1105 //------------------------------------------------------------------------------------------
1108 //------------------------------------------------------------------------------------------
1109 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1114 // 1. Verufy amount of arguments
1115 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
1117 // 2. Retrieve DDocStd application
1118 Handle(TDocStd_Application) App;
1119 if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
1122 TCollection_ExtendedString name(argv[2]);
1123 Handle(TDocStd_Document) Doc;
1124 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
1125 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
1126 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
1127 Draw::Set(argv[1],DD);
1129 // 4. Create prsentations
1130 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1131 TDF_LabelSequence seq;
1132 shapes->GetFreeShapes ( seq );
1133 Handle(TPrsStd_AISPresentation) prs;
1134 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
1135 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
1136 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
1138 catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
1140 di << "OCC363 OK\n";
1145 ////======================================================================================
1146 //// Function : OCC372
1148 ////======================================================================================
1149 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1153 // OCC_CATCH_SIGNALS
1154 // // 1. Verufy amount of arguments
1155 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
1159 // TopoDS_Shape Ref;
1160 // BRepTools::Read(Ref, argv[1], B);
1162 // // 3. Calculate location of aP3d in relation to the solid
1163 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
1164 // BRepClass3d_SolidClassifier SC(Ref);
1165 // SC.Perform(aP3d, 1e-7);
1167 // // 4. Check returned state. The point must be inside the solid.
1168 // TopAbs_State aState=SC.State();
1172 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
1175 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
1178 // di<<"OCC372 OK. aState = TopAbs_IN" ;
1181 // di<<"OCC372 FAULTY. aState = UNKNOWN";
1185 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
1190 #include <BRepTopAdaptor_FClass2d.hxx>
1192 //======================================================================================
1193 // Function : OCC377
1195 //======================================================================================
1196 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1201 // 1. Verify validity of arguments
1202 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
1204 // 2. Initialize parameters
1206 p2d.SetX ( atof(argv[2]) );
1207 p2d.SetY ( atof(argv[3]) );
1208 Standard_Real precuv = atof (argv[4] );
1213 BRepTools::Read ( Shape, argv[1], B );
1215 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1216 TopExp_Explorer exp;
1217 Standard_Integer i=1;
1218 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1220 // 4.1. Verify whether enrtry point is on wire
1221 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1222 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1224 TopAbs_Orientation orWire = wir.Orientation();
1225 newFace.Orientation(TopAbs_FORWARD);
1228 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1229 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1230 //di << "Wire " << i << ": Infinite point is " <<
1231 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1233 TCollection_AsciiString TmpString;
1234 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1235 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1237 stat1 = FClass2d1.Perform(p2d);
1238 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1239 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1242 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1243 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1245 // 4.2. Verify whether enrtry point is on reversed wire
1246 newFace = TopoDS::Face(Shape.EmptyCopied());
1247 newFace.Orientation(TopAbs_FORWARD);
1248 orWire = TopAbs::Reverse(orWire);
1249 B.Add(newFace,wir.Oriented(orWire));
1250 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1251 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1252 //di << "Reversed Wire " << i << ": Infinite point is " <<
1253 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1256 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1257 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1259 stat2 = FClass2d2.Perform(p2d);
1260 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1261 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1264 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1265 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1267 // 4.3. Compare results (they must be same)
1268 if(stat1 ==stat2) di << "OCC377 OK" << "\n";
1269 else {di << "OCC377 FAULTY" << "\n"; return 0;}
1272 catch(Standard_Failure)
1274 di << "OCC377 Exception";
1280 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1281 #include <ShapeBuild_ReShape.hxx>
1283 //=======================================================================
1286 //=======================================================================
1287 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1292 // 1. Verify arguments of the command
1293 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1295 Standard_Boolean aConsiderLocation;
1296 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1297 else aConsiderLocation = Standard_True;
1299 // 2. Iniitialize aShapeUpgrade
1300 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1302 aShapeUpgrade.SetPrecision (Precision::Confusion());
1304 aShapeUpgrade.SetMaxTolerance(0.1);
1305 // subshapes to be divided
1306 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1307 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1308 aShapeUpgrade.Init(aSubShapesToBeDivided);
1310 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1311 aShapeUpgrade.SetContext(aReshape);
1312 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1314 // 3. Perform splitting
1315 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1316 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1317 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1319 // 4. Perform rebuilding shape
1320 // 4.1. Retrieve Shape
1321 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1322 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1323 // 4.2 Rebuid retrieved shape
1324 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1325 // 4.3. Create result Draw shape
1326 DBRep::Set(argv[1], aResultShape);
1328 catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
1334 #include <ShapeProcess_OperLibrary.hxx>
1335 #include <ShapeProcess_ShapeContext.hxx>
1336 #include <ShapeProcess.hxx>
1338 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1339 #include <BRepMesh_IncrementalMesh.hxx>
1341 //=======================================================================
1344 //=======================================================================
1345 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1350 // 1. Verify amount of arguments of the command
1351 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1353 // 2. Retrieve parameters
1355 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1356 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1357 // compound of subshapes
1358 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1359 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1360 // name of resource file
1361 const char* aResourceFile = argv[4];
1362 // name of sequence from resource file to be executed
1363 const char* aSequenceName = argv[5];
1365 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1366 ShapeProcess_OperLibrary::Init();
1367 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1368 aShapeContext->SetDetalisation (TopAbs_EDGE);
1369 ShapeProcess::Perform (aShapeContext, aSequenceName);
1371 // 4. Rebuild initil shape in accordance with performed operation
1372 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1373 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1374 for (; anIter.More(); anIter.Next())
1375 aReshape->Replace(anIter.Key(), anIter.Value());
1376 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1378 // 5 Create resultant Draw shape
1379 DBRep::Set(argv[1], aResultShape);
1382 catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
1387 //=======================================================================
1389 //purpose : Verify whether exception occurs during building mesh
1390 //=======================================================================
1391 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1396 // 1. Verify amount of arguments of the command
1397 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1399 // 2. Retrieve shape
1400 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1401 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1404 BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
1407 catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
1409 di << "OCC369 OK \n";
1413 #include <math_Vector.hxx>
1414 #include <math_Matrix.hxx>
1415 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1418 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1421 Standard_Integer LowerVector = atoi(argv[1]);
1422 Standard_Integer UpperVector = atoi(argv[2]);
1423 Standard_Real InitialValueVector = atof(argv[3]);
1424 Standard_Integer LowerRowMatrix = atoi(argv[4]);
1425 Standard_Integer UpperRowMatrix = atoi(argv[5]);
1426 Standard_Integer LowerColMatrix = atoi(argv[6]);
1427 Standard_Integer UpperColMatrix = atoi(argv[7]);
1428 Standard_Real InitialValueMatrix = atof(argv[8]);
1430 math_Vector Vector1(LowerVector, UpperVector);
1431 math_Vector Vector2(LowerVector, UpperVector);
1433 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1434 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1436 //Vector.Dump(cout);
1439 //Matrix.Dump(cout);
1442 Vector1.Multiply(Vector, Matrix);
1444 //Vector1.Dump(cout);
1445 Standard_SStream aSStream1;
1446 Vector1.Dump(aSStream1);
1450 Vector2.TMultiply(Vector, Matrix);
1452 //Vector2.Dump(cout);
1453 Standard_SStream aSStream2;
1454 Vector2.Dump(aSStream2);
1461 #include <GeomPlate_BuildPlateSurface.hxx>
1462 //=======================================================================
1465 //=======================================================================
1466 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1471 GeomPlate_BuildPlateSurface aBuilder;
1474 catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
1475 //catch (...) { di << "OCC525 Exception \n" ;return 0; }
1477 di << "OCC525 OK \n";
1481 #include <BRepPrimAPI_MakeWedge.hxx>
1482 #include <gce_MakeRotation.hxx>
1483 #include <gce_MakeTranslation.hxx>
1484 #include <BRepBuilderAPI_Transform.hxx>
1485 #include <BRepPrimAPI_MakeWedge.hxx>
1486 #include <BRepAlgoAPI_Fuse.hxx>
1487 #include <BRepAlgoAPI_Cut.hxx>
1488 #include <BRepAlgo_Fuse.hxx>
1489 #include <BRepAlgo_Cut.hxx>
1490 //=======================================================================
1493 //=======================================================================
1494 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1497 // di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
1500 if(argc < 4 || argc > 5) {
1501 di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1504 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1506 Standard_Integer IsB = atoi(argv[4]);
1508 IsBRepAlgoAPI = Standard_False;
1509 // di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1511 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
1517 double xperiod = 1.0;
1518 double yperiod = 1.0;
1519 double sub_thick = 0.5;
1522 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1523 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1525 // --------------------------------------------------------------------
1528 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1529 // 0.1, 0.1 , 0.4, 0.4 );
1530 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1531 0.1, 0.1 , 0.4, 0.4 ).Shape();
1533 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1534 gp_Dir(1.0,0.0,0.0),
1537 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1538 gp_Pnt( 0.25, 0.25, 0.5)
1541 rotate.PreMultiply( translate );
1543 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1545 if (wedge1a.IsNull()) {
1546 di<<" Null shape1 is not allowed\n";
1549 DBRep::Set(argv[1], wedge1a);
1551 // --------------------------------------------------------------------
1554 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1555 // 0.1, 0.1 , 0.4, 0.4 );
1556 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1557 0.1, 0.1 , 0.4, 0.4 ).Shape();
1559 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1560 gp_Dir(1.0,0.0,0.0),
1563 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1564 gp_Pnt( 0.25, 0.25, 0.5)
1567 rotate2.PreMultiply( translate2 );
1569 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1571 if (wedge2a.IsNull()) {
1572 di<<" Null shape2 is not allowed\n";
1575 DBRep::Set(argv[2], wedge2a);
1579 //#if ! defined(BRepAlgoAPI_def01)
1580 // TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1582 // TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1584 TopoDS_Shape wedge_common;
1585 if (IsBRepAlgoAPI) {
1586 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
1587 wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1589 di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
1590 wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1593 // remove wedge area from substrate
1594 //#if ! defined(BRepAlgoAPI_def01)
1595 // TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1597 // TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1599 TopoDS_Shape sub_etch1;
1600 if (IsBRepAlgoAPI) {
1601 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
1602 sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1604 di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
1605 sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1608 if (sub_etch1.IsNull()) {
1609 di<<" Null shape3 is not allowed\n";
1612 DBRep::Set(argv[3], sub_etch1);
1617 #include <Standard_GUID.hxx>
1618 //=======================================================================
1621 //=======================================================================
1622 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1625 di<<"Usage : " << argv[0] << " GUID\n";
1628 Standard_GUID guid(argv[1]);
1629 //guid.ShallowDump(cout);
1630 Standard_SStream aSStream;
1631 guid.ShallowDump(aSStream);
1637 #include <XCAFDoc.hxx>
1638 //=======================================================================
1639 //function : OCC738_ShapeRef
1641 //=======================================================================
1642 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1645 di<<"Usage : " << argv[0] << "\n";
1648 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1649 //guid.ShallowDump(cout);
1650 Standard_SStream aSStream;
1651 guid.ShallowDump(aSStream);
1656 //=======================================================================
1657 //function : OCC738_Assembly
1659 //=======================================================================
1660 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1663 di<<"Usage : " << argv[0] << "\n";
1666 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1667 //guid.ShallowDump(cout);
1668 Standard_SStream aSStream;
1669 guid.ShallowDump(aSStream);
1674 #if defined(DDataStd_def01)
1675 #include <DDataStd_DrawPresentation.hxx>
1676 //=======================================================================
1677 //function : OCC739_DrawPresentation
1679 //=======================================================================
1680 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1683 di<<"Usage : " << argv[0] << "\n";
1686 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1687 //guid.ShallowDump(cout);
1688 Standard_SStream aSStream;
1689 guid.ShallowDump(aSStream);
1695 //=======================================================================
1698 //=======================================================================
1699 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1701 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1702 if(aContext.IsNull()) {
1703 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
1708 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
1712 Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
1714 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1716 TCollection_AsciiString aName(argv[1]);
1717 Handle(AIS_InteractiveObject) AISObj;
1719 if(!aMap.IsBound2(aName)) {
1720 di << "Use 'vdisplay' before" << "\n";
1723 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
1724 if(AISObj.IsNull()){
1725 di << argv[1] << " : No interactive object" << "\n";
1728 AISObj->UnsetTransformation();
1729 if (!aContext->HasOpenedContext()) {
1730 aContext->OpenLocalContext();
1732 aContext->Erase(AISObj, updateviewer, PutInCollector);
1733 aContext->UpdateCurrentViewer();
1734 aContext->Display(AISObj, updateviewer);
1735 aContext->UpdateCurrentViewer();
1740 //=======================================================================
1743 //=======================================================================
1744 #include <TColStd_Array2OfInteger.hxx>
1745 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1748 di<<"Usage : " << argv[0] << "\n";
1751 TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
1752 Array2OfInteger.SetValue(5,5,55);
1756 #include <GeomAPI_ProjectPointOnSurf.hxx>
1757 //=======================================================================
1760 //=======================================================================
1761 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1765 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1770 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1771 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1772 Standard_Real Umin=atof(argv[3]);
1773 Standard_Real Usup=atof(argv[4]);
1774 Standard_Real Vmin=atof(argv[5]);
1775 Standard_Real Vsup=atof(argv[6]);
1777 if (aSurface.IsNull()) {
1778 di << argv[2] << " Null surface \n" ;
1782 GeomAPI_ProjectPointOnSurf PonSurf;
1783 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1784 PonSurf.Perform(aPoint3d);
1789 //=======================================================================
1792 //=======================================================================
1793 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1797 di<<"Usage : " << argv[0] << " wire face\n";
1801 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1802 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1803 if (awire.IsNull() || aface.IsNull()) {
1804 di << "Null object" << "\n";
1808 Standard_Integer count = 0;
1809 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1811 BRepTools_WireExplorer WE;
1812 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1813 TopoDS_Edge E = WE.Current();
1817 di << "Count = " << count << "\n";
1822 //=======================================================================
1825 //=======================================================================
1826 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1830 di <<"Usage : " << argv[0] << " face"<<"\n";
1833 Standard_Real u1, u2, v1, v2;
1834 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1837 BRepTools::UVBounds(F, u1, u2, v1, v2);
1838 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1842 #include <Expr_NamedUnknown.hxx>
1843 #include <Expr_GeneralExpression.hxx>
1844 #include <Expr_Exponential.hxx>
1845 //=======================================================================
1848 //=======================================================================
1849 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1853 di <<"Usage : " << argv[0] << " expression"<<"\n";
1857 TCollection_AsciiString myStr(argv[1]);
1859 Handle (Expr_NamedUnknown) myNamed = new Expr_NamedUnknown(myStr);
1860 Handle (Expr_Exponential) oldExpr = new Expr_Exponential(myNamed);
1861 Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
1864 TCollection_AsciiString res = newExpr->String();
1865 Standard_CString resStr = res.ToCString();
1866 TCollection_AsciiString res_old = oldExpr->String();
1867 Standard_CString res_oldStr = res_old.ToCString();
1870 di << "X = " << argv[1] << "\n";
1871 di << "Y = " << res_oldStr << "\n";
1872 di << "Y' = " << resStr << "\n";
1878 #include <TPrsStd_AISViewer.hxx>
1879 #include <TDF_Label.hxx>
1880 #include <TPrsStd_AISPresentation.hxx>
1881 //=======================================================================
1882 //function : OCC1029_AISTransparency
1883 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1884 //=======================================================================
1886 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1887 Standard_Integer nb,
1891 Handle(TDocStd_Document) D;
1892 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1894 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1896 Handle(TPrsStd_AISViewer) viewer;
1897 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1899 Handle(TPrsStd_AISPresentation) prs;
1900 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1902 prs->SetTransparency(atof(arg[3]));
1903 TPrsStd_AISViewer::Update(L);
1906 di << "Transparency = " << prs->Transparency() << "\n";
1911 di << arg[0] << " : Error" << "\n";
1915 //=======================================================================
1916 //function : OCC1030_AISColor
1917 //purpose : OCC1030_AISColor (DOC,entry,[color])
1918 //=======================================================================
1920 static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
1921 Standard_Integer nb,
1925 Handle(TDocStd_Document) D;
1926 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1928 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1930 Handle(TPrsStd_AISViewer) viewer;
1931 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1933 Handle(TPrsStd_AISPresentation) prs;
1934 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1936 prs->SetColor((Quantity_NameOfColor)atoi(arg[3]));
1937 TPrsStd_AISViewer::Update(L);
1940 di << "Color = " << prs->Color() << "\n";
1944 di << arg[0] << " : Error" << "\n";
1948 //=======================================================================
1949 //function : OCC1031_AISMaterial
1950 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
1951 //=======================================================================
1953 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
1954 Standard_Integer nb,
1958 Handle(TDocStd_Document) D;
1959 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1961 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1963 Handle(TPrsStd_AISViewer) viewer;
1964 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1966 Handle(TPrsStd_AISPresentation) prs;
1967 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1969 prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3]));
1970 TPrsStd_AISViewer::Update(L);
1973 di << "Material = " << prs->Material() << "\n";
1978 di << arg[0] << " : Error" << "\n";
1982 //=======================================================================
1983 //function : OCC1032_AISWidth
1984 //purpose : OCC1032_AISWidth (DOC,entry,[width])
1985 //=======================================================================
1987 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
1988 Standard_Integer nb,
1992 Handle(TDocStd_Document) D;
1993 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1995 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1997 Handle(TPrsStd_AISViewer) viewer;
1998 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2000 Handle(TPrsStd_AISPresentation) prs;
2001 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2003 prs->SetWidth(atof(arg[3]));
2004 TPrsStd_AISViewer::Update(L);
2007 di << "Width = " << prs->Width() << "\n";
2012 di << arg[0] << " : Error" << "\n";
2016 //=======================================================================
2017 //function : OCC1033_AISMode
2018 //purpose : OCC1033_AISMode (DOC,entry,[mode])
2019 //=======================================================================
2021 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
2022 Standard_Integer nb,
2026 Handle(TDocStd_Document) D;
2027 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2029 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2031 Handle(TPrsStd_AISViewer) viewer;
2032 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2034 Handle(TPrsStd_AISPresentation) prs;
2035 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2037 prs->SetMode(atoi(arg[3]));
2038 TPrsStd_AISViewer::Update(L);
2041 di << "Mode = " << prs->Mode() << "\n";
2046 di << arg[0] << " : Error" << "\n";
2050 //=======================================================================
2051 //function : OCC1034_AISSelectionMode
2052 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
2053 //=======================================================================
2055 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
2056 Standard_Integer nb,
2060 Handle(TDocStd_Document) D;
2061 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2063 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2065 Handle(TPrsStd_AISViewer) viewer;
2066 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2068 Handle(TPrsStd_AISPresentation) prs;
2069 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2071 prs->SetSelectionMode(atoi(arg[3]));
2072 TPrsStd_AISViewer::Update(L);
2075 di << "SelectionMode = " << prs->SelectionMode() << "\n";
2080 di << arg[0] << " : Error" << "\n";
2084 #include<BRepAlgoAPI_Cut.hxx>
2085 #include<BRepAlgo_Cut.hxx>
2086 //=======================================================================
2087 //function : OCC1487
2089 //=======================================================================
2090 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2093 // cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
2096 if(argc < 5 || argc > 6) {
2097 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
2100 Standard_Boolean IsBRepAlgoAPI = Standard_True;
2102 Standard_Integer IsB = atoi(argv[5]);
2104 IsBRepAlgoAPI = Standard_False;
2105 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
2110 Standard_Integer CaseNumber = atoi(argv[1]);
2112 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
2113 gp_Dir myDir(1,0,0);
2114 gp_Pnt myPnt(0,-50,140);
2115 gp_Ax2 myAx2(myPnt, myDir);
2116 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
2118 TopoDS_Shape cyl1 = o_mc1.Shape();
2121 TopoDS_Shape o_cut_shape;
2122 if (CaseNumber == 1) {
2123 //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(21.65064, -50.0, 127.5),gp_Dir(-sin(M_PI/3), 0.0, 0.5)), 5, 150);
2124 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
2125 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
2126 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2127 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2129 cyl2 = o_mc2.Shape();
2130 //#if ! defined(BRepAlgoAPI_def01)
2131 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2133 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2135 if (IsBRepAlgoAPI) {
2136 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2137 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2139 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2140 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2143 //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(978.34936, -50.0, 127.5),gp_Dir(sin(M_PI/3), 0.0, 0.5)), 5, 150);
2144 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
2145 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
2146 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2147 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2149 cyl2 = o_mc2.Shape();
2150 //#if ! defined(BRepAlgoAPI_def01)
2151 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2153 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2155 if (IsBRepAlgoAPI) {
2156 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2157 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2159 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2160 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2164 DBRep::Set(argv[2],cyl1);
2165 DBRep::Set(argv[3],cyl2);
2166 DBRep::Set(argv[4],o_cut_shape);
2171 #include<TopTools_ListIteratorOfListOfShape.hxx>
2172 #include<BRepFilletAPI_MakeFillet.hxx>
2173 //=======================================================================
2174 //function : OCC1077
2176 //=======================================================================
2177 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
2179 Standard_Real t3d = 1.e-4;
2180 Standard_Real t2d = 1.e-5;
2181 Standard_Real ta = 1.e-2;
2182 Standard_Real fl = 1.e-3;
2183 Standard_Real tapp_angle = 1.e-2;
2184 GeomAbs_Shape blend_cont = GeomAbs_C1;
2186 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
2189 // Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
2191 TopTools_ListIteratorOfListOfShape its;
2193 TopoDS_Compound result;
2195 B.MakeCompound(result);
2198 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
2200 const TopoDS_Shape& cutsol = ex.Current();
2202 BRepFilletAPI_MakeFillet fill(cutsol);
2203 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
2204 fill.SetContinuity(blend_cont, tapp_angle);
2206 // its = build->Section();
2208 its = aBoolenaOperation.SectionEdges();
2212 TopoDS_Edge E = TopoDS::Edge(its.Value());
2213 fill.Add(aRadius, E);
2220 B.Add(result, fill.Shape());
2224 B.Add(result, cutsol);
2230 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
2232 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
2233 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
2234 return OCC1077_boolbl(aCut,aRadius);
2237 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
2239 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
2242 TopoDS_Shape OCC1077_Bug()
2244 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
2245 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
2247 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
2248 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
2249 gp_Dir(0, 0, 1)), 3, 20).Shape();
2250 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
2251 gp_Dir(1, 0, 0)), 3, 20).Shape();
2252 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
2253 gp_Dir(0, 1, 0)), 3, 20).Shape();
2254 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
2255 Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
2257 theTmp1 = fixer->Shape();
2258 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
2259 fixer->Init(theTmp2);
2261 theTmp2 = fixer->Shape();
2262 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
2263 fixer->Init(theResult);
2265 theResult = fixer->Shape();
2269 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2271 if(argc < 1 || argc > 2) {
2272 di << "Usage : " << argv[0] << " result" << "\n";
2276 TopoDS_Shape S = OCC1077_Bug();
2277 DBRep::Set(argv[1],S);
2282 //////////////////////////////////////////////////////////////
2284 * Compute uniform distribution of points using GCPnts_UniformAbscissa
2286 //////////////////////////////////////////////////////////////
2287 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2291 di << "Usage : " << argv[0] << " name shape step" << "\n";
2294 const char *name = argv[1];
2295 Adaptor3d_Curve *adapCurve=NULL;
2296 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
2297 if (!curve.IsNull())
2298 adapCurve = new GeomAdaptor_Curve(curve);
2301 TopoDS_Shape wire = DBRep::Get(argv[2]);
2302 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2304 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
2307 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2309 double step = atof(argv[3]);
2310 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2314 di << argv[0] <<" : fail"<<"\n";
2319 int i, np = aUni.NbPoints();
2320 for (i=0; i < np; i++)
2322 double par = aUni.Parameter(i+1);
2323 gp_Pnt p = adapCurve->Value(par);
2324 char n[20], *pname=n;
2325 sprintf(n,"%s_%d",name,i+1);
2326 DrawTrSurf::Set(pname,p);
2335 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2339 di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
2343 Standard_Integer nb = atoi(argv[1]);
2344 Standard_Integer sz = atoi(argv[2]);
2345 Standard_Real val = 10;
2346 math_Vector **pv = new math_Vector *[nb];
2348 di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
2350 for (i=0; i < nb; i++) {
2351 pv[i] = new math_Vector (1, sz, val);
2352 if ((i % (nb/10)) == 0) {
2359 di<<"deleting them ..."<<"\n";
2360 for (i=0; i < nb; i++) {
2362 if ((i % (nb/10)) == 0) {
2375 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2379 di << "Usage : " << argv[0] << " wire" << "\n";
2382 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2385 TopoDS_Wire wire = TopoDS::Wire(shape);
2386 // create curve parameterised by curvilinear distance
2387 BRepAdaptor_CompCurve curve(wire,Standard_True);
2388 Standard_Real length = curve.LastParameter();
2389 Standard_Real need_length = length/2;
2391 curve.D0(need_length,pnt);
2392 // create check_curve parameterised in a general way
2393 BRepAdaptor_CompCurve check_curve(wire);
2394 Standard_Real check_par =
2395 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2397 check_curve.D0(check_par,check_pnt);
2398 // check that points are coinsiding
2399 Standard_Real error_dist = pnt.Distance(check_pnt);
2400 if (error_dist > Precision::Confusion()) {
2401 //cout.precision(3);
2402 di<<"error_dist = "<<error_dist<<
2403 " ( "<<error_dist/need_length*100<<" %)"<<"\n";
2410 static char sarr[2000];
2412 static int StackOverflow(int i = -1)
2417 memcpy(arr,sarr,2000);
2419 int n = strlen(arr), s=0;
2421 s += StackOverflow(i-1);
2422 return i + s + StackOverflow(i-1);
2425 return i + StackOverflow(i-1);
2432 // this code does not work with optimize mode on Windows
2433 #pragma optimize( "", off )
2435 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2439 di << "Usage : " << argv[0] << "\n";
2442 Standard_Boolean Succes;
2444 Succes = Standard_True;
2447 {//==== Test Divide ByZero (Integer) ========================================
2450 di << "(Integer) Divide By Zero...";
2453 Standard_Integer res, a =4, b = 0 ;
2455 di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n";
2456 Succes = Standard_False;
2458 #if defined(SOLARIS) || defined(WNT)
2459 catch(Standard_DivideByZero)
2461 catch(Standard_NumericError)
2466 catch(Standard_Failure) {
2467 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2469 di << Standard_Failure::Caught()->GetMessageString();
2470 di << ")... KO" << "\n";
2471 Succes = Standard_False;
2473 #ifndef NO_CXX_EXCEPTION
2474 // this case tests if (...) supersedes (Standard_*),
2475 // the normal behaviour is not
2477 di<<" unknown exception... (But) Ok"<<"\n";
2482 {//==== Test Divide ByZero (Real) ===========================================
2485 di << "(Real) Divide By Zero...";
2488 Standard_Real res, a= 4.0, b=0.0;
2490 di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n";
2491 Succes = Standard_False;
2493 #if defined(SOLARIS) || defined(WNT)
2494 catch(Standard_DivideByZero)
2496 catch(Standard_NumericError)
2501 catch(Standard_Failure) {
2502 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2504 di << Standard_Failure::Caught()->GetMessageString();
2505 di << ")... KO" << "\n";
2506 Succes = Standard_False;
2510 {//==== Test Overflow (Integer) =============================================
2513 di << "(Integer) Overflow...";
2516 Standard_Integer res, i=IntegerLast();
2518 //++++ cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< endl;
2519 //++++ Succes = Standard_False;
2520 di << " "<<res<<"="<<i<<"+1 Does not Caught... (But) Ok"<< "\n";
2522 catch(Standard_Overflow) {
2525 catch(Standard_Failure) {
2526 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2528 di << Standard_Failure::Caught()->GetMessageString();
2529 di << ")... KO" << "\n";
2530 Succes = Standard_False;
2534 {//==== Test Overflow (Real) ================================================
2537 di << "(Real) Overflow...";
2540 Standard_Real res, r=RealLast();
2543 sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2545 di << "-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<< "\n";
2546 Succes = Standard_False;
2548 #if defined(SOLARIS) || defined(WNT)
2549 catch(Standard_Overflow)
2551 catch(Standard_NumericError)
2556 catch(Standard_Failure) {
2557 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2559 di << Standard_Failure::Caught()->GetMessageString();
2560 di << ")... KO" << "\n";
2561 Succes = Standard_False;
2565 {//==== Test Underflow (Real) ===============================================
2568 di << "(Real) Underflow";
2571 Standard_Real res, r=1.0e-308;
2574 //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<endl;
2575 //++++ Succes = Standard_False;
2576 di<<" -- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... (But) Ok"<<"\n";
2578 #if defined(SOLARIS) || defined(WNT)
2579 catch(Standard_Underflow)
2581 catch(Standard_NumericError)
2586 catch(Standard_Failure) {
2587 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2589 di << Standard_Failure::Caught()->GetMessageString();
2590 di << ")... KO" << "\n";
2591 Succes = Standard_False;
2595 {//==== Test Invalid Operation (Real) ===============================================
2598 di << "(Real) Invalid Operation...";
2601 Standard_Real res, r=-1;
2603 di<<" "<<res<<"=sqrt("<<r<<") Does not Caught... KO"<<"\n";
2604 Succes = Standard_False;
2606 catch(Standard_NumericError) {
2609 catch(Standard_Failure) {
2610 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2612 di << Standard_Failure::Caught()->GetMessageString();
2613 di << ")... KO" << "\n";
2614 Succes = Standard_False;
2618 {//==== Test Access Violation ===============================================
2621 di << "Segmentation Fault...";
2626 di << " Does not Caught... KO"<<"\n";
2627 Succes = Standard_False;
2630 catch(OSD_Exception_ACCESS_VIOLATION)
2636 } catch(Standard_Failure) {
2637 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2639 di << Standard_Failure::Caught()->GetMessageString();
2640 di << ")... KO" << "\n";
2641 Succes = Standard_False;
2646 {//==== Test Stack Overflow ===============================================
2649 di << "Stack Overflow...";
2653 di << " Does not Caught... KO"<<"\n";
2654 Succes = Standard_False;
2656 catch(OSD_Exception_STACK_OVERFLOW) {
2659 catch(Standard_Failure) {
2660 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2662 di << Standard_Failure::Caught()->GetMessageString();
2663 di << ")... KO" << "\n";
2664 Succes = Standard_False;
2670 di << "TestExcept: Successfull completion" << "\n";
2672 di << "TestExcept: failure" << "\n";
2678 #pragma optimize( "", on )
2681 static TopoDS_Compound AddTestStructure(int nCount_)
2687 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2688 for (int i=0; i<nCount; i++) {
2689 for (int j=0; j<nCount; j++) {
2691 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2692 TopLoc_Location topLoc(trsf);
2693 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2694 B.Add(C, tempShape);
2700 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2706 di << "Usage : " << argv[0] << " [nCount]" << "\n";
2711 nCount = atoi(argv[1]);
2712 STEPCAFControl_Writer writer;
2713 Handle_TDocStd_Document document;
2714 document = new TDocStd_Document("Pace Test-StepExporter-");
2715 Handle_XCAFDoc_ShapeTool shapeTool;
2716 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2717 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2718 STEPControl_StepModelType mode = STEPControl_AsIs;
2719 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2720 di << "Failed to set assembly mode for step data\n" << "\n";
2725 if( writer.Transfer(document, mode)) {
2726 IFSelect_ReturnStatus stat =
2727 writer.Write("TestExportStructure.step");
2730 catch(OSD_Exception_STACK_OVERFLOW) {
2731 di << "Failed : STACK OVERFLOW\n" << "\n";
2733 catch (Standard_Failure) {
2734 di << "Failed :\n" << "\n";
2735 //cout << Standard_Failure::Caught() << endl;
2736 di << Standard_Failure::Caught()->GetMessageString();
2738 di << argv[0] << " : Finish" << "\n";
2743 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2747 di << "Usage : " << argv[0] << "\n";
2751 // 1. Create an array of points
2752 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2753 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2754 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2755 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2756 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2757 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2759 // 2. Create a periodic bspline through these 5 points
2760 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2762 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2764 // 3. Increase degree of curve from 3 to 8
2765 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2766 Standard_CString CString1 = "BSplineCurve";
2767 DrawTrSurf::Set(CString1,bspline1);
2769 // 4. Convers BSpline curve to Bezier segments
2770 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2772 // 5. Test the result of conversion
2773 TCollection_AsciiString aRName;
2774 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2775 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2777 aRName=aRName+TCollection_AsciiString(i);
2778 Standard_CString aRNameStr = aRName.ToCString();
2779 DrawTrSurf::Set(aRNameStr,arc);
2780 di << aRNameStr << " ";
2786 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2790 di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
2793 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2794 if (theEdge1.IsNull()) {
2795 di << "Invalid input shape " << argv[1] << "\n";
2798 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2799 if (theEdge2.IsNull()) {
2800 di << "Invalid input shape " << argv[2] << "\n";
2803 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2804 if (theFace.IsNull()) {
2805 di << "Invalid input shape " << argv[3] << "\n";
2809 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2811 Standard_Real aConfusion = Precision::Confusion();
2812 Standard_Real aP1first, aP1last, aP2first, aP2last;
2814 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2815 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2816 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2817 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2819 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2821 Standard_Integer NbPoints = anInter.NbPoints();
2823 di << "NbPoints = " << NbPoints << "\n" ;
2827 for (i=1; i<=NbPoints; i++) {
2828 gp_Pnt2d aPi = anInter.Point(i);
2829 di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2833 Standard_Integer NbSegments = anInter.NbSegments();
2835 di << "\nNbSegments = " << NbSegments << "\n" ;
2837 if (NbSegments > 0) {
2838 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2840 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2841 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2843 Standard_Real aDist = aP1.Distance(aP2);
2845 di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
2846 di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
2848 di << "Distance = " << aDist << "\n" ;
2850 di << "Confusion = " << aConfusion << "\n" ;
2852 if (aDist > aConfusion) {
2853 di << "\n" << argv[0] << " Faulty" << "\n" ;
2855 di << "\n" << argv[0] << " OK" << "\n" ;
2858 di << "\n" << argv[0] << " OK" << "\n" ;
2863 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2867 di << "Usage : " << argv[0] << " lower upper" << "\n";
2871 Standard_Integer LOWER = atoi(argv[1]);
2872 Standard_Integer UPPER = atoi(argv[2]);
2874 //! 0. Create an empty document with several test labels
2875 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2876 doc->SetUndoLimit(100);
2877 TDF_Label main_label = doc->Main();
2878 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2879 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2881 //! 1. Set/Get OCAF attribute
2883 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2884 Handle(TDataStd_RealArray) array;
2885 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2886 array->Lower() == LOWER && array->Upper() == UPPER)
2887 cout<<"1: OK"<<endl;
2890 cout<<"1: Failed.."<<endl;
2893 doc->CommitCommand();
2895 //! 2. Set/Get value
2898 for (i = LOWER; i <= UPPER; i++)
2899 array->SetValue(i, i);
2900 for (i = LOWER; i <= UPPER; i++)
2902 if (array->Value(i) != i)
2904 cout<<"2: Failed.."<<endl;
2908 cout<<"2: OK"<<endl;
2909 doc->CommitCommand();
2911 //! 3. Re-init the array
2913 array->Init(LOWER + 2, UPPER + 4);
2914 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2916 cout<<"3: Failed.."<<endl;
2919 for (i = LOWER + 2; i <= UPPER + 4; i++)
2920 array->SetValue(i, i);
2921 for (i = LOWER + 2; i <= UPPER + 4; i++)
2923 if (array->Value(i) != i)
2925 cout<<"3: Failed.."<<endl;
2929 cout<<"3: OK"<<endl;
2930 doc->CommitCommand();
2934 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2935 for (i = LOWER + 5; i <= UPPER + 5; i++)
2936 arr->SetValue(i, i);
2937 array->ChangeArray(arr);
2938 for (i = LOWER + 5; i <= UPPER + 5; i++)
2940 if (array->Value(i) != i)
2942 cout<<"4: Failed.."<<endl;
2946 cout<<"4: OK"<<endl;
2947 doc->CommitCommand();
2949 //! 5. Copy the array
2951 TDF_CopyLabel copier(label1, label2);
2953 if (!copier.IsDone())
2955 cout<<"5: Failed.."<<endl;
2958 Handle(TDataStd_RealArray) array2;
2959 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2961 cout<<"5: Failed.."<<endl;
2964 for (i = LOWER + 5; i <= UPPER + 5; i++)
2966 if (array->Value(i) != i)
2968 cout<<"5: Failed.."<<endl;
2972 cout<<"5: OK"<<endl;
2973 doc->CommitCommand();
2976 //! 6.a: undoes the 5th action: the copied array should disappear
2978 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2979 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2981 cout<<"6.a: Failed.."<<endl;
2984 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2986 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2987 array->Lower() != LOWER + 2 ||
2988 array->Upper() != UPPER + 4)
2990 cout<<"6.b: Failed.."<<endl;
2993 for (i = LOWER + 2; i <= UPPER + 4; i++)
2995 if (array->Value(i) != i)
2997 cout<<"6.b: Failed.."<<endl;
3001 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
3003 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3004 array->Lower() != LOWER ||
3005 array->Upper() != UPPER)
3007 cout<<"6.c: Failed.."<<endl;
3010 for (i = LOWER; i <= UPPER; i++)
3012 if (array->Value(i) != i)
3014 cout<<"6.c: Failed.."<<endl;
3018 //! 6.d: undoes and redoes the 2nd action: no change is expected.
3021 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3022 array->Lower() != LOWER ||
3023 array->Upper() != UPPER)
3025 cout<<"6.d: Failed.."<<endl;
3028 for (i = LOWER; i <= UPPER; i++)
3030 if (array->Value(i) != i)
3032 cout<<"6.d: Failed.."<<endl;
3036 cout<<"6: OK"<<endl;
3038 //! 7. Re-set the array
3040 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
3041 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
3043 cout<<"7: Failed.."<<endl;
3046 for (i = LOWER + 1; i <= UPPER + 1; i++)
3047 array->SetValue(i, i);
3048 for (i = LOWER + 1; i <= UPPER + 1; i++)
3050 if (array->Value(i) != i)
3052 cout<<"7: Failed.."<<endl;
3056 cout<<"7: OK"<<endl;
3057 doc->CommitCommand();
3059 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
3060 //! measure the time spent by this test.
3066 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3068 Standard_Boolean IsEvenArgc = Standard_True;
3069 if (argc % 2 == 0) {
3070 IsEvenArgc = Standard_True;
3072 IsEvenArgc = Standard_False;
3075 if (argc < 3 || IsEvenArgc)
3077 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
3081 Standard_Integer i, aValue, aPosition;
3082 NCollection_Vector<int> vec;
3083 for (i = 0; i < argc - 1; i++) {
3085 aValue = atoi(argv[i]);
3086 aPosition = atoi(argv[i+1]);
3087 vec.SetValue(aValue, aPosition);
3089 NCollection_Vector<int>::Iterator it(vec);
3091 for (j = 0; it.More(); it.Next(), j++) {
3092 //di << it.Value() << "\n";
3093 di << j << " " << it.Value() << "\n";
3099 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3102 di << "Usage : " << argv[0] << "\n";
3106 gp_Pnt point(0.0,0.0,0.0);
3108 TColgp_Array1OfPnt poles(0,6);
3111 point.SetCoord(1.0,1.0,0.0);
3114 point.SetCoord(2.0,1.0,0.0);
3117 point.SetCoord(3.0,0.0,0.0);
3120 point.SetCoord(4.0,1.0,0.0);
3123 point.SetCoord(5.0,1.0,0.0);
3126 point.SetCoord(6.0,0.0,0.0);
3129 TColStd_Array1OfReal knots(0,2);
3134 TColStd_Array1OfInteger multi(0,2);
3139 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
3142 Standard_Real l_abcissa,l_gprop;
3143 GeomAdaptor_Curve adaptor_spline(spline);
3144 GCPnts_AbscissaPoint temp;
3145 l_abcissa=temp.Length(adaptor_spline);
3146 cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
3149 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
3151 BRepGProp::LinearProperties(edge,prop);
3152 l_gprop=prop.Mass();
3153 cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
3155 cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
3160 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3164 di << "Usage : " << argv[0] << "\n";
3168 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3169 if(AISContext.IsNull())
3171 di << "use 'vinit' command before " << argv[0] << "\n";
3176 AIS_ListOfInteractive ListOfIO_1;
3177 AISContext->ObjectsInside(ListOfIO_1);
3178 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3179 if (!ListOfIO_1.IsEmpty() ) {
3180 AIS_ListIteratorOfListOfInteractive iter;
3181 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3182 Handle(AIS_InteractiveObject) aIO=iter.Value();
3183 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3187 // ObjectsInCollector
3188 AIS_ListOfInteractive ListOfIO_2;
3189 AISContext->ObjectsInCollector(ListOfIO_2);
3190 di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
3191 if (!ListOfIO_2.IsEmpty() ) {
3192 AIS_ListIteratorOfListOfInteractive iter;
3193 for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
3194 Handle(AIS_InteractiveObject) aIO=iter.Value();
3195 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3202 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3204 if ((argc < 9) || (((argc-3) % 3) != 0))
3206 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3209 Standard_Integer i, j, np = (argc-3) / 3;
3210 BRepBuilderAPI_MakePolygon W;
3212 for (i = 1; i <= np; i ++) {
3213 W.Add(gp_Pnt(atof(argv[j]),atof(argv[j+1]),atof(argv[j+2])));
3217 DBRep::Set(argv[1],W.Wire());
3218 DBRep::Set(argv[2],W.Edge());
3222 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3225 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3228 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3229 gp_Dir(1., -1., 0.));
3231 aTrf.SetAffinity (aPln, atof(argv[4]));
3232 gp_XYZ aOrigin (atof(argv[1]),atof(argv[2]),atof(argv[3]));
3233 gp_XYZ aResult (aOrigin);
3234 aTrf.Transforms(aResult);
3236 sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3237 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3238 aResult.X(), aResult.Y(), aResult.Z());
3243 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3246 di << "Usage : " << argv[0] << " shape [deflection]\n";
3250 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3252 if (aShape.IsNull()) {
3253 di<<" Null shape is not allowed";
3257 Standard_Real aDeflection = 0.45110277533;
3259 aDeflection = atof(argv[2]);
3261 di<<"deflection="<< aDeflection << "\n";
3263 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
3264 TopLoc_Location aLocation;
3265 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3267 if(aTriang.IsNull()) {
3268 di << argv[0] << " : Faulty\n" ;
3270 di << argv[0] << " : OK\n" ;
3271 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3272 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3277 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3280 di << "Usage : " << argv[0] << " A B C\n";
3285 gp_Lin2d aLin2d (atof(argv[1]),atof(argv[2]),atof(argv[3]));
3286 gp_Pnt2d anOrigin = aLin2d.Location();
3287 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3289 catch(Standard_ConstructionError)
3291 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3296 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3299 di << "Usage : " << argv[0] << " file shape\n";
3303 IGESControl_Reader aReader;
3304 aReader.ReadFile(argv[1]);
3305 aReader.SetReadVisible(Standard_True);
3306 aReader.TransferRoots();
3308 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3309 if (model.IsNull()) {
3310 di << "model.IsNull()\n";
3313 Standard_Integer nb = model->NbEntities();
3314 for (Standard_Integer i = 1; i <= nb; i ++) {
3315 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3316 Handle(TCollection_HAsciiString) name;
3317 name = ent->NameValue();
3318 Standard_CString aStr = name->ToCString();
3319 di << "NameValue = " << aStr << "\n";
3322 TopoDS_Shape shape = aReader.OneShape();
3323 DBRep::Set(argv[2],shape);
3327 // For OCC16782 testing
3328 #include <AppStd_Application.hxx>
3329 #include <TDF_Tool.hxx>
3330 #include <TColStd_HArray1OfInteger.hxx>
3332 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3333 #include <TColStd_ListIteratorOfListOfReal.hxx>
3334 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3335 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3336 #include <TDF_ListIteratorOfLabelList.hxx>
3338 #include <TDataStd_Tick.hxx>
3339 #include <TDataStd_IntegerList.hxx>
3340 #include <TDataStd_RealList.hxx>
3341 #include <TDataStd_ExtStringList.hxx>
3342 #include <TDataStd_BooleanList.hxx>
3343 #include <TDataStd_ReferenceList.hxx>
3344 #include <TDataStd_BooleanArray.hxx>
3345 #include <TDataStd_ReferenceArray.hxx>
3346 #include <TDataStd_ByteArray.hxx>
3347 #include <TDataStd_NamedData.hxx>
3348 #include <TDF_Reference.hxx>
3350 Handle(AppStd_Application) app;
3351 int TestSetGet(const Handle(TDocStd_Document)& doc)
3355 TDataStd_Tick::Set(doc->Main());
3357 Handle(TDataStd_Tick) tick;
3358 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3361 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3362 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3364 doc->Main().ResumeAttribute(tick);
3365 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3368 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3369 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3372 // TDataStd_IntegerList:
3374 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3375 setintlist->Append(2);
3376 setintlist->Prepend(1);
3377 setintlist->InsertAfter(3, 2);
3378 setintlist->InsertBefore(0, 1);
3379 setintlist->Append(200);
3380 setintlist->Remove(0);
3381 setintlist->Remove(200);
3383 Handle(TDataStd_IntegerList) getintlist;
3384 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3386 if (getintlist->First() != 1)
3388 if (getintlist->Last() != 3)
3390 const TColStd_ListOfInteger& intlist = getintlist->List();
3391 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3392 for (; itr_intlist.More(); itr_intlist.Next())
3394 if (itr_intlist.Value() != 1 &&
3395 itr_intlist.Value() != 2 &&
3396 itr_intlist.Value() != 3)
3401 getintlist->Clear();
3403 // TDataStd_RealList:
3405 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3406 setdbllist->Append(2.5);
3407 setdbllist->Prepend(1.5);
3408 setdbllist->InsertAfter(3.5, 2.5);
3409 setdbllist->InsertBefore(0.5, 1.5);
3410 setdbllist->Append(200.5);
3411 setdbllist->Remove(0.5);
3412 setdbllist->Remove(200.5);
3414 Handle(TDataStd_RealList) getdbllist;
3415 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3417 if (getdbllist->First() != 1.5)
3419 if (getdbllist->Last() != 3.5)
3421 const TColStd_ListOfReal& dbllist = getdbllist->List();
3422 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3423 for (; itr_dbllist.More(); itr_dbllist.Next())
3425 if (itr_dbllist.Value() != 1.5 &&
3426 itr_dbllist.Value() != 2.5 &&
3427 itr_dbllist.Value() != 3.5)
3432 getdbllist->Clear();
3434 // TDataStd_ExtStringList:
3436 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3437 setstrlist->Append("Hello");
3438 setstrlist->Prepend("Guten Tag");
3439 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3440 setstrlist->InsertBefore("Bonsoir", "Hello");
3441 setstrlist->Append("Good bye");
3442 setstrlist->Remove("Bonsoir");
3443 setstrlist->Remove("Good bye");
3445 Handle(TDataStd_ExtStringList) getstrlist;
3446 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3448 if (getstrlist->First() != "Guten Tag")
3450 if (getstrlist->Last() != "Hello")
3452 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3453 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3454 for (; itr_strlist.More(); itr_strlist.Next())
3456 if (itr_strlist.Value() != "Guten Tag" &&
3457 itr_strlist.Value() != "Bonjour" &&
3458 itr_strlist.Value() != "Hello")
3463 getstrlist->Clear();
3465 // TDataStd_BooleanList:
3467 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3468 setboollist->Append(Standard_True);
3469 setboollist->Prepend(Standard_False);
3471 Handle(TDataStd_BooleanList) getboollist;
3472 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3474 if (getboollist->First() != Standard_False)
3476 if (getboollist->Last() != Standard_True)
3478 const TDataStd_ListOfByte& boollist = getboollist->List();
3479 TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
3480 for (; itr_boollist.More(); itr_boollist.Next())
3482 if (itr_boollist.Value() != Standard_True &&
3483 itr_boollist.Value() != Standard_False)
3488 getboollist->Clear();
3490 // TDataStd_ReferenceList:
3491 TDF_Label L1 = doc->Main().FindChild(100);
3492 TDF_Label L2 = doc->Main().FindChild(101);
3493 TDF_Label L3 = doc->Main().FindChild(102);
3494 TDF_Label L4 = doc->Main().FindChild(103);
3495 TDF_Label L5 = doc->Main().FindChild(104);
3497 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3498 setreflist->Append(L1);
3499 setreflist->Prepend(L2);
3500 setreflist->InsertAfter(L3, L2);
3501 setreflist->InsertBefore(L4, L1);
3502 setreflist->Append(L5);
3503 setreflist->Remove(L4);
3504 setreflist->Remove(L5);
3506 Handle(TDataStd_ReferenceList) getreflist;
3507 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3509 if (getreflist->First() != L2)
3511 if (getreflist->Last() != L1)
3513 const TDF_LabelList& reflist = getreflist->List();
3514 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3515 for (; itr_reflist.More(); itr_reflist.Next())
3517 if (itr_reflist.Value() != L1 &&
3518 itr_reflist.Value() != L2 &&
3519 itr_reflist.Value() != L3)
3524 getreflist->Clear();
3526 // TDataStd_BooleanArray:
3528 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3529 setboolarr->SetValue(12, Standard_True);
3530 setboolarr->SetValue(13, Standard_False);
3531 setboolarr->SetValue(14, Standard_False);
3532 setboolarr->SetValue(15, Standard_False);
3533 setboolarr->SetValue(16, Standard_True);
3534 setboolarr->SetValue(14, Standard_True);
3536 Handle(TDataStd_BooleanArray) getboolarr;
3537 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3539 if (getboolarr->Value(12) != Standard_True)
3541 if (getboolarr->Value(13) != Standard_False)
3543 if (getboolarr->Value(14) != Standard_True)
3545 if (getboolarr->Value(15) != Standard_False)
3547 if (getboolarr->Value(16) != Standard_True)
3550 // TDataStd_ReferenceArray:
3552 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3553 setrefarr->SetValue(0, L1);
3554 setrefarr->SetValue(1, L2);
3555 setrefarr->SetValue(2, L3);
3556 setrefarr->SetValue(3, L4);
3557 setrefarr->SetValue(4, L5);
3559 Handle(TDataStd_ReferenceArray) getrefarr;
3560 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3562 if (getrefarr->Value(0) != L1)
3564 if (getrefarr->Value(1) != L2)
3566 if (getrefarr->Value(2) != L3)
3568 if (getrefarr->Value(3) != L4)
3570 if (getrefarr->Value(4) != L5)
3573 // TDataStd_ByteArray:
3575 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3576 setbytearr->SetValue(12, 0);
3577 setbytearr->SetValue(13, 1);
3578 setbytearr->SetValue(14, 2);
3579 setbytearr->SetValue(15, 3);
3580 setbytearr->SetValue(16, 255);
3582 Handle(TDataStd_ByteArray) getbytearr;
3583 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3585 if (getbytearr->Value(12) != 0)
3587 if (getbytearr->Value(13) != 1)
3589 if (getbytearr->Value(14) != 2)
3591 if (getbytearr->Value(15) != 3)
3593 if (getbytearr->Value(16) != 255)
3596 // TDataStd_NamedData:
3598 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3599 setnd->SetInteger("Integer1", 1);
3600 setnd->SetInteger("Integer2", 2);
3601 setnd->SetInteger("Integer3", 8);
3602 setnd->SetInteger("Integer3", 3);
3604 Handle(TDataStd_NamedData) getnd;
3605 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3607 if (!getnd->HasIntegers())
3609 if (!getnd->HasInteger("Integer1"))
3611 if (getnd->GetInteger("Integer2") != 2)
3613 if (getnd->GetInteger("Integer3") != 3)
3619 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3623 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3624 doc->CommitCommand();
3625 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3628 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3631 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3634 // TDataStd_IntegerList:
3636 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3638 intlist->Prepend(1);
3639 intlist->InsertBefore(0, 1);
3640 intlist->InsertAfter(3, 2);
3641 doc->CommitCommand();
3642 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3645 if (!intlist->IsEmpty())
3648 if (!intlist->Extent())
3650 if (intlist->First() != 0)
3652 if (intlist->Last() != 3)
3656 // TDataStd_RealList:
3658 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3659 dbllist->Append(2.5);
3660 dbllist->Prepend(1.5);
3661 dbllist->InsertBefore(0.5, 1.5);
3662 dbllist->InsertAfter(3.5, 2.5);
3663 doc->CommitCommand();
3664 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3667 if (!dbllist->IsEmpty())
3670 if (!dbllist->Extent())
3672 if (dbllist->First() != 0.5)
3674 if (dbllist->Last() != 3.5)
3678 // TDataStd_ExtStringList:
3680 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3681 strlist->Append("Hello");
3682 strlist->Prepend("Guten Tag");
3683 strlist->InsertAfter("Bonjour", "Guten Tag");
3684 strlist->InsertBefore("Bonsoir", "Hello");
3685 doc->CommitCommand();
3686 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3689 if (!strlist->IsEmpty())
3692 if (!strlist->Extent())
3694 if (strlist->First() != "Guten Tag")
3696 if (strlist->Last() != "Hello")
3700 // TDataStd_BooleanList:
3702 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3703 boollist->Append(Standard_True);
3704 boollist->Prepend(Standard_False);
3705 doc->CommitCommand();
3706 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3709 if (!boollist->IsEmpty())
3712 if (!boollist->Extent())
3714 if (boollist->First() != Standard_False)
3716 if (boollist->Last() != Standard_True)
3720 // TDataStd_ReferenceList:
3721 TDF_Label L1 = doc->Main().FindChild(100);
3722 TDF_Label L2 = doc->Main().FindChild(101);
3723 TDF_Label L3 = doc->Main().FindChild(102);
3724 TDF_Label L4 = doc->Main().FindChild(103);
3726 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3727 reflist->Append(L1);
3728 reflist->Prepend(L2);
3729 reflist->InsertBefore(L3, L1);
3730 reflist->InsertAfter(L4, L2);
3731 doc->CommitCommand();
3732 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3735 if (!reflist->IsEmpty())
3738 if (!reflist->Extent())
3740 if (reflist->First() != L2)
3742 if (reflist->Last() != L1)
3746 // TDataStd_BooleanArray:
3748 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3749 boolarr->SetValue(23, Standard_True);
3750 boolarr->SetValue(25, Standard_True);
3751 doc->CommitCommand();
3753 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3754 boolarr->SetValue(230, Standard_True);
3755 boolarr->SetValue(250, Standard_True);
3756 doc->CommitCommand();
3758 if (boolarr->Value(23) != Standard_True)
3760 if (boolarr->Value(24) != Standard_False)
3762 if (boolarr->Value(25) != Standard_True)
3765 if (boolarr->Value(230) != Standard_True)
3767 if (boolarr->Value(240) != Standard_False)
3769 if (boolarr->Value(250) != Standard_True)
3772 // TDataStd_ReferenceArray:
3774 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3775 refarr->SetValue(5, L1);
3776 refarr->SetValue(6, L2);
3777 refarr->SetValue(7, L3);
3778 refarr->SetValue(8, L4);
3779 doc->CommitCommand();
3780 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3784 if (refarr->Value(5) != L1)
3786 if (refarr->Value(6) != L2)
3788 if (refarr->Value(7) != L3)
3790 if (refarr->Value(8) != L4)
3793 // TDataStd_ByteArray:
3795 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3796 bytearr->SetValue(23, 23);
3797 bytearr->SetValue(25, 25);
3798 doc->CommitCommand();
3800 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3801 bytearr->SetValue(230, 230);
3802 bytearr->SetValue(250, 250);
3803 doc->CommitCommand();
3805 if (bytearr->Value(23) != 23)
3807 if (bytearr->Value(25) != 25)
3810 if (bytearr->Value(230) != 230)
3812 if (bytearr->Value(250) != 250)
3815 // TDataStd_NamedData:
3817 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3818 nd->SetByte("b14", 12);
3819 nd->SetByte("b17", 18);
3820 nd->SetByte("b14", 14);
3821 nd->SetByte("b17", 17);
3822 doc->CommitCommand();
3824 nd = TDataStd_NamedData::Set(doc->Main());
3825 nd->SetReal("r14", 14);
3826 nd->SetReal("r17", 17);
3827 nd->SetReal("r14", 14.4);
3828 nd->SetReal("r17", 17.7);
3829 doc->CommitCommand();
3831 if (nd->HasStrings())
3835 if (nd->HasReal("r17"))
3837 if (!nd->HasBytes())
3839 if (nd->GetByte("b14") != 14)
3841 if (nd->GetByte("b17") != 17)
3843 if (nd->HasByte("b18"))
3846 if (!nd->HasBytes())
3848 if (!nd->HasReals())
3850 if (nd->GetByte("b14") != 14)
3852 if (nd->GetReal("r14") != 14.4)
3854 if (nd->GetReal("r17") != 17.7)
3860 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3862 TDF_Label L1 = doc->Main().FindChild(1);
3863 TDF_Label L2 = doc->Main().FindChild(2);
3864 TDF_CopyLabel copier(L1, L2);
3867 TDataStd_Tick::Set(L1);
3869 if (!copier.IsDone())
3871 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3874 // TDataStd_IntegerList:
3875 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3877 intlist->InsertAfter(2, 1);
3879 if (!copier.IsDone())
3883 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3885 if (intlist->First() != 1)
3887 if (intlist->Last() != 2)
3891 // TDataStd_RealList:
3892 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3893 dbllist->Append(1.5);
3894 dbllist->InsertAfter(2.5, 1.5);
3896 if (!copier.IsDone())
3900 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3902 if (dbllist->First() != 1.5)
3904 if (dbllist->Last() != 2.5)
3908 // TDataStd_ExtStringList:
3909 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3910 strlist->Append("Open CASCADE");
3911 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3913 if (!copier.IsDone())
3917 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3919 if (strlist->First() != "Open CASCADE")
3921 if (strlist->Last() != " - is the best set of libraries!")
3925 // TDataStd_BooleanList:
3926 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3927 boollist->Append(Standard_True);
3928 boollist->Prepend(Standard_False);
3930 if (!copier.IsDone())
3934 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3936 if (boollist->First() != Standard_False)
3938 if (boollist->Last() != Standard_True)
3942 // TDataStd_ReferenceList:
3943 TDF_Label L100 = doc->Main().FindChild(100);
3944 TDF_Label L101 = doc->Main().FindChild(101);
3945 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3946 reflist->Append(L100);
3947 reflist->InsertAfter(L101, L100);
3949 if (!copier.IsDone())
3953 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3955 if (reflist->First() != L100)
3957 if (reflist->Last() != L101)
3961 // TDataStd_BooleanArray:
3962 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3963 boolarr->SetValue(4, Standard_True);
3964 boolarr->SetValue(6, Standard_True);
3966 if (!copier.IsDone())
3969 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3971 if (boolarr->Value(4) != Standard_True)
3973 if (boolarr->Value(5) != Standard_False)
3975 if (boolarr->Value(6) != Standard_True)
3978 // TDataStd_ReferenceArray:
3979 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3980 refarr->SetValue(3, L100);
3981 refarr->SetValue(4, L101);
3983 if (!copier.IsDone())
3986 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3988 if (refarr->Value(3) != L100)
3990 if (refarr->Value(4) != L101)
3993 // TDataStd_ByteArray:
3994 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
3995 bytearr->SetValue(4, 40);
3996 bytearr->SetValue(6, 60);
3998 if (!copier.IsDone())
4001 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4003 if (bytearr->Value(4) != 40)
4005 if (bytearr->Value(6) != 60)
4008 // TDataStd_NamedData:
4009 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
4010 nd->SetInteger("Integer1", 11);
4011 nd->SetReal("Real1", 11.1);
4012 nd->SetString("String1", "11.11111111");
4013 nd->SetByte("Byte1", 111);
4014 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
4015 ints_arr->SetValue(4, 4);
4016 ints_arr->SetValue(5, 5);
4017 nd->SetArrayOfIntegers("Integers1", ints_arr);
4019 if (!copier.IsDone())
4022 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
4024 if (!nd->HasIntegers())
4026 if (!nd->HasReals())
4028 if (!nd->HasStrings())
4030 if (!nd->HasBytes())
4032 if (!nd->HasArraysOfIntegers())
4034 if (nd->HasArraysOfReals())
4036 if (!nd->HasInteger("Integer1"))
4038 if (nd->GetInteger("Integer1") != 11)
4040 if (!nd->HasReal("Real1"))
4042 if (nd->GetReal("Real1") != 11.1)
4044 if (!nd->HasString("String1"))
4046 if (nd->GetString("String1") != "11.11111111")
4048 if (!nd->HasByte("Byte1"))
4050 if (nd->GetByte("Byte1") != 111)
4052 if (!nd->HasArrayOfIntegers("Integers1"))
4054 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
4055 if (ints_arr_out.IsNull())
4057 if (ints_arr_out->Value(5) != 5)
4063 int TestOpenSave(TCollection_ExtendedString aFile1,
4064 TCollection_ExtendedString aFile2,
4065 TCollection_ExtendedString aFile3)
4068 Handle(TDocStd_Document) doc_std, doc_std_open;
4069 app->NewDocument("MDTV-Standard", doc_std);
4071 TDataStd_Tick::Set(doc_std->Main());
4072 // TDataStd_IntegerList:
4073 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
4076 // TDataStd_RealList:
4077 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
4078 dbllist->Append(1.5);
4079 dbllist->Append(5.5);
4080 // TDataStd_ExtStringList:
4081 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
4082 strlist->Append("Auf");
4083 strlist->Append("Wiedersehen");
4084 // TDataStd_BooleanList:
4085 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
4086 boollist->Append(Standard_False);
4087 boollist->Append(Standard_True);
4088 // TDataStd_ReferenceList:
4089 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
4090 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
4091 TDF_Tool::Entry(Lstd1, entry1);
4092 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
4093 TDF_Tool::Entry(Lstd2, entry2);
4094 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
4095 reflist->Append(Lstd1);
4096 reflist->Append(Lstd2);
4097 // TDataStd_BooleanArray:
4098 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
4099 boolarr->SetValue(15, Standard_False);
4100 boolarr->SetValue(16, Standard_True);
4101 boolarr->SetValue(17, Standard_True);
4102 boolarr->SetValue(18, Standard_True);
4103 // TDataStd_ReferenceArray:
4104 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
4105 refarr->SetValue(45, Lstd1);
4106 refarr->SetValue(46, Lstd2);
4107 // TDataStd_ByteArray:
4108 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
4109 bytearr->SetValue(15, 150);
4110 bytearr->SetValue(16, 160);
4111 bytearr->SetValue(17, 170);
4112 bytearr->SetValue(18, 180);
4113 // TDataStd_NamedData:
4114 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
4116 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
4117 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
4120 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
4121 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
4130 app->Close(doc_std);
4132 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
4133 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
4135 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4137 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4139 if (intlist->First() != 1)
4141 if (intlist->Last() != 5)
4143 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4145 if (dbllist->First() != 1.5)
4147 if (dbllist->Last() != 5.5)
4149 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4151 if (strlist->First() != "Auf")
4153 if (strlist->Last() != "Wiedersehen")
4155 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4157 if (boollist->First() != Standard_False)
4159 if (boollist->Last() != Standard_True)
4161 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4163 TDF_Tool::Entry(reflist->First(), entry_first);
4164 if (entry1 != entry_first)
4166 TDF_Tool::Entry(reflist->Last(), entry_last);
4167 if (entry2 != entry_last)
4169 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4171 if (boolarr->Value(15) != Standard_False)
4173 if (boolarr->Value(16) != Standard_True)
4175 if (boolarr->Value(17) != Standard_True)
4177 if (boolarr->Value(18) != Standard_True)
4179 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4181 TDF_Tool::Entry(refarr->Value(45), entry_first);
4182 if (entry1 != entry_first)
4184 TDF_Tool::Entry(refarr->Value(46), entry_last);
4185 if (entry2 != entry_last)
4187 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4189 if (bytearr->Value(15) != 150)
4191 if (bytearr->Value(16) != 160)
4193 if (bytearr->Value(17) != 170)
4195 if (bytearr->Value(18) != 180)
4197 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4199 if (ref->Get().IsNull())
4201 if (ref->Get().Tag() != 103)
4205 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4206 app->NewDocument("XmlOcaf", doc_xml);
4208 TDataStd_Tick::Set(doc_xml->Main());
4209 // TDataStd_IntegerList:
4210 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4213 // TDataStd_RealList:
4214 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4215 dbllist->Append(1.5);
4216 dbllist->Append(5.5);
4217 // TDataStd_ExtStringList:
4218 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4219 strlist->Append("Guten ");
4220 strlist->Append("Tag");
4221 // TDataStd_BooleanList:
4222 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4223 boollist->Append(Standard_False);
4224 boollist->Append(Standard_True);
4225 // TDataStd_ReferenceList:
4226 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4227 TDF_Tool::Entry(Lxml1, entry1);
4228 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4229 TDF_Tool::Entry(Lxml2, entry2);
4230 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4231 reflist->Append(Lxml1);
4232 reflist->Append(Lxml2);
4233 // TDataStd_BooleanArray:
4234 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4235 boolarr->SetValue(15, Standard_False);
4236 boolarr->SetValue(16, Standard_True);
4237 boolarr->SetValue(17, Standard_True);
4238 boolarr->SetValue(18, Standard_True);
4239 boolarr->SetValue(19, Standard_True);
4240 boolarr->SetValue(20, Standard_True);
4241 boolarr->SetValue(21, Standard_False);
4242 boolarr->SetValue(22, Standard_True);
4243 boolarr->SetValue(23, Standard_True);
4244 boolarr->SetValue(24, Standard_True);
4245 // TDataStd_ReferenceArray:
4246 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4247 refarr->SetValue(444, Lxml1);
4248 refarr->SetValue(445, Lxml2);
4249 // TDataStd_ByteArray:
4250 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4251 bytearr->SetValue(15, 0);
4252 bytearr->SetValue(16, 10);
4253 bytearr->SetValue(17, 100);
4254 bytearr->SetValue(18, 200);
4255 bytearr->SetValue(19, 250);
4256 bytearr->SetValue(20, 251);
4257 bytearr->SetValue(21, 252);
4258 bytearr->SetValue(22, 253);
4259 bytearr->SetValue(23, 254);
4260 bytearr->SetValue(24, 255);
4262 Lstd3 = doc_xml->Main().FindChild(103);
4263 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4266 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4267 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4271 app->Close(doc_xml);
4273 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4274 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4276 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4278 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4280 if (intlist->First() != 1)
4282 if (intlist->Last() != 5)
4284 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4286 if (dbllist->First() != 1.5)
4288 if (dbllist->Last() != 5.5)
4290 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4292 if (strlist->First() != "Guten ")
4294 if (strlist->Last() != "Tag")
4296 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4298 if (boollist->First() != Standard_False)
4300 if (boollist->Last() != Standard_True)
4302 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4304 TDF_Tool::Entry(reflist->First(), entry_first);
4305 if (entry1 != entry_first)
4307 TDF_Tool::Entry(reflist->Last(), entry_last);
4308 if (entry2 != entry_last)
4310 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4312 if (boolarr->Value(15) != Standard_False)
4314 if (boolarr->Value(16) != Standard_True)
4316 if (boolarr->Value(17) != Standard_True)
4318 if (boolarr->Value(18) != Standard_True)
4320 if (boolarr->Value(19) != Standard_True)
4322 if (boolarr->Value(20) != Standard_True)
4324 if (boolarr->Value(21) != Standard_False)
4326 if (boolarr->Value(22) != Standard_True)
4328 if (boolarr->Value(23) != Standard_True)
4330 if (boolarr->Value(24) != Standard_True)
4332 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4334 TDF_Tool::Entry(refarr->Value(444), entry_first);
4335 if (entry1 != entry_first)
4337 TDF_Tool::Entry(refarr->Value(445), entry_last);
4338 if (entry2 != entry_last)
4340 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4342 if (bytearr->Value(15) != 0)
4344 if (bytearr->Value(16) != 10)
4346 if (bytearr->Value(17) != 100)
4348 if (bytearr->Value(18) != 200)
4350 if (bytearr->Value(19) != 250)
4352 if (bytearr->Value(20) != 251)
4354 if (bytearr->Value(21) != 252)
4356 if (bytearr->Value(22) != 253)
4358 if (bytearr->Value(23) != 254)
4360 if (bytearr->Value(24) != 255)
4362 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4364 if (ref->Get().IsNull())
4366 if (ref->Get().Tag() != 103)
4370 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4371 app->NewDocument("BinOcaf", doc_bin);
4373 TDataStd_Tick::Set(doc_bin->Main());
4374 // TDataStd_IntegerList:
4375 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4378 // TDataStd_RealList:
4379 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4380 dbllist->Append(1.5);
4381 dbllist->Append(5.5);
4382 // TDataStd_ExtStringList:
4383 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4384 strlist->Append("Bonjour");
4385 strlist->Append("Bonsoir");
4386 // TDataStd_BooleanList:
4387 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4388 boollist->Append(Standard_False);
4389 boollist->Append(Standard_True);
4390 // TDataStd_ReferenceList:
4391 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4392 TDF_Tool::Entry(Lbin1, entry1);
4393 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4394 TDF_Tool::Entry(Lbin2, entry2);
4395 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4396 reflist->Append(Lbin1);
4397 reflist->Append(Lbin2);
4398 // TDataStd_BooleanArray:
4399 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4400 boolarr->SetValue(15, Standard_False);
4401 boolarr->SetValue(16, Standard_True);
4402 boolarr->SetValue(17, Standard_True);
4403 boolarr->SetValue(18, Standard_True);
4404 boolarr->SetValue(19, Standard_True);
4405 boolarr->SetValue(20, Standard_True);
4406 boolarr->SetValue(21, Standard_False);
4407 boolarr->SetValue(22, Standard_True);
4408 boolarr->SetValue(23, Standard_True);
4409 boolarr->SetValue(24, Standard_True);
4410 // TDataStd_ReferenceArray:
4411 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4412 refarr->SetValue(0, Lbin1);
4413 refarr->SetValue(1, Lbin2);
4414 // TDataStd_ByteArray:
4415 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4416 bytearr->SetValue(15, 0);
4417 bytearr->SetValue(16, 255);
4418 // TDataStd_NamedData:
4419 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4420 nameddata->SetByte("A", 12);
4421 nameddata->SetByte("B", 234);
4423 Lstd3 = doc_bin->Main().FindChild(103);
4424 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4427 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4428 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4432 app->Close(doc_bin);
4434 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4435 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4437 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4439 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4441 if (intlist->First() != 1)
4443 if (intlist->Last() != 5)
4445 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4447 if (dbllist->First() != 1.5)
4449 if (dbllist->Last() != 5.5)
4451 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4453 if (strlist->First() != "Bonjour")
4455 if (strlist->Last() != "Bonsoir")
4457 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4459 if (boollist->First() != Standard_False)
4461 if (boollist->Last() != Standard_True)
4463 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4465 TDF_Tool::Entry(reflist->First(), entry_first);
4466 if (entry1 != entry_first)
4468 TDF_Tool::Entry(reflist->Last(), entry_last);
4469 if (entry2 != entry_last)
4471 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4473 if (boolarr->Value(15) != Standard_False)
4475 if (boolarr->Value(16) != Standard_True)
4477 if (boolarr->Value(17) != Standard_True)
4479 if (boolarr->Value(18) != Standard_True)
4481 if (boolarr->Value(19) != Standard_True)
4483 if (boolarr->Value(20) != Standard_True)
4485 if (boolarr->Value(21) != Standard_False)
4487 if (boolarr->Value(22) != Standard_True)
4489 if (boolarr->Value(23) != Standard_True)
4491 if (boolarr->Value(24) != Standard_True)
4493 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4495 TDF_Tool::Entry(refarr->Value(0), entry_first);
4496 if (entry1 != entry_first)
4498 TDF_Tool::Entry(refarr->Value(1), entry_last);
4499 if (entry2 != entry_last)
4501 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4503 if (bytearr->Value(15) != 0)
4505 if (bytearr->Value(16) != 255)
4507 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4509 if (nameddata->GetByte("A") != 12)
4511 if (nameddata->GetByte("B") != 234)
4513 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4515 if (ref->Get().IsNull())
4517 if (ref->Get().Tag() != 103)
4522 // For OCC16782 testing
4524 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4528 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4531 TCollection_ExtendedString aFile1(argv[1]);
4532 TCollection_ExtendedString aFile2(argv[2]);
4533 TCollection_ExtendedString aFile3(argv[3]);
4536 app = new AppStd_Application();
4540 Handle(TDocStd_Document) doc;
4541 app->NewDocument("MDTV-Standard", doc);
4542 doc->SetUndoLimit(10);
4544 di <<"\nTestSetGet start\n";
4545 good += TestSetGet(doc);
4546 di <<"TestSetGet finish\n";
4547 di <<"Status = " << good << "\n";
4549 di <<"\nTestUndoRedo start\n";
4550 good += TestUndoRedo(doc);
4551 di <<"TestUndoRedo finish\n";
4552 di <<"Status = " << good << "\n";
4554 di <<"\nTestCopyPaste start\n";
4555 good += TestCopyPaste(doc);
4556 di <<"TestCopyPaste finish\n";
4557 di <<"Status = " << good << "\n";
4559 di <<"\nTestOpenSave start\n";
4560 good += TestOpenSave(aFile1, aFile2, aFile3);
4561 di <<"TestOpenSave finish\n";
4562 di <<"Status = " << good << "\n";
4565 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4567 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4572 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4574 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4575 if(aContext.IsNull()) {
4576 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
4582 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4585 Standard_Integer mode = 0;
4588 mode = atoi(argv[1]);
4590 if (mode > 2 || mode < 0)
4592 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4595 Handle(V3d_View) V = ViewerTest::CurrentView();
4596 if ( !V.IsNull() ) {
4598 V->ColorScaleDisplay();
4601 V->ColorScaleErase();
4606 Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
4608 di <<"ColorScaleIsDisplayed = " << "1" << "\n";
4610 di <<"ColorScaleIsDisplayed = " << "0" << "\n";
4616 #include <Interface_Macros.hxx>
4617 #include <IGESControl_Controller.hxx>
4618 #include <XSDRAW.hxx>
4619 #include <Draw_ProgressIndicator.hxx>
4620 #include <XSControl_WorkSession.hxx>
4621 #include <Transfer_TransientProcess.hxx>
4622 #include <XSDRAW_Commands.hxx>
4623 #include <TColStd_HSequenceOfTransient.hxx>
4624 #include <Message_ProgressSentry.hxx>
4625 #include <XSControl_TransferReader.hxx>
4627 static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4629 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
4630 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
4632 // Progress indicator
4633 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
4634 progress->SetScale ( 0, 100, 1 );
4637 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
4639 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
4641 TCollection_AsciiString fnom,rnom;
4643 Standard_Boolean modfic = XSDRAW::FileAndVar
4644 (argv[1],argv[2],"IGESBREP",fnom,rnom);
4645 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
4646 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
4647 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
4648 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
4651 OSD_Timer Chr; Chr.Reset();
4657 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
4661 //In order to decrease number of produced edges during translation it is possible to set following parameter
4662 Interface_Static::SetIVal("read.iges.bspline.continuity",0);
4665 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
4666 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
4668 progress->EndScope();
4671 if (readstat != IFSelect_RetDone) {
4672 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
4673 else di<<"No model loaded"<<"\n";
4676 // Choice of treatment
4677 Standard_Boolean fromtcl = (argc > 3);
4678 Standard_Integer modepri = 1, nent, nbs;
4679 if (fromtcl) modepri = 4;
4682 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
4683 //mode OnlyVisible does not work.
4684 // nent = Reader.NbRootsForTransfer();
4686 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
4689 // amv 26.09.2003 : this is used to avoid error of enter's simbol
4692 modepri = atoi(str);
4695 if (modepri == 0) { //fin
4696 di << "Bye and good luck! " << "\n";
4700 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
4701 di << "All Geometry Transfer"<<"\n";
4702 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4703 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4704 Handle(XSControl_WorkSession) thesession = Reader.WS();
4705 thesession->ClearContext();
4706 XSDRAW::SetTransferProcess (thesession->MapReader());
4707 progress->NewScope ( 80, "Translation" );
4709 thesession->MapReader()->SetProgress ( progress );
4711 if (modepri == 1) Reader.SetReadVisible (Standard_True);
4712 Reader.TransferRoots();
4714 thesession->MapReader()->SetProgress ( 0 );
4715 progress->EndScope();
4717 // result in only one shape for all the roots
4718 // or in one shape for one root.
4719 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
4720 Standard_Integer answer = 1;
4721 if (Reader.NbShapes() > 1) {
4722 cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
4727 answer = atoi(str_a);
4729 if ( answer == 0) continue;
4730 if ( answer == 1 || answer == 3) {
4731 TopoDS_Shape shape = Reader.OneShape();
4733 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4735 sprintf(fname, "%s", rnom.ToCString());
4736 di << "Saving shape in variable Draw : " << fname << "\n";
4737 if (answer == 3) IGESToBRep::WriteShape (shape,1);
4740 DBRep::Set(fname,shape);
4742 catch(Standard_Failure) {
4743 di << "** Exception : ";
4744 di << Standard_Failure::Caught()->GetMessageString();
4745 di<<" ** Skip"<<"\n";
4746 di << "Saving shape in variable Draw : " << fname << "\n";
4747 IGESToBRep::WriteShape (shape,1);
4751 else if (answer == 2 || answer == 4) {
4752 Standard_Integer numshape = Reader.NbShapes();
4753 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
4754 // save all the shapes
4755 TopoDS_Shape shape = Reader.Shape(inum);
4756 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4758 sprintf(fname, "%s_%d", rnom.ToCString(),inum);
4759 di << "Saving shape in variable Draw : " << fname << "\n";
4760 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
4763 DBRep::Set(fname,shape);
4765 catch(Standard_Failure) {
4766 di << "** Exception : ";
4767 di << Standard_Failure::Caught()->GetMessageString();
4768 di<<" ** Skip"<<"\n";
4775 else if (modepri == 3) { // One Entity
4776 cout << "Only One Entity"<<endl;
4777 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
4778 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
4779 cout << " give the number of the Entity : " << flush;
4780 nent = XSDRAW::GetEntityNumber();
4782 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4784 nbs = Reader.NbShapes();
4785 char shname[30]; sprintf (shname,"%s_%d",rnom.ToCString(),nent);
4786 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4787 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4788 TopoDS_Shape sh = Reader.Shape(nbs);
4789 DBRep::Set (shname,sh);
4793 else if (modepri == 4) { // Selection
4794 Standard_Integer answer = 1;
4795 Handle(TColStd_HSequenceOfTransient) list;
4797 // Selection, nommee ou via tcl. tcl : raccourcis admis
4798 // * donne iges-visible + xst-transferrable-roots
4799 // *r donne xst-model-roots (TOUTES racines)
4801 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
4802 di << "All Geometry Transfer"<<"\n";
4803 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4804 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4805 Handle(XSControl_WorkSession) thesession = Reader.WS();
4806 thesession->ClearContext();
4807 XSDRAW::SetTransferProcess (thesession->MapReader());
4808 progress->NewScope ( 80, "Translation" );
4810 thesession->MapReader()->SetProgress ( progress );
4812 Reader.SetReadVisible (Standard_True);
4813 Reader.TransferRoots();
4815 thesession->MapReader()->SetProgress ( 0 );
4816 progress->EndScope();
4819 // result in only one shape for all the roots
4820 TopoDS_Shape shape = Reader.OneShape();
4823 sprintf(fname, "%s", rnom.ToCString());
4824 di << "Saving shape in variable Draw : " << fname << "\n";
4827 DBRep::Set(fname,shape);
4829 catch(Standard_Failure) {
4830 di << "** Exception : ";
4831 di << Standard_Failure::Caught()->GetMessageString();
4832 di<<" ** Skip"<<"\n";
4833 di << "Saving shape in variable Draw : " << fname << "\n";
4834 IGESToBRep::WriteShape (shape,1);
4840 modepri = 0; // d office, une seule passe
4841 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
4843 list = XSDRAW::GetList ("xst-model-roots");
4846 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
4847 di<<"List given by "<<compart.ToCString()<<" : ";
4848 list = XSDRAW::GetList (compart.ToCString());
4850 if (list.IsNull()) {
4851 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
4856 cout<<"Name of Selection :"<<flush;
4857 list = XSDRAW::GetList();
4858 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
4861 Standard_Integer nbl = list->Length();
4862 di<<"Nb entities selected : "<<nbl<<"\n";
4863 if (nbl == 0) continue;
4866 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
4869 char str_answer[80];
4871 answer = atoi(str_answer);
4873 if (answer <= 0 || answer > 3) continue;
4875 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
4876 Handle(Standard_Transient) ent = list->Value(ill);
4877 di<<" ";// model->Print(ent,di);
4881 if (answer == 1 || answer == 2) {
4882 Standard_Integer nbt = 0;
4883 Handle(XSControl_WorkSession) thesession = Reader.WS();
4885 XSDRAW::SetTransferProcess (thesession->MapReader());
4886 progress->NewScope ( 80, "Translation" );
4888 thesession->MapReader()->SetProgress ( progress );
4890 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
4891 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
4893 nent = Reader.Model()->Number(list->Value(ill));
4894 if (nent == 0) continue;
4895 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4897 nbs = Reader.NbShapes();
4898 char shname[30]; sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
4899 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4900 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4901 TopoDS_Shape sh = Reader.Shape(nbs);
4902 DBRep::Set (shname,sh);
4906 thesession->MapReader()->SetProgress ( 0 );
4907 progress->EndScope();
4909 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
4910 answer = 0; // on ne reboucle pas
4914 else di<<"Unknown mode n0 "<<modepri<<"\n";
4918 //In order to clear memory after IGES reading you could add the following code
4919 Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
4920 Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
4923 Reader.WS()->Model()->Clear();
4924 Standard_Integer i =1;
4926 Reader.WS()->ClearData(i);
4932 #include <Geom_Plane.hxx>
4933 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4937 di << "Usage : " << argv[0] << " plane a b c d\n";
4941 Standard_Real A = atof(argv[2]);
4942 Standard_Real B = atof(argv[3]);
4943 Standard_Real C = atof(argv[4]);
4944 Standard_Real D = atof(argv[5]);
4946 Handle(Geom_Geometry) result;
4948 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4951 DrawTrSurf::Set(argv[1],result);
4955 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4959 di << "Usage : " << argv[0] << " MaxNbr" << "\n";
4962 Standard_Integer aMaxNbr = atoi(argv[1]);
4964 for (Standard_Integer i=0;i<aMaxNbr;i++)
4966 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4968 TopoDS_Wire wireShape( w.Wire());
4969 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4970 TopoDS_Face f( faceBuilder.Face());
4971 BRepMesh_IncrementalMesh im(f,1);
4972 BRepTools::Clean(f);
4977 #include <Graphic3d_Vector.hxx>
4978 Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4982 di << "Wrong number of arguments" << "\n";
4985 Standard_Real X1_Pnt = atof(argv[1]);
4986 Standard_Real Y1_Pnt = atof(argv[2]);
4987 Standard_Real Z1_Pnt = atof(argv[3]);
4988 Standard_Real X2_Pnt = atof(argv[4]);
4989 Standard_Real Y2_Pnt = atof(argv[5]);
4990 Standard_Real Z2_Pnt = atof(argv[6]);
4992 Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
4993 Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
4995 di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
5002 #include <IntCurvesFace_ShapeIntersector.hxx>
5003 #include <gp_Lin.hxx>
5004 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5008 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
5012 TopoDS_Shape shape = DBRep::Get(argv[1]);
5014 if (shape.IsNull()) {
5015 di<<" Null shape is not allowed";
5019 Standard_Real X_Pnt = atof(argv[2]);
5020 Standard_Real Y_Pnt = atof(argv[3]);
5021 Standard_Real Z_Pnt = atof(argv[4]);
5023 Standard_Real X_Dir = atof(argv[5]);
5024 Standard_Real Y_Dir = atof(argv[6]);
5025 Standard_Real Z_Dir = atof(argv[7]);
5027 Standard_Real PInf = atof(argv[8]);
5029 IntCurvesFace_ShapeIntersector intersector;
5030 intersector.Load(shape, Precision::Intersection());
5032 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
5033 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
5034 gp_Lin ray(origin, dir);
5036 Standard_Real PSup = RealLast();
5037 intersector.PerformNearest(ray, PInf, PSup);
5038 if (intersector.NbPnt() != 0)
5040 di << argv[0] << " status = 0 \n";
5041 Standard_Real w = intersector.WParameter(1);
5042 di << "w = " << w << "\n";
5044 di << argv[0] << " status = -1 \n";
5049 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5052 di << "Usage : " << argv[0] << "\n";
5056 // Create mask 1111: extent == 4
5057 TColStd_PackedMapOfInteger aFullMask;
5058 for (Standard_Integer i = 0; i < 4; i++)
5061 // Create mask 1100: extent == 2
5062 TColStd_PackedMapOfInteger aPartMask;
5063 for (Standard_Integer i = 0; i < 2; i++)
5066 di << "aFullMask = 1111" << "\n";
5067 di << "aPartMask = 1100" << "\n";
5069 Standard_Boolean isAffected;
5071 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
5072 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5073 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
5074 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5075 isAffected = aFullMask.Subtract(aPartMask); // false (?)
5076 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5080 #include <ShapeFix_FixSmallFace.hxx>
5081 Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5085 di << "Usage : " << argv[0] << " shape resshape\n";
5089 // try to read a shape:
5090 TopoDS_Shape aShape=DBRep::Get(argv[1]);
5091 ShapeFix_FixSmallFace aFixSmallFaces;
5092 aFixSmallFaces.Init (aShape);
5093 aFixSmallFaces.Perform();
5094 TopoDS_Shape aResShape = aFixSmallFaces.Shape();
5095 DBRep::Set(argv[2],aResShape);
5101 #include <NCollection_DataMap.hxx>
5102 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5106 di << "Usage : " << argv[0] << "\n";
5110 TCollection_ExtendedString anExtString;
5112 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
5113 anExtString.Insert(1, aNonAsciiChar);
5115 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
5116 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
5117 aMap.Bind(anExtString, 0);
5123 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5126 di << "Wrong number of arguments" << argv[0] << "\n";
5130 Standard_Real X_vec = atof(argv[1]);
5131 Standard_Real Y_vec = atof(argv[2]);
5132 Standard_Real Z_vec = atof(argv[3]);
5134 Standard_Real X_dir = atof(argv[4]);
5135 Standard_Real Y_dir = atof(argv[5]);
5136 Standard_Real Z_dir = atof(argv[6]);
5138 Standard_Real X_pnt = atof(argv[7]);
5139 Standard_Real Y_pnt = atof(argv[8]);
5140 Standard_Real Z_pnt = atof(argv[9]);
5142 gp_Dir toSym(X_vec, Y_vec, Z_vec);
5143 gp_Dir dir(X_dir, Y_dir, Z_dir);
5144 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
5145 gp_Ax2 symObj(loc,dir);
5146 toSym.Mirror(symObj);
5148 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
5153 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5157 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
5161 Standard_Real X_mirrorFirstPoint = atof(argv[1]);
5162 Standard_Real Y_mirrorFirstPoint = atof(argv[2]);
5163 Standard_Real X_mirrorSecondPoint = atof(argv[3]);
5164 Standard_Real Y_mirrorSecondPoint = atof(argv[4]);
5165 Standard_Real X_p1 = atof(argv[5]);
5166 Standard_Real Y_p1 = atof(argv[6]);
5167 Standard_Real X_p2 = atof(argv[7]);
5168 Standard_Real Y_p2 = atof(argv[8]);
5170 gp_Trsf2d identityTransformation;
5172 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
5173 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
5174 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
5176 gp_Pnt2d p1(X_p1,Y_p1);
5177 gp_Pnt2d p2(X_p2,Y_p2);
5180 M1.SetMirror(mirrorAxis);
5182 M2.SetMirror(mirrorAxis);
5184 Tcomp = M2.Multiplied(M1);
5186 Standard_Real aTol = Precision::Confusion();
5187 Standard_Integer aStatus = 0;
5189 //After applying two times the same mirror the point is located on the same location OK
5190 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
5191 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
5193 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
5196 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
5197 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
5199 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
5202 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
5203 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
5204 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
5206 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
5209 di << "Status = " << aStatus << "\n";
5213 Standard_Integer OCC23429(Draw_Interpretor& di,
5214 Standard_Integer narg, const char** a)
5216 if (narg < 4) return 1;
5218 TopoDS_Shape aShape = DBRep::Get(a[2]);
5219 if (aShape.IsNull()) return 1;
5221 BRepFeat_SplitShape Spls(aShape);
5222 Spls.SetCheckInterior(Standard_False);
5224 TopoDS_Shape aTool = DBRep::Get(a[3]);
5226 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
5227 Builder.ComputePCurveOn1(Standard_True);
5229 Builder.Approximation(Standard_True);
5231 TopoDS_Shape aSection = Builder.Shape();
5233 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
5234 for (; ExpSec.More(); ExpSec.Next())
5236 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
5237 Handle(Geom2d_Curve) thePCurve;
5238 Handle(Geom_Surface) theSurface;
5239 TopLoc_Location theLoc;
5240 Standard_Real fpar, lpar;
5241 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
5243 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
5244 for (; ExpShape.More(); ExpShape.Next())
5246 aFace = TopoDS::Face(ExpShape.Current());
5247 TopLoc_Location aLoc;
5248 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
5249 if (aSurface == theSurface && aLoc == theLoc)
5252 Spls.Add(anEdge, aFace);
5255 TopoDS_Shape Result = Spls.Shape();
5256 DBRep::Set(a[1], Result);
5261 #include <BOPTColStd_CArray1OfInteger.hxx>
5262 //=======================================================================
5263 //function : DumpArray
5265 //=======================================================================
5266 void DumpArray(const BOPTColStd_CArray1OfInteger& aC,
5267 Draw_Interpretor& aDI)
5269 Standard_Integer iLength, iFactLength, iBlockLength;
5271 iLength=aC.Length();
5272 iFactLength=aC.FactLength();
5273 iBlockLength=aC.BlockLength();
5275 aDI<< "Length: " <<iLength << "\n";
5276 aDI<< "FactLength: " <<iFactLength << "\n";
5277 aDI<< "BlockLength: " <<iBlockLength << "\n";
5279 //=======================================================================
5280 //function : bcarray
5282 //=======================================================================
5283 Standard_Integer bcarray (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5287 di << "Usage : " << argv[0] << "\n";
5291 Standard_Integer i, aBL;
5292 BOPTColStd_CArray1OfInteger aC;
5295 aC.SetBlockLength(aBL);
5297 for (i=1; i<=10; ++i) {
5300 di<< "\nstate before release the unused memory\n";
5305 di<< "\nstate after release the unused memory\n";
5311 #include <ExprIntrp_GenExp.hxx>
5312 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5316 di << "Usage : " << argv[0] << " string\n";
5320 Standard_CString aString = argv[1];
5321 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
5324 myExpr->Process( aString );
5326 catch(Standard_Failure) {
5327 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
5328 di << "Exception : " << aFail->GetMessageString() << "\n";
5334 #include <Quantity_NameOfColor.hxx>
5335 #include <TopAbs_ShapeEnum.hxx>
5336 Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5338 // Check the command arguments
5341 di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
5342 di << "Usage : " << argv[0] << " mode(0/1)\n";
5343 return 1; //TCL_ERROR
5346 const Standard_Integer aMode = atoi(argv[1]);
5348 //===================================================================
5350 Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
5351 if (aisContext.IsNull())
5353 di <<"Error: call 'vinit' first"<< "\n";
5354 return 1; //TCL_ERROR
5357 if (aisContext->HasOpenedContext())
5359 aisContext->CloseAllContexts();
5360 aisContext->RemoveAll(false);
5361 aisContext->EraseSelected(false, false);
5363 aisContext->EraseAll(false,false);
5364 Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
5365 Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
5367 trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
5368 trihedron->SetSize(20);
5369 trihedron->SetColor(Quantity_NOC_GRAY30);
5370 trihedron->SetArrowColor(Quantity_NOC_GRAY30);
5371 trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
5373 //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5374 //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5375 //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
5378 aisContext->Display(trihedron, true);
5379 aisContext->OpenLocalContext();
5380 //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
5381 aisContext->ActivateStandardMode(TopAbs_EDGE);
5382 aisContext->SetSensitivity(8);
5387 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
5388 const char *group = "QABugs";
5390 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
5392 // Remove as bad version of QAAddOrRemoveSelected from QADraw
5393 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
5395 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
5396 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
5397 theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
5399 //====================================================
5401 // Following commands are inserted from
5402 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
5403 // ( 75455 Apr 16 18:59)
5405 //====================================================
5407 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
5408 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
5410 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
5412 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
5413 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
5414 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
5415 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
5416 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
5417 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
5420 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
5421 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
5422 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
5424 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
5425 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
5426 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
5428 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
5429 theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
5431 theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
5433 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
5435 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
5436 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
5437 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
5438 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
5439 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
5440 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
5441 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
5442 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
5443 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
5444 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
5445 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
5446 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
5447 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
5448 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
5449 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5450 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5451 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5452 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5454 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5455 theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
5456 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5457 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5458 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5459 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5461 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5462 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
5464 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5465 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5466 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5467 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5468 theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
5469 theCommands.Add("OCC7141", "OCC7141 [nCount]", __FILE__, OCC7141, group);
5470 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5471 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5472 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5473 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5474 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5475 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5476 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5477 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5478 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5479 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5480 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5481 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5482 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5483 theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
5484 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5485 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5486 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5487 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5488 theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
5489 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5490 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5491 theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
5492 theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
5493 theCommands.Add("OCC22558", "OCC22558 x_vec y_vec z_vec x_dir y_dir z_dit x_pnt y_pnt z_pnt", __FILE__, OCC22558, group);
5494 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5495 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5496 theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);