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.
27 #include <Draw_Interpretor.hxx>
29 #include <DrawTrSurf.hxx>
30 #include <AIS_InteractiveContext.hxx>
31 #include <ViewerTest.hxx>
32 #include <AIS_Shape.hxx>
33 #include <TopoDS_Shape.hxx>
35 #include <Geom_Axis2Placement.hxx>
37 #include <gp_Trsf.hxx>
38 #include <AIS_Trihedron.hxx>
39 #include <BRepPrimAPI_MakeBox.hxx>
40 #include <Graphic3d_MaterialAspect.hxx>
41 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
42 #include <TopoDS_Solid.hxx>
43 #include <BRepPrimAPI_MakeSphere.hxx>
44 #include <BRepPrimAPI_MakeCone.hxx>
45 #include <BRepPrimAPI_MakeCylinder.hxx>
46 #include <IGESToBRep_Reader.hxx>
47 #include <TopExp_Explorer.hxx>
49 #include <GCPnts_UniformDeflection.hxx>
50 #include <BRepAdaptor_Curve.hxx>
51 #include <IGESToBRep.hxx>
52 #include <V3d_Viewer.hxx>
53 #include <BRepAdaptor_CompCurve.hxx>
54 #include <GCPnts_AbscissaPoint.hxx>
55 #include <Standard_ErrorHandler.hxx>
56 #include <Standard_Overflow.hxx>
57 #include <Standard_Underflow.hxx>
58 #include <Standard_DivideByZero.hxx>
59 #include <OSD_SIGSEGV.hxx>
60 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
61 #include <OSD_Exception_STACK_OVERFLOW.hxx>
63 #include <STEPCAFControl_Writer.hxx>
64 #include <STEPControl_StepModelType.hxx>
65 #include <Interface_Static.hxx>
66 #include <IFSelect_ReturnStatus.hxx>
67 #include <Standard_Failure.hxx>
68 #include <TColgp_HArray1OfPnt2d.hxx>
69 #include <Geom2dAPI_Interpolate.hxx>
70 #include <Geom2d_BSplineCurve.hxx>
71 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
72 #include <Geom2d_BezierCurve.hxx>
73 #include <BRep_Tool.hxx>
74 #include <GeomProjLib.hxx>
75 #include <Geom2dAPI_InterCurveCurve.hxx>
76 #include <IntRes2d_IntersectionSegment.hxx>
77 #include <TDataStd_RealArray.hxx>
78 #include <TDF_CopyLabel.hxx>
79 #include <NCollection_Vector.hxx>
80 #include <TColStd_Array1OfInteger.hxx>
81 #include <Geom_BSplineCurve.hxx>
82 #include <TColgp_Array1OfPnt.hxx>
83 #include <AIS_ListOfInteractive.hxx>
84 #include <AIS_ListIteratorOfListOfInteractive.hxx>
85 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
86 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
87 #include <BRepBuilderAPI_MakePolygon.hxx>
88 #include <gp_GTrsf.hxx>
89 #include <Poly_Triangulation.hxx>
90 #include <IGESControl_Reader.hxx>
91 #include <IGESData_IGESModel.hxx>
92 #include <IGESData_IGESEntity.hxx>
93 #include <V3d_View.hxx>
94 #include <BRepFeat_SplitShape.hxx>
95 #include <BRepAlgoAPI_Section.hxx>
100 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
102 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
105 static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
107 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
108 if(myAISContext.IsNull()) {
109 di << "use 'vinit' command before " << argv[0] ;
113 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
116 trsf1.SetTranslation(gp_Vec(100, 100, 0));
117 aTrihedronAxis->Transform(trsf1);
118 Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
119 myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
120 myTrihedron->SetSize(100);
121 myAISContext->Display(myTrihedron, Standard_True);
123 // TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
124 TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
125 Handle(AIS_Shape) AS = new AIS_Shape(shape1);
126 AS->SetDisplayMode(1);
127 Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
128 AS->SetMaterial(mat);
129 AS->SetColor(Quantity_NOC_RED);
130 myAISContext->Display(AS);
133 TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
135 myAISContext->ResetLocation(AS);
136 myAISContext->SetLocation(AS , TouchTrsf) ;
137 myAISContext->Redisplay(AS, Standard_True);
142 // Remove as bad version of QAAddOrRemoveSelected from QADraw
143 //static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
146 // di<<"Usage : " << argv[0] << " shape islocal\n";
150 // Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
152 // // ViewerTest_DoubleMapOfInteractiveAndName& aMap =
153 // // ViewerTest::GetDataMapOfAIS ();
154 // ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
156 // TCollection_AsciiString aName(argv[1]);
157 // Handle(AIS_InteractiveObject) AISObj;
159 // if(aMap.IsBound2(aName)) {
160 // AISObj = aMap.Find2(aName);
161 // if(AISObj.IsNull()){
162 // di<<"No interactive object \n";
166 // Standard_Integer aNum = -1;
168 // if(Draw::Atoi(argv[2])) {
169 // aNum = anAISCtx->OpenLocalContext();
172 // if(anAISCtx->HasOpenedContext()){
173 // anAISCtx->InitSelected();
174 // anAISCtx->AddOrRemoveSelected(AISObj);
177 // anAISCtx->InitCurrent();
178 // anAISCtx->AddOrRemoveCurrentObject(AISObj);
182 // // anAISCtx->CloseLocalContext(aNum);
187 // //select this shape:
189 // di<<"Use 'vdisplay' before";
194 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
197 di<<"Usage: OCC136\n";
201 //create some primitives:
203 Standard_Real Size=100;
204 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
206 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
208 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
210 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
211 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
213 anAx2.SetLocation(gp_Pnt(Size,0,0));
214 anAx2.SetDirection(gp_Dir(-1,-1,1));
215 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
217 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
218 if(anAISCtx.IsNull()){
219 di<<"Null interactive context. Use 'vinit' at first.\n";
223 if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
224 anAISCtx->EraseAll();
226 //load primitives to context
227 Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
228 anAISCtx->Display(aSh1);
230 Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
231 anAISCtx->Display(aSh2);
233 Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
234 anAISCtx->Display(aSh3);
236 Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
237 anAISCtx->Display(aSh4);
240 anAISCtx->InitCurrent();
241 anAISCtx->AddOrRemoveCurrentObject(aSh1);
242 anAISCtx->AddOrRemoveCurrentObject(aSh2);
243 anAISCtx->AddOrRemoveCurrentObject(aSh3);
244 anAISCtx->AddOrRemoveCurrentObject(aSh4);
246 //remove all this objects from context
247 anAISCtx->Clear(aSh1, Standard_False);
248 anAISCtx->Clear(aSh2, Standard_False);
249 anAISCtx->Clear(aSh3, Standard_False);
250 anAISCtx->Clear(aSh4, Standard_False);
254 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
256 printf("Usage: %s iges_input [name]\n",argv[0]);
259 Standard_Character *Ch;
262 Ch = new Standard_Character[strlen(argv[2])+3];
264 IGESToBRep_Reader IR;
265 IR.LoadFile (argv[1]);
268 TopoDS_Shape aTopShape = IR.OneShape();
269 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
270 Standard_Integer i=0;
271 for( ; ex.More(); ex.Next()){
272 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
273 BRepAdaptor_Curve aCurve(E);
274 GCPnts_UniformDeflection plin(aCurve, 0.1);
275 di << "Num points = " << plin.NbPoints() << "\n";
278 Sprintf(Ch,"%s_%i",argv[2],1);
285 static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
289 di << "Usage : " << a[0] << " file.igs" << "\n";
293 Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
295 if(myContext.IsNull()) {
296 di << "use 'vinit' command before " << a[0] << "\n";
301 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
302 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
304 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
307 Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
308 Sprintf(file1,"%s/%s",DD,a[1]);
310 IGESToBRep_Reader reader;
311 Standard_Integer status = reader.LoadFile(file1);
314 reader.TransferRoots();
315 TopoDS_Shape shape = reader.OneShape();
317 Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
319 Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
321 if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
322 importedShape->SetDisplayMode(AIS_WireFrame);
323 else importedShape->SetDisplayMode(AIS_Shaded);
324 myContext->Display(importedShape);
327 printf("\n End of my IGES to 3D-viewer *****************>\n");
332 //====================================================
334 // Following code is inserted from
335 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
336 // ( 75455 Apr 16 18:59)
338 //====================================================
341 #include <BRepTools_WireExplorer.hxx>
342 #include <BRep_Tool.hxx>
343 #include <GCPnts_UniformAbscissa.hxx>
344 #include <TopExp.hxx>
347 // usage : OCC105 shape
350 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
352 //Value Pnt = -338.556216693211 -394.465571897208 0
354 //Value Pnt = -307.47165394 -340.18073533 0
356 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
359 di<<"Usage : OCC105 shape\n";
362 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
363 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
364 Standard_Real l = 0.5; //Draw::Atof(argv[2]);
365 // Find the first vertex of the wire
366 BRepTools_WireExplorer wire_exp(myTopoDSWire);
369 TopoDS_Vertex vw1, vw2;
370 TopExp::Vertices(myTopoDSWire,vw1,vw2);
371 TopoDS_Vertex ve1, ve2;
372 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
373 TopExp::Vertices(edge,ve1,ve2);
374 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
377 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
381 for ( ; wire_exp.More(); wire_exp.Next())
383 di << "\n\n New Edge \n" << "\n";
384 Standard_Real newufirst, newulast;
385 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
386 Standard_Real ufirst, ulast;
387 Handle(Geom_Curve) acurve;
388 TopoDS_Vertex ve1, ve2;
389 TopExp::Vertices(edge,ve1,ve2);
390 if (ve1.IsSame(vlast))
392 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
399 // assert(ve2.IsSame(vlast));
400 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
401 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
402 newufirst = acurve->ReversedParameter( ufirst );
403 newulast = acurve->ReversedParameter( ulast );
404 acurve = acurve->Reversed( );
408 GeomAdaptor_Curve curve;
409 GCPnts_UniformAbscissa algo;
411 algo.Initialize( curve, l, newufirst, newulast );
413 di << "Not Done!!!" << "\n";
414 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
415 Standard_Real t = algo.Parameter(Index);
416 gp_Pnt pt3 = curve.Value(t);
417 di << "Parameter t = " << t << "\n";
418 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
425 #include <TColStd_SequenceOfTransient.hxx>
426 #include <GeomFill_Pipe.hxx>
427 static int pipe_OCC9 (Draw_Interpretor& di,
428 Standard_Integer n, const char ** a)
431 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
435 TColStd_SequenceOfTransient aCurveSeq;
437 for (i=2 ; i<=4; i++) {
438 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
440 di << a[i] << " is not a curve" << "\n";
443 aCurveSeq.Append(aC);
446 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
447 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
448 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
452 aPipe.Perform(Draw::Atof (a[6]), Standard_True);
454 aPipe.Perform(Standard_True/*, Standard_True*/);
457 Handle(Geom_Surface) aSurf = aPipe.Surface();
459 DrawTrSurf::Set(a[1], aSurf);
463 //======================================================================
465 // usage : OCC125 shell
466 //======================================================================
467 #include <ShapeFix_Shell.hxx>
469 Standard_Integer OCC125(Draw_Interpretor& di ,
474 di<<" Use OCC125 shell";
478 TopoDS_Shape S = DBRep::Get(a[1]);
481 di<<" Null shape is not allowed";
487 if (aT!=TopAbs_SHELL) {
488 di<<" Shape Type must be SHELL";
492 const TopoDS_Shell& aShell = TopoDS::Shell(S);
494 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
496 isAccountMultiConex=Standard_True;
497 bNonManifold=Standard_False;
499 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
500 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
502 di<<"bResult="<<(Standard_Integer)bResult;
505 aShape=aFix->Shape();
507 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
510 DBRep::Set (aRName.ToCString(), aShape);
511 di<<aRName.ToCString();
516 #include <BRepLib_FindSurface.hxx>
517 #include <BRepBuilderAPI_MakeFace.hxx>
518 Standard_Integer OCC157(Draw_Interpretor& di,
521 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
524 di << "bad number of arguments" <<"\n";
528 // try to read a shape:
529 TopoDS_Shape inputShape=DBRep::Get(a[2]);
530 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
531 di << "Invalid input shape"<< "\n";
534 Standard_Real toler = Draw::Atof(a[3]);
535 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
536 BRepLib_FindSurface FS(aWire, toler, Standard_True);
538 di<<"OCC157: OK; Planar surface is found"<<"\n";
539 Handle(Geom_Surface) aSurf = FS.Surface();
540 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
541 if(aMakeFace.IsDone()) {
542 TopoDS_Face aFace = aMakeFace.Face();
543 DBRep::Set(a[1],aFace);
546 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
551 // #include <MyCommandsCMD.h>
552 #include <ShapeFix_Shape.hxx>
553 #include <BRepOffset_MakeOffset.hxx>
554 #include <BRepOffsetAPI_MakeOffset.hxx>
555 #include <BRepOffset_Mode.hxx>
556 #include <GeomAbs_JoinType.hxx>
557 #include <AIS_Shape.hxx>
559 #include <BRepTools.hxx>
561 Standard_Integer OCC165(Draw_Interpretor& di ,
566 //=======================================================================
568 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
570 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
572 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
575 //=======================================================================
577 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
581 di <<"Usage : " << a[0] << " [file]"<<"\n";
586 #define _OFFSET_TELCO_
587 #ifdef _OFFSET_TELCO_
589 Standard_CString file = a[1];
591 BRep_Builder aBuilder;
592 TopoDS_Shape theShape;
593 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
594 BRepTools::Read(theShape, file, aBuilder);
595 DBRep::Set("shape", theShape);
597 TopoDS_Wire theWire = TopoDS::Wire(theShape);
599 Standard_Real anOffset = 1.5;
603 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
604 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
605 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
607 BRepBuilderAPI_MakePolygon theSquare;
608 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
610 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
612 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
614 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
618 TopoDS_Wire theWire = theSquare.Wire();
620 Standard_Real anOffset = 10;
623 #endif /* _OFFSET_TELCO_ */
626 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
627 DBRep::Set("face", theFace);
630 Standard_Real anAlt = 0.;
631 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
632 //GeomAbs_Intersection; //GeomAbs_Arc;
633 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
634 aMakeOffset.AddWire(theWire);
636 aMakeOffset.Perform(anOffset, anAlt);
638 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
639 DBRep::Set("offset", theOffsetShapePos);
644 #include<BRepAlgoAPI_Cut.hxx>
645 #include<BRepAlgo_Cut.hxx>
647 #include<BRepPrimAPI_MakeHalfSpace.hxx>
648 #include<Handle_Geom_CartesianPoint.hxx>
649 #include<Geom_CartesianPoint.hxx>
650 #include<AIS_Point.hxx>
652 #include <BRepBuilderAPI_MakeEdge.hxx>
653 #include <BRepBuilderAPI_MakeWire.hxx>
654 #include <BRepBuilderAPI_MakeFace.hxx>
656 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
660 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
661 if(myAISContext.IsNull()) {
662 di << "use 'vinit' command before " << argv[0] << "\n";
667 gp_Pnt pt1_(250.,250.,0.);
668 gp_Pnt pt2_(-250.,250.,0.);
669 gp_Pnt pt3_(-250.,-250.,0.);
670 gp_Pnt pt4_(250.,-250.,0.);
671 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
672 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
673 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
674 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
676 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
677 BRepBuilderAPI_MakeFace face_(wire_);
678 TopoDS_Face sh_ = face_.Face();
684 g_pnt = gp_Pnt(0,0,-100);
686 g_pnt = gp_Pnt(0,0,100);
688 myAISContext->EraseAll(Standard_False);
689 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
690 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
691 myAISContext->Display(AISPoint);
693 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
694 TopoDS_Solid sol1_ = half_.Solid();
695 // Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
696 // AISHalf->SetColor(Quantity_NOC_GREEN);
697 // myAISContext->Display(AISHalf);
699 DBRep::Set("Face",sol1_);
701 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
703 Standard_Real x=0., y=0., z=-80.;
705 BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
706 // Handle(AIS_Shape) AISBox = new AIS_Shape(box);
707 // AISBox->SetColor(Quantity_NOC_BLUE1);
708 // myAISContext->Display(AISBox);
710 DBRep::Set("Box",box.Shape());
712 // BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
713 // //BRepAlgoAPI_Cut cut( box.Shape(), sol1_ );
714 // TopoDS_Shape sh1_ = cut.Shape();
715 // Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
716 // AISCut->SetColor(Quantity_NOC_RED);
717 // myAISContext->Display(AISCut);
719 // DBRep::Set("Cut",sh1_);
724 #include<GProp_GProps.hxx>
725 #include<BRepGProp.hxx>
727 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
732 di <<"Usage : " << argv[0] << " file"<<"\n";
735 Standard_CString file = argv[1];
737 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
738 if(myAISContext.IsNull()) {
739 di << "use 'vinit' command before " << argv[0] << "\n";
744 BRep_Builder builder;
745 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
746 BRepTools::Read(sh, file, builder);
749 builder.MakeWire(wire);
751 TopoDS_Vertex vt1, vt2;
752 TopExp_Explorer wex(sh, TopAbs_EDGE);
753 for(;wex.More();wex.Next())
755 ed = TopoDS::Edge(wex.Current());
756 TopExp::Vertices(ed, vt1, vt2);
757 builder.UpdateVertex(vt1, 0.01);
758 builder.UpdateVertex(vt2, 0.01);
759 builder.UpdateEdge(ed, 0.01);
760 builder.Add(wire, ed);
764 BRepGProp::LinearProperties(ed, lprop);
765 printf("\n length = %f", lprop.Mass());
767 DBRep::Set("Wire",wire);
768 // Handle(AIS_Shape) res = new AIS_Shape( wire );
769 // aContext->SetColor( res, Quantity_NOC_RED );
770 // aContext->Display( res );
772 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
773 // off.Perform(0.5, 0);
775 // printf("\n IsDone = %d", off.IsDone());
777 // res = new AIS_Shape( sh );
778 // aContext->SetColor( res, Quantity_NOC_GREEN );
779 // aContext->Display( res );
785 static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
788 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
789 if(myAISContext.IsNull()) {
790 di << "use 'vinit' command before " << argv[0];
794 BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
795 Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
796 myAISContext->Display(anAISBox, 1);
797 anAISBox->SetSelectionMode(-1);
798 Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
799 myAISContext->CloseLocalContext(myLocContInd);
800 Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
807 #include <TDocStd_Document.hxx>
808 #include <DDocStd.hxx>
809 #include <PCDM_StoreStatus.hxx>
810 #include <TDocStd_Application.hxx>
812 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
815 di << "Usage: " << a[0] << " Doc" << "\n";
819 Handle(TDocStd_Document) D;
820 if (!DDocStd::GetDocument(a[1],D)) return 1;
822 Handle(TDocStd_Application) A;
823 if (!DDocStd::Find(A)) return 1;
825 TCollection_ExtendedString theStatusMessage;
827 di << "this document has never been saved" << "\n";
830 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
831 if (theStatus != PCDM_SS_OK ) {
832 switch ( theStatus ) {
833 case PCDM_SS_DriverFailure: {
834 di << " Could not store , no driver found to make it " <<"\n" ;
837 case PCDM_SS_WriteFailure: {
838 di << " Write access failure " << "\n" ;
841 case PCDM_SS_Failure: {
842 di << " Write failure " << "\n" ;
850 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
853 di << "Usage: " << a[0] << " Doc Path" << "\n";
857 Handle(TDocStd_Document) D;
858 if (!DDocStd::GetDocument(a[1],D)) return 1;
860 TCollection_ExtendedString path (a[2]);
861 Handle(TDocStd_Application) A;
862 if (!DDocStd::Find(A)) return 1;
864 TCollection_ExtendedString theStatusMessage;
865 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
866 if (theStatus != PCDM_SS_OK ) {
867 switch ( theStatus ) {
868 case PCDM_SS_DriverFailure: {
869 di << " Could not store , no driver found to make it " <<"\n" ;
872 case PCDM_SS_WriteFailure: {
873 di << " Write access failure " << "\n" ;
876 case PCDM_SS_Failure: {
877 di << " Write failure " << "\n" ;
886 #include <BRepClass3d_SolidClassifier.hxx>
888 Standard_Integer OCC299bug (Draw_Interpretor& di,
895 di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
899 TopoDS_Shape aS = DBRep::Get(a[1]);
901 Sprintf(sbf, " Null Shape is not allowed here\n");
906 if (aS.ShapeType()!=TopAbs_SOLID) {
907 Sprintf(sbf, " Shape type must be SOLID\n");
912 Standard_Real aTol=1.e-7;
913 TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
914 TopAbs_State aState = TopAbs_UNKNOWN;
915 gp_Pnt aP(8., 9., 10.);
917 if (!DrawTrSurf::GetPoint(a[2], aP) ) {
918 Sprintf(sbf, " Null Point is not allowed here\n");
925 aTol=Draw::Atof(a[3]);
928 BRepClass3d_SolidClassifier aSC(aS);
929 aSC.Perform(aP,aTol);
931 aState = aSC.State();
933 Sprintf(sbf, "The point is "); di<<sbf;
937 Sprintf(sbf, sIN.ToCString());
940 Sprintf(sbf, sOUT.ToCString());
943 Sprintf(sbf, sON.ToCString());
946 Sprintf(sbf, sUNKNOWN.ToCString());
949 Sprintf(sbf, sUNKNOWN.ToCString());
954 Sprintf(sbf, " shape\n");
960 #include <OSD_Process.hxx>
961 #include <OSD_Path.hxx>
963 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
966 di << "Usage: " << a[0] << "\n";
970 OSD_Path d = p.CurrentDirectory();
971 TCollection_AsciiString s;
973 di << "*" << s.ToCString() << "*" << "\n";
976 di << "*" << s.ToCString() << "*" <<"\n";
980 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
983 di << "Usage: " << a[0] << "\n";
986 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
987 di << p.Trek().ToCString() << "\n";
989 di << p.Trek().ToCString() << "\n";
993 #include <BRepAlgoAPI_Fuse.hxx>
994 #include <BRepAlgoAPI_Common.hxx>
995 #include <BRepAlgo_Fuse.hxx>
996 #include <BRepAlgo_Common.hxx>
998 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
1001 // cout << "Usage: " << a[0] << endl;
1004 if(nb < 1 || nb > 2) {
1005 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1008 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1010 Standard_Integer IsB = Draw::Atoi(a[1]);
1012 IsBRepAlgoAPI = Standard_False;
1016 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
1017 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
1019 TopoDS_Shape shape1 = box1.Shape();
1020 TopoDS_Shape shape2 = box2.Shape();
1022 //#if ! defined(BRepAlgoAPI_def01)
1023 // TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1024 // TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
1026 // TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
1027 // TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
1029 TopoDS_Shape fuse,comm;
1030 if (IsBRepAlgoAPI) {
1031 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
1032 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
1033 fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1034 comm = BRepAlgoAPI_Common( shape1, shape2 );
1036 di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
1037 fuse = BRepAlgo_Fuse( shape1, shape2 );
1038 di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
1039 comm = BRepAlgo_Common( shape1, shape2 );
1045 #include <ShapeAnalysis_Edge.hxx>
1047 static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
1051 di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
1054 TopoDS_Shape Sh1 = DBRep::Get(a[1]);
1055 TopoDS_Shape Sh2 = DBRep::Get(a[2]);
1056 if(Sh1.IsNull() || Sh2.IsNull()) {
1058 di<<"Invalid arguments"<<"\n";
1061 TopoDS_Edge e1 = TopoDS::Edge(Sh1);
1062 TopoDS_Edge e2 = TopoDS::Edge(Sh2);
1063 if(e1.IsNull() || e2.IsNull()) {
1065 di<<"Invalid type of arguments"<<"\n";
1068 Standard_Real aTol = Precision::Confusion();
1069 Standard_Real aDistDomain = 0.0;
1070 Standard_Integer k = 3;
1072 aTol = Draw::Atof(a[k++]);
1074 aDistDomain = Draw::Atof(a[k++]);
1076 ShapeAnalysis_Edge sae;
1077 if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
1078 if(aDistDomain ==0.0) {
1080 di<<"Edges is overlaping comletly"<<"\n";
1083 di<<"Edges is overlaped"<<"\n";
1084 di<<"with tolerance = "<<aTol<<"\n";
1085 di<<"on segment length = "<<aDistDomain<<"\n";
1089 di<<"Edges is not overlaped"<<"\n";
1095 #include <DDocStd_DrawDocument.hxx>
1096 #include <TDataStd_Name.hxx>
1098 #include <XCAFDoc_ShapeTool.hxx>
1099 #include <XCAFDoc_DocumentTool.hxx>
1100 #include <TDF_LabelSequence.hxx>
1101 #include <TPrsStd_AISPresentation.hxx>
1102 #include <TDF_Data.hxx>
1103 #include <TDF_Label.hxx>
1104 #include <XCAFPrs_Driver.hxx>
1106 //------------------------------------------------------------------------------------------
1109 //------------------------------------------------------------------------------------------
1110 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1115 // 1. Verufy amount of arguments
1116 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
1118 // 2. Retrieve DDocStd application
1119 Handle(TDocStd_Application) App;
1120 if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
1123 TCollection_ExtendedString name(argv[2]);
1124 Handle(TDocStd_Document) Doc;
1125 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
1126 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
1127 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
1128 Draw::Set(argv[1],DD);
1130 // 4. Create prsentations
1131 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1132 TDF_LabelSequence seq;
1133 shapes->GetFreeShapes ( seq );
1134 Handle(TPrsStd_AISPresentation) prs;
1135 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
1136 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
1137 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
1139 catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
1141 di << "OCC363 OK\n";
1146 ////======================================================================================
1147 //// Function : OCC372
1149 ////======================================================================================
1150 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1154 // OCC_CATCH_SIGNALS
1155 // // 1. Verufy amount of arguments
1156 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
1160 // TopoDS_Shape Ref;
1161 // BRepTools::Read(Ref, argv[1], B);
1163 // // 3. Calculate location of aP3d in relation to the solid
1164 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
1165 // BRepClass3d_SolidClassifier SC(Ref);
1166 // SC.Perform(aP3d, 1e-7);
1168 // // 4. Check returned state. The point must be inside the solid.
1169 // TopAbs_State aState=SC.State();
1173 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
1176 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
1179 // di<<"OCC372 OK. aState = TopAbs_IN" ;
1182 // di<<"OCC372 FAULTY. aState = UNKNOWN";
1186 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
1191 #include <BRepTopAdaptor_FClass2d.hxx>
1193 //======================================================================================
1194 // Function : OCC377
1196 //======================================================================================
1197 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1202 // 1. Verify validity of arguments
1203 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
1205 // 2. Initialize parameters
1207 p2d.SetX ( Draw::Atof(argv[2]) );
1208 p2d.SetY ( Draw::Atof(argv[3]) );
1209 Standard_Real precuv = Draw::Atof (argv[4] );
1214 BRepTools::Read ( Shape, argv[1], B );
1216 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1217 TopExp_Explorer exp;
1218 Standard_Integer i=1;
1219 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1221 // 4.1. Verify whether enrtry point is on wire
1222 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1223 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1225 TopAbs_Orientation orWire = wir.Orientation();
1226 newFace.Orientation(TopAbs_FORWARD);
1229 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1230 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1231 //di << "Wire " << i << ": Infinite point is " <<
1232 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1234 TCollection_AsciiString TmpString;
1235 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1236 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1238 stat1 = FClass2d1.Perform(p2d);
1239 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1240 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1243 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1244 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1246 // 4.2. Verify whether enrtry point is on reversed wire
1247 newFace = TopoDS::Face(Shape.EmptyCopied());
1248 newFace.Orientation(TopAbs_FORWARD);
1249 orWire = TopAbs::Reverse(orWire);
1250 B.Add(newFace,wir.Oriented(orWire));
1251 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1252 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1253 //di << "Reversed Wire " << i << ": Infinite point is " <<
1254 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1257 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1258 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1260 stat2 = FClass2d2.Perform(p2d);
1261 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1262 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1265 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1266 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1268 // 4.3. Compare results (they must be same)
1269 if(stat1 ==stat2) di << "OCC377 OK" << "\n";
1270 else {di << "OCC377 FAULTY" << "\n"; return 0;}
1273 catch(Standard_Failure)
1275 di << "OCC377 Exception";
1281 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1282 #include <ShapeBuild_ReShape.hxx>
1284 //=======================================================================
1287 //=======================================================================
1288 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1293 // 1. Verify arguments of the command
1294 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1296 Standard_Boolean aConsiderLocation;
1297 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1298 else aConsiderLocation = Standard_True;
1300 // 2. Iniitialize aShapeUpgrade
1301 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1303 aShapeUpgrade.SetPrecision (Precision::Confusion());
1305 aShapeUpgrade.SetMaxTolerance(0.1);
1306 // subshapes to be divided
1307 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1308 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1309 aShapeUpgrade.Init(aSubShapesToBeDivided);
1311 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1312 aShapeUpgrade.SetContext(aReshape);
1313 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1315 // 3. Perform splitting
1316 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1317 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1318 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1320 // 4. Perform rebuilding shape
1321 // 4.1. Retrieve Shape
1322 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1323 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1324 // 4.2 Rebuid retrieved shape
1325 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1326 // 4.3. Create result Draw shape
1327 DBRep::Set(argv[1], aResultShape);
1329 catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
1335 #include <ShapeProcess_OperLibrary.hxx>
1336 #include <ShapeProcess_ShapeContext.hxx>
1337 #include <ShapeProcess.hxx>
1339 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1340 #include <BRepMesh_IncrementalMesh.hxx>
1342 //=======================================================================
1345 //=======================================================================
1346 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1351 // 1. Verify amount of arguments of the command
1352 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1354 // 2. Retrieve parameters
1356 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1357 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1358 // compound of subshapes
1359 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1360 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1361 // name of resource file
1362 const char* aResourceFile = argv[4];
1363 // name of sequence from resource file to be executed
1364 const char* aSequenceName = argv[5];
1366 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1367 ShapeProcess_OperLibrary::Init();
1368 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1369 aShapeContext->SetDetalisation (TopAbs_EDGE);
1370 ShapeProcess::Perform (aShapeContext, aSequenceName);
1372 // 4. Rebuild initil shape in accordance with performed operation
1373 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1374 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1375 for (; anIter.More(); anIter.Next())
1376 aReshape->Replace(anIter.Key(), anIter.Value());
1377 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1379 // 5 Create resultant Draw shape
1380 DBRep::Set(argv[1], aResultShape);
1383 catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
1388 //=======================================================================
1390 //purpose : Verify whether exception occurs during building mesh
1391 //=======================================================================
1392 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1397 // 1. Verify amount of arguments of the command
1398 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1400 // 2. Retrieve shape
1401 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1402 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1405 BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
1408 catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
1410 di << "OCC369 OK \n";
1414 #include <math_Vector.hxx>
1415 #include <math_Matrix.hxx>
1416 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1419 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1422 Standard_Integer LowerVector = Draw::Atoi(argv[1]);
1423 Standard_Integer UpperVector = Draw::Atoi(argv[2]);
1424 Standard_Real InitialValueVector = Draw::Atof(argv[3]);
1425 Standard_Integer LowerRowMatrix = Draw::Atoi(argv[4]);
1426 Standard_Integer UpperRowMatrix = Draw::Atoi(argv[5]);
1427 Standard_Integer LowerColMatrix = Draw::Atoi(argv[6]);
1428 Standard_Integer UpperColMatrix = Draw::Atoi(argv[7]);
1429 Standard_Real InitialValueMatrix = Draw::Atof(argv[8]);
1431 math_Vector Vector1(LowerVector, UpperVector);
1432 math_Vector Vector2(LowerVector, UpperVector);
1434 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1435 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1437 //Vector.Dump(cout);
1440 //Matrix.Dump(cout);
1443 Vector1.Multiply(Vector, Matrix);
1445 //Vector1.Dump(cout);
1446 Standard_SStream aSStream1;
1447 Vector1.Dump(aSStream1);
1451 Vector2.TMultiply(Vector, Matrix);
1453 //Vector2.Dump(cout);
1454 Standard_SStream aSStream2;
1455 Vector2.Dump(aSStream2);
1462 #include <GeomPlate_BuildPlateSurface.hxx>
1463 //=======================================================================
1466 //=======================================================================
1467 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1472 GeomPlate_BuildPlateSurface aBuilder;
1475 catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
1476 //catch (...) { di << "OCC525 Exception \n" ;return 0; }
1478 di << "OCC525 OK \n";
1482 #include <BRepPrimAPI_MakeWedge.hxx>
1483 #include <gce_MakeRotation.hxx>
1484 #include <gce_MakeTranslation.hxx>
1485 #include <BRepBuilderAPI_Transform.hxx>
1486 #include <BRepPrimAPI_MakeWedge.hxx>
1487 #include <BRepAlgoAPI_Fuse.hxx>
1488 #include <BRepAlgoAPI_Cut.hxx>
1489 #include <BRepAlgo_Fuse.hxx>
1490 #include <BRepAlgo_Cut.hxx>
1491 //=======================================================================
1494 //=======================================================================
1495 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1498 // di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
1501 if(argc < 4 || argc > 5) {
1502 di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1505 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1507 Standard_Integer IsB = Draw::Atoi(argv[4]);
1509 IsBRepAlgoAPI = Standard_False;
1510 // di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1512 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
1518 double xperiod = 1.0;
1519 double yperiod = 1.0;
1520 double sub_thick = 0.5;
1523 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1524 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1526 // --------------------------------------------------------------------
1529 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1530 // 0.1, 0.1 , 0.4, 0.4 );
1531 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1532 0.1, 0.1 , 0.4, 0.4 ).Shape();
1534 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1535 gp_Dir(1.0,0.0,0.0),
1538 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1539 gp_Pnt( 0.25, 0.25, 0.5)
1542 rotate.PreMultiply( translate );
1544 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1546 if (wedge1a.IsNull()) {
1547 di<<" Null shape1 is not allowed\n";
1550 DBRep::Set(argv[1], wedge1a);
1552 // --------------------------------------------------------------------
1555 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1556 // 0.1, 0.1 , 0.4, 0.4 );
1557 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1558 0.1, 0.1 , 0.4, 0.4 ).Shape();
1560 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1561 gp_Dir(1.0,0.0,0.0),
1564 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1565 gp_Pnt( 0.25, 0.25, 0.5)
1568 rotate2.PreMultiply( translate2 );
1570 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1572 if (wedge2a.IsNull()) {
1573 di<<" Null shape2 is not allowed\n";
1576 DBRep::Set(argv[2], wedge2a);
1580 //#if ! defined(BRepAlgoAPI_def01)
1581 // TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1583 // TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1585 TopoDS_Shape wedge_common;
1586 if (IsBRepAlgoAPI) {
1587 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
1588 wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1590 di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
1591 wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1594 // remove wedge area from substrate
1595 //#if ! defined(BRepAlgoAPI_def01)
1596 // TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1598 // TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1600 TopoDS_Shape sub_etch1;
1601 if (IsBRepAlgoAPI) {
1602 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
1603 sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1605 di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
1606 sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1609 if (sub_etch1.IsNull()) {
1610 di<<" Null shape3 is not allowed\n";
1613 DBRep::Set(argv[3], sub_etch1);
1618 #include <Standard_GUID.hxx>
1619 //=======================================================================
1622 //=======================================================================
1623 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1626 di<<"Usage : " << argv[0] << " GUID\n";
1629 Standard_GUID guid(argv[1]);
1630 //guid.ShallowDump(cout);
1631 Standard_SStream aSStream;
1632 guid.ShallowDump(aSStream);
1638 #include <XCAFDoc.hxx>
1639 //=======================================================================
1640 //function : OCC738_ShapeRef
1642 //=======================================================================
1643 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1646 di<<"Usage : " << argv[0] << "\n";
1649 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1650 //guid.ShallowDump(cout);
1651 Standard_SStream aSStream;
1652 guid.ShallowDump(aSStream);
1657 //=======================================================================
1658 //function : OCC738_Assembly
1660 //=======================================================================
1661 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1664 di<<"Usage : " << argv[0] << "\n";
1667 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1668 //guid.ShallowDump(cout);
1669 Standard_SStream aSStream;
1670 guid.ShallowDump(aSStream);
1675 #if defined(DDataStd_def01)
1676 #include <DDataStd_DrawPresentation.hxx>
1677 //=======================================================================
1678 //function : OCC739_DrawPresentation
1680 //=======================================================================
1681 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1684 di<<"Usage : " << argv[0] << "\n";
1687 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1688 //guid.ShallowDump(cout);
1689 Standard_SStream aSStream;
1690 guid.ShallowDump(aSStream);
1696 //=======================================================================
1699 //=======================================================================
1700 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1702 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1703 if(aContext.IsNull()) {
1704 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
1709 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
1713 Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
1715 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1717 TCollection_AsciiString aName(argv[1]);
1718 Handle(AIS_InteractiveObject) AISObj;
1720 if(!aMap.IsBound2(aName)) {
1721 di << "Use 'vdisplay' before" << "\n";
1724 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
1725 if(AISObj.IsNull()){
1726 di << argv[1] << " : No interactive object" << "\n";
1729 AISObj->UnsetTransformation();
1730 if (!aContext->HasOpenedContext()) {
1731 aContext->OpenLocalContext();
1733 aContext->Erase(AISObj, updateviewer, PutInCollector);
1734 aContext->UpdateCurrentViewer();
1735 aContext->Display(AISObj, updateviewer);
1736 aContext->UpdateCurrentViewer();
1741 //=======================================================================
1744 //=======================================================================
1745 #include <TColStd_Array2OfInteger.hxx>
1746 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1749 di<<"Usage : " << argv[0] << "\n";
1752 TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
1753 Array2OfInteger.SetValue(5,5,55);
1757 #include <GeomAPI_ProjectPointOnSurf.hxx>
1758 //=======================================================================
1761 //=======================================================================
1762 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1766 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1771 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1772 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1773 Standard_Real Umin=Draw::Atof(argv[3]);
1774 Standard_Real Usup=Draw::Atof(argv[4]);
1775 Standard_Real Vmin=Draw::Atof(argv[5]);
1776 Standard_Real Vsup=Draw::Atof(argv[6]);
1778 if (aSurface.IsNull()) {
1779 di << argv[2] << " Null surface \n" ;
1783 GeomAPI_ProjectPointOnSurf PonSurf;
1784 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1785 PonSurf.Perform(aPoint3d);
1790 //=======================================================================
1793 //=======================================================================
1794 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1798 di<<"Usage : " << argv[0] << " wire face\n";
1802 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1803 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1804 if (awire.IsNull() || aface.IsNull()) {
1805 di << "Null object" << "\n";
1809 Standard_Integer count = 0;
1810 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1812 BRepTools_WireExplorer WE;
1813 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1814 TopoDS_Edge E = WE.Current();
1818 di << "Count = " << count << "\n";
1823 //=======================================================================
1826 //=======================================================================
1827 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1831 di <<"Usage : " << argv[0] << " face"<<"\n";
1834 Standard_Real u1, u2, v1, v2;
1835 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1838 BRepTools::UVBounds(F, u1, u2, v1, v2);
1839 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1843 #include <Expr_NamedUnknown.hxx>
1844 #include <Expr_GeneralExpression.hxx>
1845 #include <Expr_Exponential.hxx>
1846 //=======================================================================
1849 //=======================================================================
1850 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1854 di <<"Usage : " << argv[0] << " expression"<<"\n";
1858 TCollection_AsciiString myStr(argv[1]);
1860 Handle (Expr_NamedUnknown) myNamed = new Expr_NamedUnknown(myStr);
1861 Handle (Expr_Exponential) oldExpr = new Expr_Exponential(myNamed);
1862 Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
1865 TCollection_AsciiString res = newExpr->String();
1866 Standard_CString resStr = res.ToCString();
1867 TCollection_AsciiString res_old = oldExpr->String();
1868 Standard_CString res_oldStr = res_old.ToCString();
1871 di << "X = " << argv[1] << "\n";
1872 di << "Y = " << res_oldStr << "\n";
1873 di << "Y' = " << resStr << "\n";
1879 #include <TPrsStd_AISViewer.hxx>
1880 #include <TDF_Label.hxx>
1881 #include <TPrsStd_AISPresentation.hxx>
1882 //=======================================================================
1883 //function : OCC1029_AISTransparency
1884 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1885 //=======================================================================
1887 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1888 Standard_Integer nb,
1892 Handle(TDocStd_Document) D;
1893 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1895 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1897 Handle(TPrsStd_AISViewer) viewer;
1898 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1900 Handle(TPrsStd_AISPresentation) prs;
1901 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1903 prs->SetTransparency(Draw::Atof(arg[3]));
1904 TPrsStd_AISViewer::Update(L);
1907 di << "Transparency = " << prs->Transparency() << "\n";
1912 di << arg[0] << " : Error" << "\n";
1916 //=======================================================================
1917 //function : OCC1030_AISColor
1918 //purpose : OCC1030_AISColor (DOC,entry,[color])
1919 //=======================================================================
1921 static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
1922 Standard_Integer nb,
1926 Handle(TDocStd_Document) D;
1927 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1929 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1931 Handle(TPrsStd_AISViewer) viewer;
1932 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1934 Handle(TPrsStd_AISPresentation) prs;
1935 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1937 prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3]));
1938 TPrsStd_AISViewer::Update(L);
1941 di << "Color = " << prs->Color() << "\n";
1945 di << arg[0] << " : Error" << "\n";
1949 //=======================================================================
1950 //function : OCC1031_AISMaterial
1951 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
1952 //=======================================================================
1954 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
1955 Standard_Integer nb,
1959 Handle(TDocStd_Document) D;
1960 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1962 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1964 Handle(TPrsStd_AISViewer) viewer;
1965 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1967 Handle(TPrsStd_AISPresentation) prs;
1968 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1970 prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3]));
1971 TPrsStd_AISViewer::Update(L);
1974 di << "Material = " << prs->Material() << "\n";
1979 di << arg[0] << " : Error" << "\n";
1983 //=======================================================================
1984 //function : OCC1032_AISWidth
1985 //purpose : OCC1032_AISWidth (DOC,entry,[width])
1986 //=======================================================================
1988 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
1989 Standard_Integer nb,
1993 Handle(TDocStd_Document) D;
1994 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1996 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1998 Handle(TPrsStd_AISViewer) viewer;
1999 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2001 Handle(TPrsStd_AISPresentation) prs;
2002 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2004 prs->SetWidth(Draw::Atof(arg[3]));
2005 TPrsStd_AISViewer::Update(L);
2008 di << "Width = " << prs->Width() << "\n";
2013 di << arg[0] << " : Error" << "\n";
2017 //=======================================================================
2018 //function : OCC1033_AISMode
2019 //purpose : OCC1033_AISMode (DOC,entry,[mode])
2020 //=======================================================================
2022 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
2023 Standard_Integer nb,
2027 Handle(TDocStd_Document) D;
2028 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2030 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2032 Handle(TPrsStd_AISViewer) viewer;
2033 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2035 Handle(TPrsStd_AISPresentation) prs;
2036 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2038 prs->SetMode(Draw::Atoi(arg[3]));
2039 TPrsStd_AISViewer::Update(L);
2042 di << "Mode = " << prs->Mode() << "\n";
2047 di << arg[0] << " : Error" << "\n";
2051 //=======================================================================
2052 //function : OCC1034_AISSelectionMode
2053 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
2054 //=======================================================================
2056 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
2057 Standard_Integer nb,
2061 Handle(TDocStd_Document) D;
2062 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2064 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2066 Handle(TPrsStd_AISViewer) viewer;
2067 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2069 Handle(TPrsStd_AISPresentation) prs;
2070 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2072 prs->SetSelectionMode(Draw::Atoi(arg[3]));
2073 TPrsStd_AISViewer::Update(L);
2076 di << "SelectionMode = " << prs->SelectionMode() << "\n";
2081 di << arg[0] << " : Error" << "\n";
2085 #include<BRepAlgoAPI_Cut.hxx>
2086 #include<BRepAlgo_Cut.hxx>
2087 //=======================================================================
2088 //function : OCC1487
2090 //=======================================================================
2091 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2094 // cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
2097 if(argc < 5 || argc > 6) {
2098 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
2101 Standard_Boolean IsBRepAlgoAPI = Standard_True;
2103 Standard_Integer IsB = Draw::Atoi(argv[5]);
2105 IsBRepAlgoAPI = Standard_False;
2106 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
2111 Standard_Integer CaseNumber = Draw::Atoi(argv[1]);
2113 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
2114 gp_Dir myDir(1,0,0);
2115 gp_Pnt myPnt(0,-50,140);
2116 gp_Ax2 myAx2(myPnt, myDir);
2117 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
2119 TopoDS_Shape cyl1 = o_mc1.Shape();
2122 TopoDS_Shape o_cut_shape;
2123 if (CaseNumber == 1) {
2124 //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);
2125 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
2126 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
2127 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2128 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2130 cyl2 = o_mc2.Shape();
2131 //#if ! defined(BRepAlgoAPI_def01)
2132 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2134 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2136 if (IsBRepAlgoAPI) {
2137 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2138 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2140 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2141 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2144 //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);
2145 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
2146 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
2147 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2148 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2150 cyl2 = o_mc2.Shape();
2151 //#if ! defined(BRepAlgoAPI_def01)
2152 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2154 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2156 if (IsBRepAlgoAPI) {
2157 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2158 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2160 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2161 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2165 DBRep::Set(argv[2],cyl1);
2166 DBRep::Set(argv[3],cyl2);
2167 DBRep::Set(argv[4],o_cut_shape);
2172 #include<TopTools_ListIteratorOfListOfShape.hxx>
2173 #include<BRepFilletAPI_MakeFillet.hxx>
2174 //=======================================================================
2175 //function : OCC1077
2177 //=======================================================================
2178 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
2180 Standard_Real t3d = 1.e-4;
2181 Standard_Real t2d = 1.e-5;
2182 Standard_Real ta = 1.e-2;
2183 Standard_Real fl = 1.e-3;
2184 Standard_Real tapp_angle = 1.e-2;
2185 GeomAbs_Shape blend_cont = GeomAbs_C1;
2187 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
2190 // Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
2192 TopTools_ListIteratorOfListOfShape its;
2194 TopoDS_Compound result;
2196 B.MakeCompound(result);
2199 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
2201 const TopoDS_Shape& cutsol = ex.Current();
2203 BRepFilletAPI_MakeFillet fill(cutsol);
2204 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
2205 fill.SetContinuity(blend_cont, tapp_angle);
2207 // its = build->Section();
2209 its = aBoolenaOperation.SectionEdges();
2213 TopoDS_Edge E = TopoDS::Edge(its.Value());
2214 fill.Add(aRadius, E);
2221 B.Add(result, fill.Shape());
2225 B.Add(result, cutsol);
2231 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
2233 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
2234 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
2235 return OCC1077_boolbl(aCut,aRadius);
2238 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
2240 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
2243 TopoDS_Shape OCC1077_Bug()
2245 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
2246 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
2248 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
2249 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
2250 gp_Dir(0, 0, 1)), 3, 20).Shape();
2251 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
2252 gp_Dir(1, 0, 0)), 3, 20).Shape();
2253 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
2254 gp_Dir(0, 1, 0)), 3, 20).Shape();
2255 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
2256 Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
2258 theTmp1 = fixer->Shape();
2259 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
2260 fixer->Init(theTmp2);
2262 theTmp2 = fixer->Shape();
2263 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
2264 fixer->Init(theResult);
2266 theResult = fixer->Shape();
2270 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2272 if(argc < 1 || argc > 2) {
2273 di << "Usage : " << argv[0] << " result" << "\n";
2277 TopoDS_Shape S = OCC1077_Bug();
2278 DBRep::Set(argv[1],S);
2283 //////////////////////////////////////////////////////////////
2285 * Compute uniform distribution of points using GCPnts_UniformAbscissa
2287 //////////////////////////////////////////////////////////////
2288 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2292 di << "Usage : " << argv[0] << " name shape step" << "\n";
2295 const char *name = argv[1];
2296 Adaptor3d_Curve *adapCurve=NULL;
2297 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
2298 if (!curve.IsNull())
2299 adapCurve = new GeomAdaptor_Curve(curve);
2302 TopoDS_Shape wire = DBRep::Get(argv[2]);
2303 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2305 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
2308 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2310 double step = Draw::Atof(argv[3]);
2311 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2315 di << argv[0] <<" : fail"<<"\n";
2320 int i, np = aUni.NbPoints();
2321 for (i=0; i < np; i++)
2323 double par = aUni.Parameter(i+1);
2324 gp_Pnt p = adapCurve->Value(par);
2325 char n[20], *pname=n;
2326 Sprintf(n,"%s_%d",name,i+1);
2327 DrawTrSurf::Set(pname,p);
2336 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2340 di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
2344 Standard_Integer nb = Draw::Atoi(argv[1]);
2345 Standard_Integer sz = Draw::Atoi(argv[2]);
2346 Standard_Real val = 10;
2347 math_Vector **pv = new math_Vector *[nb];
2349 di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
2351 for (i=0; i < nb; i++) {
2352 pv[i] = new math_Vector (1, sz, val);
2353 if ((i % (nb/10)) == 0) {
2360 di<<"deleting them ..."<<"\n";
2361 for (i=0; i < nb; i++) {
2363 if ((i % (nb/10)) == 0) {
2376 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2380 di << "Usage : " << argv[0] << " wire" << "\n";
2383 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2386 TopoDS_Wire wire = TopoDS::Wire(shape);
2387 // create curve parameterised by curvilinear distance
2388 BRepAdaptor_CompCurve curve(wire,Standard_True);
2389 Standard_Real length = curve.LastParameter();
2390 Standard_Real need_length = length/2;
2392 curve.D0(need_length,pnt);
2393 // create check_curve parameterised in a general way
2394 BRepAdaptor_CompCurve check_curve(wire);
2395 Standard_Real check_par =
2396 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2398 check_curve.D0(check_par,check_pnt);
2399 // check that points are coinsiding
2400 Standard_Real error_dist = pnt.Distance(check_pnt);
2401 if (error_dist > Precision::Confusion()) {
2402 //cout.precision(3);
2403 di<<"error_dist = "<<error_dist<<
2404 " ( "<<error_dist/need_length*100<<" %)"<<"\n";
2411 static char sarr[2000];
2413 static int StackOverflow(int i = -1)
2418 memcpy(arr,sarr,2000);
2420 int n = strlen(arr), s=0;
2422 s += StackOverflow(i-1);
2423 return i + s + StackOverflow(i-1);
2426 return i + StackOverflow(i-1);
2433 // this code does not work with optimize mode on Windows
2434 #pragma optimize( "", off )
2436 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2440 di << "Usage : " << argv[0] << "\n";
2443 Standard_Boolean Succes;
2445 Succes = Standard_True;
2448 {//==== Test Divide ByZero (Integer) ========================================
2451 di << "(Integer) Divide By Zero...";
2454 Standard_Integer res, a =4, b = 0 ;
2456 di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n";
2457 Succes = Standard_False;
2459 #if defined(SOLARIS) || defined(WNT)
2460 catch(Standard_DivideByZero)
2462 catch(Standard_NumericError)
2467 catch(Standard_Failure) {
2468 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2470 di << Standard_Failure::Caught()->GetMessageString();
2471 di << ")... KO" << "\n";
2472 Succes = Standard_False;
2474 #ifndef NO_CXX_EXCEPTION
2475 // this case tests if (...) supersedes (Standard_*),
2476 // the normal behaviour is not
2478 di<<" unknown exception... (But) Ok"<<"\n";
2483 {//==== Test Divide ByZero (Real) ===========================================
2486 di << "(Real) Divide By Zero...";
2489 Standard_Real res, a= 4.0, b=0.0;
2491 di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n";
2492 Succes = Standard_False;
2494 #if defined(SOLARIS) || defined(WNT)
2495 catch(Standard_DivideByZero)
2497 catch(Standard_NumericError)
2502 catch(Standard_Failure) {
2503 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2505 di << Standard_Failure::Caught()->GetMessageString();
2506 di << ")... KO" << "\n";
2507 Succes = Standard_False;
2511 {//==== Test Overflow (Integer) =============================================
2514 di << "(Integer) Overflow...";
2517 Standard_Integer res, i=IntegerLast();
2519 //++++ cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< endl;
2520 //++++ Succes = Standard_False;
2521 di << " "<<res<<"="<<i<<"+1 Does not Caught... (But) Ok"<< "\n";
2523 catch(Standard_Overflow) {
2526 catch(Standard_Failure) {
2527 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2529 di << Standard_Failure::Caught()->GetMessageString();
2530 di << ")... KO" << "\n";
2531 Succes = Standard_False;
2535 {//==== Test Overflow (Real) ================================================
2538 di << "(Real) Overflow...";
2541 Standard_Real res, r=RealLast();
2544 sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2546 di << "-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<< "\n";
2547 Succes = Standard_False;
2549 #if defined(SOLARIS) || defined(WNT)
2550 catch(Standard_Overflow)
2552 catch(Standard_NumericError)
2557 catch(Standard_Failure) {
2558 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2560 di << Standard_Failure::Caught()->GetMessageString();
2561 di << ")... KO" << "\n";
2562 Succes = Standard_False;
2566 {//==== Test Underflow (Real) ===============================================
2569 di << "(Real) Underflow";
2572 Standard_Real res, r=1.0e-308;
2575 //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<endl;
2576 //++++ Succes = Standard_False;
2577 di<<" -- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... (But) Ok"<<"\n";
2579 #if defined(SOLARIS) || defined(WNT)
2580 catch(Standard_Underflow)
2582 catch(Standard_NumericError)
2587 catch(Standard_Failure) {
2588 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2590 di << Standard_Failure::Caught()->GetMessageString();
2591 di << ")... KO" << "\n";
2592 Succes = Standard_False;
2596 {//==== Test Invalid Operation (Real) ===============================================
2599 di << "(Real) Invalid Operation...";
2602 Standard_Real res, r=-1;
2604 di<<" "<<res<<"=sqrt("<<r<<") Does not Caught... KO"<<"\n";
2605 Succes = Standard_False;
2607 catch(Standard_NumericError) {
2610 catch(Standard_Failure) {
2611 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2613 di << Standard_Failure::Caught()->GetMessageString();
2614 di << ")... KO" << "\n";
2615 Succes = Standard_False;
2619 {//==== Test Access Violation ===============================================
2622 di << "Segmentation Fault...";
2627 di << " Does not Caught... KO"<<"\n";
2628 Succes = Standard_False;
2631 catch(OSD_Exception_ACCESS_VIOLATION)
2637 } catch(Standard_Failure) {
2638 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2640 di << Standard_Failure::Caught()->GetMessageString();
2641 di << ")... KO" << "\n";
2642 Succes = Standard_False;
2647 {//==== Test Stack Overflow ===============================================
2650 di << "Stack Overflow...";
2654 di << " Does not Caught... KO"<<"\n";
2655 Succes = Standard_False;
2657 catch(OSD_Exception_STACK_OVERFLOW) {
2660 catch(Standard_Failure) {
2661 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2663 di << Standard_Failure::Caught()->GetMessageString();
2664 di << ")... KO" << "\n";
2665 Succes = Standard_False;
2671 di << "TestExcept: Successfull completion" << "\n";
2673 di << "TestExcept: failure" << "\n";
2679 #pragma optimize( "", on )
2682 static TopoDS_Compound AddTestStructure(int nCount_)
2688 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2689 for (int i=0; i<nCount; i++) {
2690 for (int j=0; j<nCount; j++) {
2692 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2693 TopLoc_Location topLoc(trsf);
2694 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2695 B.Add(C, tempShape);
2701 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2707 di << "Usage : " << argv[0] << " [nCount] path" << "\n";
2712 nCount = Draw::Atoi(argv[1]);
2713 TCollection_AsciiString aFilePath = argv[2];
2714 STEPCAFControl_Writer writer;
2715 Handle_TDocStd_Document document;
2716 document = new TDocStd_Document("Pace Test-StepExporter-");
2717 Handle_XCAFDoc_ShapeTool shapeTool;
2718 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2719 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2720 STEPControl_StepModelType mode = STEPControl_AsIs;
2721 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2722 di << "Failed to set assembly mode for step data\n" << "\n";
2727 if( writer.Transfer(document, mode)) {
2728 IFSelect_ReturnStatus stat =
2729 writer.Write(aFilePath.ToCString());
2732 catch(OSD_Exception_STACK_OVERFLOW) {
2733 di << "Failed : STACK OVERFLOW\n" << "\n";
2735 catch (Standard_Failure) {
2736 di << "Failed :\n" << "\n";
2737 //cout << Standard_Failure::Caught() << endl;
2738 di << Standard_Failure::Caught()->GetMessageString();
2740 di << argv[0] << " : Finish" << "\n";
2742 if( remove("TestExportStructure.step") != 0 ) {
2743 perror( "Error deleting file" );
2749 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2753 di << "Usage : " << argv[0] << "\n";
2757 // 1. Create an array of points
2758 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2759 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2760 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2761 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2762 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2763 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2765 // 2. Create a periodic bspline through these 5 points
2766 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2768 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2770 // 3. Increase degree of curve from 3 to 8
2771 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2772 Standard_CString CString1 = "BSplineCurve";
2773 DrawTrSurf::Set(CString1,bspline1);
2775 // 4. Convers BSpline curve to Bezier segments
2776 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2778 // 5. Test the result of conversion
2779 TCollection_AsciiString aRName;
2780 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2781 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2783 aRName=aRName+TCollection_AsciiString(i);
2784 Standard_CString aRNameStr = aRName.ToCString();
2785 DrawTrSurf::Set(aRNameStr,arc);
2786 di << aRNameStr << " ";
2792 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2796 di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
2799 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2800 if (theEdge1.IsNull()) {
2801 di << "Invalid input shape " << argv[1] << "\n";
2804 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2805 if (theEdge2.IsNull()) {
2806 di << "Invalid input shape " << argv[2] << "\n";
2809 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2810 if (theFace.IsNull()) {
2811 di << "Invalid input shape " << argv[3] << "\n";
2815 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2817 Standard_Real aConfusion = Precision::Confusion();
2818 Standard_Real aP1first, aP1last, aP2first, aP2last;
2820 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2821 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2822 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2823 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2825 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2827 Standard_Integer NbPoints = anInter.NbPoints();
2829 di << "NbPoints = " << NbPoints << "\n" ;
2833 for (i=1; i<=NbPoints; i++) {
2834 gp_Pnt2d aPi = anInter.Point(i);
2835 di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2839 Standard_Integer NbSegments = anInter.NbSegments();
2841 di << "\nNbSegments = " << NbSegments << "\n" ;
2843 if (NbSegments > 0) {
2844 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2846 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2847 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2849 Standard_Real aDist = aP1.Distance(aP2);
2851 di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
2852 di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
2854 di << "Distance = " << aDist << "\n" ;
2856 di << "Confusion = " << aConfusion << "\n" ;
2858 if (aDist > aConfusion) {
2859 di << "\n" << argv[0] << " Faulty" << "\n" ;
2861 di << "\n" << argv[0] << " OK" << "\n" ;
2864 di << "\n" << argv[0] << " OK" << "\n" ;
2869 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2873 di << "Usage : " << argv[0] << " lower upper" << "\n";
2877 Standard_Integer LOWER = Draw::Atoi(argv[1]);
2878 Standard_Integer UPPER = Draw::Atoi(argv[2]);
2880 //! 0. Create an empty document with several test labels
2881 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2882 doc->SetUndoLimit(100);
2883 TDF_Label main_label = doc->Main();
2884 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2885 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2887 //! 1. Set/Get OCAF attribute
2889 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2890 Handle(TDataStd_RealArray) array;
2891 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2892 array->Lower() == LOWER && array->Upper() == UPPER)
2893 cout<<"1: OK"<<endl;
2896 cout<<"1: Failed.."<<endl;
2899 doc->CommitCommand();
2901 //! 2. Set/Get value
2904 for (i = LOWER; i <= UPPER; i++)
2905 array->SetValue(i, i);
2906 for (i = LOWER; i <= UPPER; i++)
2908 if (array->Value(i) != i)
2910 cout<<"2: Failed.."<<endl;
2914 cout<<"2: OK"<<endl;
2915 doc->CommitCommand();
2917 //! 3. Re-init the array
2919 array->Init(LOWER + 2, UPPER + 4);
2920 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2922 cout<<"3: Failed.."<<endl;
2925 for (i = LOWER + 2; i <= UPPER + 4; i++)
2926 array->SetValue(i, i);
2927 for (i = LOWER + 2; i <= UPPER + 4; i++)
2929 if (array->Value(i) != i)
2931 cout<<"3: Failed.."<<endl;
2935 cout<<"3: OK"<<endl;
2936 doc->CommitCommand();
2940 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2941 for (i = LOWER + 5; i <= UPPER + 5; i++)
2942 arr->SetValue(i, i);
2943 array->ChangeArray(arr);
2944 for (i = LOWER + 5; i <= UPPER + 5; i++)
2946 if (array->Value(i) != i)
2948 cout<<"4: Failed.."<<endl;
2952 cout<<"4: OK"<<endl;
2953 doc->CommitCommand();
2955 //! 5. Copy the array
2957 TDF_CopyLabel copier(label1, label2);
2959 if (!copier.IsDone())
2961 cout<<"5: Failed.."<<endl;
2964 Handle(TDataStd_RealArray) array2;
2965 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2967 cout<<"5: Failed.."<<endl;
2970 for (i = LOWER + 5; i <= UPPER + 5; i++)
2972 if (array->Value(i) != i)
2974 cout<<"5: Failed.."<<endl;
2978 cout<<"5: OK"<<endl;
2979 doc->CommitCommand();
2982 //! 6.a: undoes the 5th action: the copied array should disappear
2984 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2985 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2987 cout<<"6.a: Failed.."<<endl;
2990 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2992 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2993 array->Lower() != LOWER + 2 ||
2994 array->Upper() != UPPER + 4)
2996 cout<<"6.b: Failed.."<<endl;
2999 for (i = LOWER + 2; i <= UPPER + 4; i++)
3001 if (array->Value(i) != i)
3003 cout<<"6.b: Failed.."<<endl;
3007 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
3009 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3010 array->Lower() != LOWER ||
3011 array->Upper() != UPPER)
3013 cout<<"6.c: Failed.."<<endl;
3016 for (i = LOWER; i <= UPPER; i++)
3018 if (array->Value(i) != i)
3020 cout<<"6.c: Failed.."<<endl;
3024 //! 6.d: undoes and redoes the 2nd action: no change is expected.
3027 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3028 array->Lower() != LOWER ||
3029 array->Upper() != UPPER)
3031 cout<<"6.d: Failed.."<<endl;
3034 for (i = LOWER; i <= UPPER; i++)
3036 if (array->Value(i) != i)
3038 cout<<"6.d: Failed.."<<endl;
3042 cout<<"6: OK"<<endl;
3044 //! 7. Re-set the array
3046 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
3047 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
3049 cout<<"7: Failed.."<<endl;
3052 for (i = LOWER + 1; i <= UPPER + 1; i++)
3053 array->SetValue(i, i);
3054 for (i = LOWER + 1; i <= UPPER + 1; i++)
3056 if (array->Value(i) != i)
3058 cout<<"7: Failed.."<<endl;
3062 cout<<"7: OK"<<endl;
3063 doc->CommitCommand();
3065 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
3066 //! measure the time spent by this test.
3072 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3074 Standard_Boolean IsEvenArgc = Standard_True;
3075 if (argc % 2 == 0) {
3076 IsEvenArgc = Standard_True;
3078 IsEvenArgc = Standard_False;
3081 if (argc < 3 || IsEvenArgc)
3083 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
3087 Standard_Integer i, aValue, aPosition;
3088 NCollection_Vector<int> vec;
3089 for (i = 0; i < argc - 1; i++) {
3091 aValue = Draw::Atoi(argv[i]);
3092 aPosition = Draw::Atoi(argv[i+1]);
3093 vec.SetValue(aValue, aPosition);
3095 NCollection_Vector<int>::Iterator it(vec);
3097 for (j = 0; it.More(); it.Next(), j++) {
3098 //di << it.Value() << "\n";
3099 di << j << " " << it.Value() << "\n";
3105 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3108 di << "Usage : " << argv[0] << "\n";
3112 gp_Pnt point(0.0,0.0,0.0);
3114 TColgp_Array1OfPnt poles(0,6);
3117 point.SetCoord(1.0,1.0,0.0);
3120 point.SetCoord(2.0,1.0,0.0);
3123 point.SetCoord(3.0,0.0,0.0);
3126 point.SetCoord(4.0,1.0,0.0);
3129 point.SetCoord(5.0,1.0,0.0);
3132 point.SetCoord(6.0,0.0,0.0);
3135 TColStd_Array1OfReal knots(0,2);
3140 TColStd_Array1OfInteger multi(0,2);
3145 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
3148 Standard_Real l_abcissa,l_gprop;
3149 GeomAdaptor_Curve adaptor_spline(spline);
3150 GCPnts_AbscissaPoint temp;
3151 l_abcissa=temp.Length(adaptor_spline);
3152 cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
3155 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
3157 BRepGProp::LinearProperties(edge,prop);
3158 l_gprop=prop.Mass();
3159 cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
3161 cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
3166 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3170 di << "Usage : " << argv[0] << "\n";
3174 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3175 if(AISContext.IsNull())
3177 di << "use 'vinit' command before " << argv[0] << "\n";
3182 AIS_ListOfInteractive ListOfIO_1;
3183 AISContext->ObjectsInside(ListOfIO_1);
3184 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3185 if (!ListOfIO_1.IsEmpty() ) {
3186 AIS_ListIteratorOfListOfInteractive iter;
3187 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3188 Handle(AIS_InteractiveObject) aIO=iter.Value();
3189 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3193 // ObjectsInCollector
3194 AIS_ListOfInteractive ListOfIO_2;
3195 AISContext->ObjectsInCollector(ListOfIO_2);
3196 di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
3197 if (!ListOfIO_2.IsEmpty() ) {
3198 AIS_ListIteratorOfListOfInteractive iter;
3199 for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
3200 Handle(AIS_InteractiveObject) aIO=iter.Value();
3201 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3208 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3210 if ((argc < 9) || (((argc-3) % 3) != 0))
3212 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3215 Standard_Integer i, j, np = (argc-3) / 3;
3216 BRepBuilderAPI_MakePolygon W;
3218 for (i = 1; i <= np; i ++) {
3219 W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2])));
3223 DBRep::Set(argv[1],W.Wire());
3224 DBRep::Set(argv[2],W.Edge());
3228 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3231 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3234 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3235 gp_Dir(1., -1., 0.));
3237 aTrf.SetAffinity (aPln, Draw::Atof(argv[4]));
3238 gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3239 gp_XYZ aResult (aOrigin);
3240 aTrf.Transforms(aResult);
3242 Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3243 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3244 aResult.X(), aResult.Y(), aResult.Z());
3249 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3252 di << "Usage : " << argv[0] << " shape [deflection]\n";
3256 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3258 if (aShape.IsNull()) {
3259 di<<" Null shape is not allowed";
3263 Standard_Real aDeflection = 0.45110277533;
3265 aDeflection = Draw::Atof(argv[2]);
3267 di<<"deflection="<< aDeflection << "\n";
3269 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
3270 TopLoc_Location aLocation;
3271 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3273 if(aTriang.IsNull()) {
3274 di << argv[0] << " : Faulty\n" ;
3276 di << argv[0] << " : OK\n" ;
3277 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3278 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3283 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3286 di << "Usage : " << argv[0] << " A B C\n";
3291 gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3292 gp_Pnt2d anOrigin = aLin2d.Location();
3293 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3295 catch(Standard_ConstructionError)
3297 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3302 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3305 di << "Usage : " << argv[0] << " file shape\n";
3309 IGESControl_Reader aReader;
3310 aReader.ReadFile(argv[1]);
3311 aReader.SetReadVisible(Standard_True);
3312 aReader.TransferRoots();
3314 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3315 if (model.IsNull()) {
3316 di << "model.IsNull()\n";
3319 Standard_Integer nb = model->NbEntities();
3320 for (Standard_Integer i = 1; i <= nb; i ++) {
3321 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3322 Handle(TCollection_HAsciiString) name;
3323 name = ent->NameValue();
3324 Standard_CString aStr = name->ToCString();
3325 di << "NameValue = " << aStr << "\n";
3328 TopoDS_Shape shape = aReader.OneShape();
3329 DBRep::Set(argv[2],shape);
3333 // For OCC16782 testing
3334 #include <AppStd_Application.hxx>
3335 #include <TDF_Tool.hxx>
3336 #include <TColStd_HArray1OfInteger.hxx>
3338 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3339 #include <TColStd_ListIteratorOfListOfReal.hxx>
3340 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3341 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3342 #include <TDF_ListIteratorOfLabelList.hxx>
3344 #include <TDataStd_Tick.hxx>
3345 #include <TDataStd_IntegerList.hxx>
3346 #include <TDataStd_RealList.hxx>
3347 #include <TDataStd_ExtStringList.hxx>
3348 #include <TDataStd_BooleanList.hxx>
3349 #include <TDataStd_ReferenceList.hxx>
3350 #include <TDataStd_BooleanArray.hxx>
3351 #include <TDataStd_ReferenceArray.hxx>
3352 #include <TDataStd_ByteArray.hxx>
3353 #include <TDataStd_NamedData.hxx>
3354 #include <TDF_Reference.hxx>
3356 Handle(AppStd_Application) app;
3357 int TestSetGet(const Handle(TDocStd_Document)& doc)
3361 TDataStd_Tick::Set(doc->Main());
3363 Handle(TDataStd_Tick) tick;
3364 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3367 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3368 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3370 doc->Main().ResumeAttribute(tick);
3371 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3374 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3375 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3378 // TDataStd_IntegerList:
3380 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3381 setintlist->Append(2);
3382 setintlist->Prepend(1);
3383 setintlist->InsertAfter(3, 2);
3384 setintlist->InsertBefore(0, 1);
3385 setintlist->Append(200);
3386 setintlist->Remove(0);
3387 setintlist->Remove(200);
3389 Handle(TDataStd_IntegerList) getintlist;
3390 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3392 if (getintlist->First() != 1)
3394 if (getintlist->Last() != 3)
3396 const TColStd_ListOfInteger& intlist = getintlist->List();
3397 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3398 for (; itr_intlist.More(); itr_intlist.Next())
3400 if (itr_intlist.Value() != 1 &&
3401 itr_intlist.Value() != 2 &&
3402 itr_intlist.Value() != 3)
3407 getintlist->Clear();
3409 // TDataStd_RealList:
3411 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3412 setdbllist->Append(2.5);
3413 setdbllist->Prepend(1.5);
3414 setdbllist->InsertAfter(3.5, 2.5);
3415 setdbllist->InsertBefore(0.5, 1.5);
3416 setdbllist->Append(200.5);
3417 setdbllist->Remove(0.5);
3418 setdbllist->Remove(200.5);
3420 Handle(TDataStd_RealList) getdbllist;
3421 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3423 if (getdbllist->First() != 1.5)
3425 if (getdbllist->Last() != 3.5)
3427 const TColStd_ListOfReal& dbllist = getdbllist->List();
3428 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3429 for (; itr_dbllist.More(); itr_dbllist.Next())
3431 if (itr_dbllist.Value() != 1.5 &&
3432 itr_dbllist.Value() != 2.5 &&
3433 itr_dbllist.Value() != 3.5)
3438 getdbllist->Clear();
3440 // TDataStd_ExtStringList:
3442 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3443 setstrlist->Append("Hello");
3444 setstrlist->Prepend("Guten Tag");
3445 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3446 setstrlist->InsertBefore("Bonsoir", "Hello");
3447 setstrlist->Append("Good bye");
3448 setstrlist->Remove("Bonsoir");
3449 setstrlist->Remove("Good bye");
3451 Handle(TDataStd_ExtStringList) getstrlist;
3452 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3454 if (getstrlist->First() != "Guten Tag")
3456 if (getstrlist->Last() != "Hello")
3458 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3459 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3460 for (; itr_strlist.More(); itr_strlist.Next())
3462 if (itr_strlist.Value() != "Guten Tag" &&
3463 itr_strlist.Value() != "Bonjour" &&
3464 itr_strlist.Value() != "Hello")
3469 getstrlist->Clear();
3471 // TDataStd_BooleanList:
3473 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3474 setboollist->Append(Standard_True);
3475 setboollist->Prepend(Standard_False);
3477 Handle(TDataStd_BooleanList) getboollist;
3478 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3480 if (getboollist->First() != Standard_False)
3482 if (getboollist->Last() != Standard_True)
3484 const TDataStd_ListOfByte& boollist = getboollist->List();
3485 TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
3486 for (; itr_boollist.More(); itr_boollist.Next())
3488 if (itr_boollist.Value() != Standard_True &&
3489 itr_boollist.Value() != Standard_False)
3494 getboollist->Clear();
3496 // TDataStd_ReferenceList:
3497 TDF_Label L1 = doc->Main().FindChild(100);
3498 TDF_Label L2 = doc->Main().FindChild(101);
3499 TDF_Label L3 = doc->Main().FindChild(102);
3500 TDF_Label L4 = doc->Main().FindChild(103);
3501 TDF_Label L5 = doc->Main().FindChild(104);
3503 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3504 setreflist->Append(L1);
3505 setreflist->Prepend(L2);
3506 setreflist->InsertAfter(L3, L2);
3507 setreflist->InsertBefore(L4, L1);
3508 setreflist->Append(L5);
3509 setreflist->Remove(L4);
3510 setreflist->Remove(L5);
3512 Handle(TDataStd_ReferenceList) getreflist;
3513 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3515 if (getreflist->First() != L2)
3517 if (getreflist->Last() != L1)
3519 const TDF_LabelList& reflist = getreflist->List();
3520 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3521 for (; itr_reflist.More(); itr_reflist.Next())
3523 if (itr_reflist.Value() != L1 &&
3524 itr_reflist.Value() != L2 &&
3525 itr_reflist.Value() != L3)
3530 getreflist->Clear();
3532 // TDataStd_BooleanArray:
3534 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3535 setboolarr->SetValue(12, Standard_True);
3536 setboolarr->SetValue(13, Standard_False);
3537 setboolarr->SetValue(14, Standard_False);
3538 setboolarr->SetValue(15, Standard_False);
3539 setboolarr->SetValue(16, Standard_True);
3540 setboolarr->SetValue(14, Standard_True);
3542 Handle(TDataStd_BooleanArray) getboolarr;
3543 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3545 if (getboolarr->Value(12) != Standard_True)
3547 if (getboolarr->Value(13) != Standard_False)
3549 if (getboolarr->Value(14) != Standard_True)
3551 if (getboolarr->Value(15) != Standard_False)
3553 if (getboolarr->Value(16) != Standard_True)
3556 // TDataStd_ReferenceArray:
3558 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3559 setrefarr->SetValue(0, L1);
3560 setrefarr->SetValue(1, L2);
3561 setrefarr->SetValue(2, L3);
3562 setrefarr->SetValue(3, L4);
3563 setrefarr->SetValue(4, L5);
3565 Handle(TDataStd_ReferenceArray) getrefarr;
3566 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3568 if (getrefarr->Value(0) != L1)
3570 if (getrefarr->Value(1) != L2)
3572 if (getrefarr->Value(2) != L3)
3574 if (getrefarr->Value(3) != L4)
3576 if (getrefarr->Value(4) != L5)
3579 // TDataStd_ByteArray:
3581 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3582 setbytearr->SetValue(12, 0);
3583 setbytearr->SetValue(13, 1);
3584 setbytearr->SetValue(14, 2);
3585 setbytearr->SetValue(15, 3);
3586 setbytearr->SetValue(16, 255);
3588 Handle(TDataStd_ByteArray) getbytearr;
3589 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3591 if (getbytearr->Value(12) != 0)
3593 if (getbytearr->Value(13) != 1)
3595 if (getbytearr->Value(14) != 2)
3597 if (getbytearr->Value(15) != 3)
3599 if (getbytearr->Value(16) != 255)
3602 // TDataStd_NamedData:
3604 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3605 setnd->SetInteger("Integer1", 1);
3606 setnd->SetInteger("Integer2", 2);
3607 setnd->SetInteger("Integer3", 8);
3608 setnd->SetInteger("Integer3", 3);
3610 Handle(TDataStd_NamedData) getnd;
3611 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3613 if (!getnd->HasIntegers())
3615 if (!getnd->HasInteger("Integer1"))
3617 if (getnd->GetInteger("Integer2") != 2)
3619 if (getnd->GetInteger("Integer3") != 3)
3625 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3629 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3630 doc->CommitCommand();
3631 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3634 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3637 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3640 // TDataStd_IntegerList:
3642 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3644 intlist->Prepend(1);
3645 intlist->InsertBefore(0, 1);
3646 intlist->InsertAfter(3, 2);
3647 doc->CommitCommand();
3648 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3651 if (!intlist->IsEmpty())
3654 if (!intlist->Extent())
3656 if (intlist->First() != 0)
3658 if (intlist->Last() != 3)
3662 // TDataStd_RealList:
3664 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3665 dbllist->Append(2.5);
3666 dbllist->Prepend(1.5);
3667 dbllist->InsertBefore(0.5, 1.5);
3668 dbllist->InsertAfter(3.5, 2.5);
3669 doc->CommitCommand();
3670 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3673 if (!dbllist->IsEmpty())
3676 if (!dbllist->Extent())
3678 if (dbllist->First() != 0.5)
3680 if (dbllist->Last() != 3.5)
3684 // TDataStd_ExtStringList:
3686 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3687 strlist->Append("Hello");
3688 strlist->Prepend("Guten Tag");
3689 strlist->InsertAfter("Bonjour", "Guten Tag");
3690 strlist->InsertBefore("Bonsoir", "Hello");
3691 doc->CommitCommand();
3692 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3695 if (!strlist->IsEmpty())
3698 if (!strlist->Extent())
3700 if (strlist->First() != "Guten Tag")
3702 if (strlist->Last() != "Hello")
3706 // TDataStd_BooleanList:
3708 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3709 boollist->Append(Standard_True);
3710 boollist->Prepend(Standard_False);
3711 doc->CommitCommand();
3712 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3715 if (!boollist->IsEmpty())
3718 if (!boollist->Extent())
3720 if (boollist->First() != Standard_False)
3722 if (boollist->Last() != Standard_True)
3726 // TDataStd_ReferenceList:
3727 TDF_Label L1 = doc->Main().FindChild(100);
3728 TDF_Label L2 = doc->Main().FindChild(101);
3729 TDF_Label L3 = doc->Main().FindChild(102);
3730 TDF_Label L4 = doc->Main().FindChild(103);
3732 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3733 reflist->Append(L1);
3734 reflist->Prepend(L2);
3735 reflist->InsertBefore(L3, L1);
3736 reflist->InsertAfter(L4, L2);
3737 doc->CommitCommand();
3738 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3741 if (!reflist->IsEmpty())
3744 if (!reflist->Extent())
3746 if (reflist->First() != L2)
3748 if (reflist->Last() != L1)
3752 // TDataStd_BooleanArray:
3754 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3755 boolarr->SetValue(23, Standard_True);
3756 boolarr->SetValue(25, Standard_True);
3757 doc->CommitCommand();
3759 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3760 boolarr->SetValue(230, Standard_True);
3761 boolarr->SetValue(250, Standard_True);
3762 doc->CommitCommand();
3764 if (boolarr->Value(23) != Standard_True)
3766 if (boolarr->Value(24) != Standard_False)
3768 if (boolarr->Value(25) != Standard_True)
3771 if (boolarr->Value(230) != Standard_True)
3773 if (boolarr->Value(240) != Standard_False)
3775 if (boolarr->Value(250) != Standard_True)
3778 // TDataStd_ReferenceArray:
3780 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3781 refarr->SetValue(5, L1);
3782 refarr->SetValue(6, L2);
3783 refarr->SetValue(7, L3);
3784 refarr->SetValue(8, L4);
3785 doc->CommitCommand();
3786 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3790 if (refarr->Value(5) != L1)
3792 if (refarr->Value(6) != L2)
3794 if (refarr->Value(7) != L3)
3796 if (refarr->Value(8) != L4)
3799 // TDataStd_ByteArray:
3801 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3802 bytearr->SetValue(23, 23);
3803 bytearr->SetValue(25, 25);
3804 doc->CommitCommand();
3806 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3807 bytearr->SetValue(230, 230);
3808 bytearr->SetValue(250, 250);
3809 doc->CommitCommand();
3811 if (bytearr->Value(23) != 23)
3813 if (bytearr->Value(25) != 25)
3816 if (bytearr->Value(230) != 230)
3818 if (bytearr->Value(250) != 250)
3821 // TDataStd_NamedData:
3823 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3824 nd->SetByte("b14", 12);
3825 nd->SetByte("b17", 18);
3826 nd->SetByte("b14", 14);
3827 nd->SetByte("b17", 17);
3828 doc->CommitCommand();
3830 nd = TDataStd_NamedData::Set(doc->Main());
3831 nd->SetReal("r14", 14);
3832 nd->SetReal("r17", 17);
3833 nd->SetReal("r14", 14.4);
3834 nd->SetReal("r17", 17.7);
3835 doc->CommitCommand();
3837 if (nd->HasStrings())
3841 if (nd->HasReal("r17"))
3843 if (!nd->HasBytes())
3845 if (nd->GetByte("b14") != 14)
3847 if (nd->GetByte("b17") != 17)
3849 if (nd->HasByte("b18"))
3852 if (!nd->HasBytes())
3854 if (!nd->HasReals())
3856 if (nd->GetByte("b14") != 14)
3858 if (nd->GetReal("r14") != 14.4)
3860 if (nd->GetReal("r17") != 17.7)
3866 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3868 TDF_Label L1 = doc->Main().FindChild(1);
3869 TDF_Label L2 = doc->Main().FindChild(2);
3870 TDF_CopyLabel copier(L1, L2);
3873 TDataStd_Tick::Set(L1);
3875 if (!copier.IsDone())
3877 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3880 // TDataStd_IntegerList:
3881 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3883 intlist->InsertAfter(2, 1);
3885 if (!copier.IsDone())
3889 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3891 if (intlist->First() != 1)
3893 if (intlist->Last() != 2)
3897 // TDataStd_RealList:
3898 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3899 dbllist->Append(1.5);
3900 dbllist->InsertAfter(2.5, 1.5);
3902 if (!copier.IsDone())
3906 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3908 if (dbllist->First() != 1.5)
3910 if (dbllist->Last() != 2.5)
3914 // TDataStd_ExtStringList:
3915 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3916 strlist->Append("Open CASCADE");
3917 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3919 if (!copier.IsDone())
3923 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3925 if (strlist->First() != "Open CASCADE")
3927 if (strlist->Last() != " - is the best set of libraries!")
3931 // TDataStd_BooleanList:
3932 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3933 boollist->Append(Standard_True);
3934 boollist->Prepend(Standard_False);
3936 if (!copier.IsDone())
3940 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3942 if (boollist->First() != Standard_False)
3944 if (boollist->Last() != Standard_True)
3948 // TDataStd_ReferenceList:
3949 TDF_Label L100 = doc->Main().FindChild(100);
3950 TDF_Label L101 = doc->Main().FindChild(101);
3951 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3952 reflist->Append(L100);
3953 reflist->InsertAfter(L101, L100);
3955 if (!copier.IsDone())
3959 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3961 if (reflist->First() != L100)
3963 if (reflist->Last() != L101)
3967 // TDataStd_BooleanArray:
3968 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3969 boolarr->SetValue(4, Standard_True);
3970 boolarr->SetValue(6, Standard_True);
3972 if (!copier.IsDone())
3975 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3977 if (boolarr->Value(4) != Standard_True)
3979 if (boolarr->Value(5) != Standard_False)
3981 if (boolarr->Value(6) != Standard_True)
3984 // TDataStd_ReferenceArray:
3985 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3986 refarr->SetValue(3, L100);
3987 refarr->SetValue(4, L101);
3989 if (!copier.IsDone())
3992 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3994 if (refarr->Value(3) != L100)
3996 if (refarr->Value(4) != L101)
3999 // TDataStd_ByteArray:
4000 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
4001 bytearr->SetValue(4, 40);
4002 bytearr->SetValue(6, 60);
4004 if (!copier.IsDone())
4007 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4009 if (bytearr->Value(4) != 40)
4011 if (bytearr->Value(6) != 60)
4014 // TDataStd_NamedData:
4015 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
4016 nd->SetInteger("Integer1", 11);
4017 nd->SetReal("Real1", 11.1);
4018 nd->SetString("String1", "11.11111111");
4019 nd->SetByte("Byte1", 111);
4020 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
4021 ints_arr->SetValue(4, 4);
4022 ints_arr->SetValue(5, 5);
4023 nd->SetArrayOfIntegers("Integers1", ints_arr);
4025 if (!copier.IsDone())
4028 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
4030 if (!nd->HasIntegers())
4032 if (!nd->HasReals())
4034 if (!nd->HasStrings())
4036 if (!nd->HasBytes())
4038 if (!nd->HasArraysOfIntegers())
4040 if (nd->HasArraysOfReals())
4042 if (!nd->HasInteger("Integer1"))
4044 if (nd->GetInteger("Integer1") != 11)
4046 if (!nd->HasReal("Real1"))
4048 if (nd->GetReal("Real1") != 11.1)
4050 if (!nd->HasString("String1"))
4052 if (nd->GetString("String1") != "11.11111111")
4054 if (!nd->HasByte("Byte1"))
4056 if (nd->GetByte("Byte1") != 111)
4058 if (!nd->HasArrayOfIntegers("Integers1"))
4060 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
4061 if (ints_arr_out.IsNull())
4063 if (ints_arr_out->Value(5) != 5)
4069 int TestOpenSave(TCollection_ExtendedString aFile1,
4070 TCollection_ExtendedString aFile2,
4071 TCollection_ExtendedString aFile3)
4074 Handle(TDocStd_Document) doc_std, doc_std_open;
4075 app->NewDocument("MDTV-Standard", doc_std);
4077 TDataStd_Tick::Set(doc_std->Main());
4078 // TDataStd_IntegerList:
4079 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
4082 // TDataStd_RealList:
4083 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
4084 dbllist->Append(1.5);
4085 dbllist->Append(5.5);
4086 // TDataStd_ExtStringList:
4087 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
4088 strlist->Append("Auf");
4089 strlist->Append("Wiedersehen");
4090 // TDataStd_BooleanList:
4091 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
4092 boollist->Append(Standard_False);
4093 boollist->Append(Standard_True);
4094 // TDataStd_ReferenceList:
4095 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
4096 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
4097 TDF_Tool::Entry(Lstd1, entry1);
4098 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
4099 TDF_Tool::Entry(Lstd2, entry2);
4100 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
4101 reflist->Append(Lstd1);
4102 reflist->Append(Lstd2);
4103 // TDataStd_BooleanArray:
4104 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
4105 boolarr->SetValue(15, Standard_False);
4106 boolarr->SetValue(16, Standard_True);
4107 boolarr->SetValue(17, Standard_True);
4108 boolarr->SetValue(18, Standard_True);
4109 // TDataStd_ReferenceArray:
4110 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
4111 refarr->SetValue(45, Lstd1);
4112 refarr->SetValue(46, Lstd2);
4113 // TDataStd_ByteArray:
4114 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
4115 bytearr->SetValue(15, 150);
4116 bytearr->SetValue(16, 160);
4117 bytearr->SetValue(17, 170);
4118 bytearr->SetValue(18, 180);
4119 // TDataStd_NamedData:
4120 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
4122 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
4123 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
4126 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
4127 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
4136 app->Close(doc_std);
4138 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
4139 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
4141 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4143 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4145 if (intlist->First() != 1)
4147 if (intlist->Last() != 5)
4149 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4151 if (dbllist->First() != 1.5)
4153 if (dbllist->Last() != 5.5)
4155 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4157 if (strlist->First() != "Auf")
4159 if (strlist->Last() != "Wiedersehen")
4161 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4163 if (boollist->First() != Standard_False)
4165 if (boollist->Last() != Standard_True)
4167 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4169 TDF_Tool::Entry(reflist->First(), entry_first);
4170 if (entry1 != entry_first)
4172 TDF_Tool::Entry(reflist->Last(), entry_last);
4173 if (entry2 != entry_last)
4175 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4177 if (boolarr->Value(15) != Standard_False)
4179 if (boolarr->Value(16) != Standard_True)
4181 if (boolarr->Value(17) != Standard_True)
4183 if (boolarr->Value(18) != Standard_True)
4185 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4187 TDF_Tool::Entry(refarr->Value(45), entry_first);
4188 if (entry1 != entry_first)
4190 TDF_Tool::Entry(refarr->Value(46), entry_last);
4191 if (entry2 != entry_last)
4193 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4195 if (bytearr->Value(15) != 150)
4197 if (bytearr->Value(16) != 160)
4199 if (bytearr->Value(17) != 170)
4201 if (bytearr->Value(18) != 180)
4203 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4205 if (ref->Get().IsNull())
4207 if (ref->Get().Tag() != 103)
4211 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4212 app->NewDocument("XmlOcaf", doc_xml);
4214 TDataStd_Tick::Set(doc_xml->Main());
4215 // TDataStd_IntegerList:
4216 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4219 // TDataStd_RealList:
4220 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4221 dbllist->Append(1.5);
4222 dbllist->Append(5.5);
4223 // TDataStd_ExtStringList:
4224 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4225 strlist->Append("Guten ");
4226 strlist->Append("Tag");
4227 // TDataStd_BooleanList:
4228 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4229 boollist->Append(Standard_False);
4230 boollist->Append(Standard_True);
4231 // TDataStd_ReferenceList:
4232 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4233 TDF_Tool::Entry(Lxml1, entry1);
4234 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4235 TDF_Tool::Entry(Lxml2, entry2);
4236 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4237 reflist->Append(Lxml1);
4238 reflist->Append(Lxml2);
4239 // TDataStd_BooleanArray:
4240 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4241 boolarr->SetValue(15, Standard_False);
4242 boolarr->SetValue(16, Standard_True);
4243 boolarr->SetValue(17, Standard_True);
4244 boolarr->SetValue(18, Standard_True);
4245 boolarr->SetValue(19, Standard_True);
4246 boolarr->SetValue(20, Standard_True);
4247 boolarr->SetValue(21, Standard_False);
4248 boolarr->SetValue(22, Standard_True);
4249 boolarr->SetValue(23, Standard_True);
4250 boolarr->SetValue(24, Standard_True);
4251 // TDataStd_ReferenceArray:
4252 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4253 refarr->SetValue(444, Lxml1);
4254 refarr->SetValue(445, Lxml2);
4255 // TDataStd_ByteArray:
4256 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4257 bytearr->SetValue(15, 0);
4258 bytearr->SetValue(16, 10);
4259 bytearr->SetValue(17, 100);
4260 bytearr->SetValue(18, 200);
4261 bytearr->SetValue(19, 250);
4262 bytearr->SetValue(20, 251);
4263 bytearr->SetValue(21, 252);
4264 bytearr->SetValue(22, 253);
4265 bytearr->SetValue(23, 254);
4266 bytearr->SetValue(24, 255);
4268 Lstd3 = doc_xml->Main().FindChild(103);
4269 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4272 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4273 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4277 app->Close(doc_xml);
4279 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4280 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4282 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4284 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4286 if (intlist->First() != 1)
4288 if (intlist->Last() != 5)
4290 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4292 if (dbllist->First() != 1.5)
4294 if (dbllist->Last() != 5.5)
4296 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4298 if (strlist->First() != "Guten ")
4300 if (strlist->Last() != "Tag")
4302 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4304 if (boollist->First() != Standard_False)
4306 if (boollist->Last() != Standard_True)
4308 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4310 TDF_Tool::Entry(reflist->First(), entry_first);
4311 if (entry1 != entry_first)
4313 TDF_Tool::Entry(reflist->Last(), entry_last);
4314 if (entry2 != entry_last)
4316 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4318 if (boolarr->Value(15) != Standard_False)
4320 if (boolarr->Value(16) != Standard_True)
4322 if (boolarr->Value(17) != Standard_True)
4324 if (boolarr->Value(18) != Standard_True)
4326 if (boolarr->Value(19) != Standard_True)
4328 if (boolarr->Value(20) != Standard_True)
4330 if (boolarr->Value(21) != Standard_False)
4332 if (boolarr->Value(22) != Standard_True)
4334 if (boolarr->Value(23) != Standard_True)
4336 if (boolarr->Value(24) != Standard_True)
4338 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4340 TDF_Tool::Entry(refarr->Value(444), entry_first);
4341 if (entry1 != entry_first)
4343 TDF_Tool::Entry(refarr->Value(445), entry_last);
4344 if (entry2 != entry_last)
4346 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4348 if (bytearr->Value(15) != 0)
4350 if (bytearr->Value(16) != 10)
4352 if (bytearr->Value(17) != 100)
4354 if (bytearr->Value(18) != 200)
4356 if (bytearr->Value(19) != 250)
4358 if (bytearr->Value(20) != 251)
4360 if (bytearr->Value(21) != 252)
4362 if (bytearr->Value(22) != 253)
4364 if (bytearr->Value(23) != 254)
4366 if (bytearr->Value(24) != 255)
4368 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4370 if (ref->Get().IsNull())
4372 if (ref->Get().Tag() != 103)
4376 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4377 app->NewDocument("BinOcaf", doc_bin);
4379 TDataStd_Tick::Set(doc_bin->Main());
4380 // TDataStd_IntegerList:
4381 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4384 // TDataStd_RealList:
4385 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4386 dbllist->Append(1.5);
4387 dbllist->Append(5.5);
4388 // TDataStd_ExtStringList:
4389 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4390 strlist->Append("Bonjour");
4391 strlist->Append("Bonsoir");
4392 // TDataStd_BooleanList:
4393 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4394 boollist->Append(Standard_False);
4395 boollist->Append(Standard_True);
4396 // TDataStd_ReferenceList:
4397 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4398 TDF_Tool::Entry(Lbin1, entry1);
4399 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4400 TDF_Tool::Entry(Lbin2, entry2);
4401 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4402 reflist->Append(Lbin1);
4403 reflist->Append(Lbin2);
4404 // TDataStd_BooleanArray:
4405 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4406 boolarr->SetValue(15, Standard_False);
4407 boolarr->SetValue(16, Standard_True);
4408 boolarr->SetValue(17, Standard_True);
4409 boolarr->SetValue(18, Standard_True);
4410 boolarr->SetValue(19, Standard_True);
4411 boolarr->SetValue(20, Standard_True);
4412 boolarr->SetValue(21, Standard_False);
4413 boolarr->SetValue(22, Standard_True);
4414 boolarr->SetValue(23, Standard_True);
4415 boolarr->SetValue(24, Standard_True);
4416 // TDataStd_ReferenceArray:
4417 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4418 refarr->SetValue(0, Lbin1);
4419 refarr->SetValue(1, Lbin2);
4420 // TDataStd_ByteArray:
4421 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4422 bytearr->SetValue(15, 0);
4423 bytearr->SetValue(16, 255);
4424 // TDataStd_NamedData:
4425 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4426 nameddata->SetByte("A", 12);
4427 nameddata->SetByte("B", 234);
4429 Lstd3 = doc_bin->Main().FindChild(103);
4430 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4433 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4434 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4438 app->Close(doc_bin);
4440 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4441 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4443 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4445 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4447 if (intlist->First() != 1)
4449 if (intlist->Last() != 5)
4451 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4453 if (dbllist->First() != 1.5)
4455 if (dbllist->Last() != 5.5)
4457 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4459 if (strlist->First() != "Bonjour")
4461 if (strlist->Last() != "Bonsoir")
4463 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4465 if (boollist->First() != Standard_False)
4467 if (boollist->Last() != Standard_True)
4469 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4471 TDF_Tool::Entry(reflist->First(), entry_first);
4472 if (entry1 != entry_first)
4474 TDF_Tool::Entry(reflist->Last(), entry_last);
4475 if (entry2 != entry_last)
4477 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4479 if (boolarr->Value(15) != Standard_False)
4481 if (boolarr->Value(16) != Standard_True)
4483 if (boolarr->Value(17) != Standard_True)
4485 if (boolarr->Value(18) != Standard_True)
4487 if (boolarr->Value(19) != Standard_True)
4489 if (boolarr->Value(20) != Standard_True)
4491 if (boolarr->Value(21) != Standard_False)
4493 if (boolarr->Value(22) != Standard_True)
4495 if (boolarr->Value(23) != Standard_True)
4497 if (boolarr->Value(24) != Standard_True)
4499 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4501 TDF_Tool::Entry(refarr->Value(0), entry_first);
4502 if (entry1 != entry_first)
4504 TDF_Tool::Entry(refarr->Value(1), entry_last);
4505 if (entry2 != entry_last)
4507 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4509 if (bytearr->Value(15) != 0)
4511 if (bytearr->Value(16) != 255)
4513 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4515 if (nameddata->GetByte("A") != 12)
4517 if (nameddata->GetByte("B") != 234)
4519 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4521 if (ref->Get().IsNull())
4523 if (ref->Get().Tag() != 103)
4528 // For OCC16782 testing
4530 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4534 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4537 TCollection_ExtendedString aFile1(argv[1]);
4538 TCollection_ExtendedString aFile2(argv[2]);
4539 TCollection_ExtendedString aFile3(argv[3]);
4542 app = new AppStd_Application();
4546 Handle(TDocStd_Document) doc;
4547 app->NewDocument("MDTV-Standard", doc);
4548 doc->SetUndoLimit(10);
4550 di <<"\nTestSetGet start\n";
4551 good += TestSetGet(doc);
4552 di <<"TestSetGet finish\n";
4553 di <<"Status = " << good << "\n";
4555 di <<"\nTestUndoRedo start\n";
4556 good += TestUndoRedo(doc);
4557 di <<"TestUndoRedo finish\n";
4558 di <<"Status = " << good << "\n";
4560 di <<"\nTestCopyPaste start\n";
4561 good += TestCopyPaste(doc);
4562 di <<"TestCopyPaste finish\n";
4563 di <<"Status = " << good << "\n";
4565 di <<"\nTestOpenSave start\n";
4566 good += TestOpenSave(aFile1, aFile2, aFile3);
4567 di <<"TestOpenSave finish\n";
4568 di <<"Status = " << good << "\n";
4571 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4573 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4578 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4580 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4581 if(aContext.IsNull()) {
4582 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
4588 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4591 Standard_Integer mode = 0;
4594 mode = Draw::Atoi(argv[1]);
4596 if (mode > 2 || mode < 0)
4598 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4601 Handle(V3d_View) V = ViewerTest::CurrentView();
4602 if ( !V.IsNull() ) {
4604 V->ColorScaleDisplay();
4607 V->ColorScaleErase();
4612 Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
4614 di <<"ColorScaleIsDisplayed = " << "1" << "\n";
4616 di <<"ColorScaleIsDisplayed = " << "0" << "\n";
4622 #include <Interface_Macros.hxx>
4623 #include <IGESControl_Controller.hxx>
4624 #include <XSDRAW.hxx>
4625 #include <Draw_ProgressIndicator.hxx>
4626 #include <XSControl_WorkSession.hxx>
4627 #include <Transfer_TransientProcess.hxx>
4628 #include <XSDRAW_Commands.hxx>
4629 #include <TColStd_HSequenceOfTransient.hxx>
4630 #include <Message_ProgressSentry.hxx>
4631 #include <XSControl_TransferReader.hxx>
4633 static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4635 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
4636 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
4638 // Progress indicator
4639 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
4640 progress->SetScale ( 0, 100, 1 );
4643 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
4645 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
4647 TCollection_AsciiString fnom,rnom;
4649 Standard_Boolean modfic = XSDRAW::FileAndVar
4650 (argv[1],argv[2],"IGESBREP",fnom,rnom);
4651 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
4652 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
4653 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
4654 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
4657 OSD_Timer Chr; Chr.Reset();
4663 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
4667 //In order to decrease number of produced edges during translation it is possible to set following parameter
4668 Interface_Static::SetIVal("read.iges.bspline.continuity",0);
4671 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
4672 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
4674 progress->EndScope();
4677 if (readstat != IFSelect_RetDone) {
4678 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
4679 else di<<"No model loaded"<<"\n";
4682 // Choice of treatment
4683 Standard_Boolean fromtcl = (argc > 3);
4684 Standard_Integer modepri = 1, nent, nbs;
4685 if (fromtcl) modepri = 4;
4688 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
4689 //mode OnlyVisible does not work.
4690 // nent = Reader.NbRootsForTransfer();
4692 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
4695 // amv 26.09.2003 : this is used to avoid error of enter's simbol
4698 modepri = Draw::Atoi(str);
4701 if (modepri == 0) { //fin
4702 di << "Bye and good luck! " << "\n";
4706 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
4707 di << "All Geometry Transfer"<<"\n";
4708 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4709 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4710 Handle(XSControl_WorkSession) thesession = Reader.WS();
4711 thesession->ClearContext();
4712 XSDRAW::SetTransferProcess (thesession->MapReader());
4713 progress->NewScope ( 80, "Translation" );
4715 thesession->MapReader()->SetProgress ( progress );
4717 if (modepri == 1) Reader.SetReadVisible (Standard_True);
4718 Reader.TransferRoots();
4720 thesession->MapReader()->SetProgress ( 0 );
4721 progress->EndScope();
4723 // result in only one shape for all the roots
4724 // or in one shape for one root.
4725 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
4726 Standard_Integer answer = 1;
4727 if (Reader.NbShapes() > 1) {
4728 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;
4733 answer = Draw::Atoi(str_a);
4735 if ( answer == 0) continue;
4736 if ( answer == 1 || answer == 3) {
4737 TopoDS_Shape shape = Reader.OneShape();
4739 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4741 Sprintf(fname, "%s", rnom.ToCString());
4742 di << "Saving shape in variable Draw : " << fname << "\n";
4743 if (answer == 3) IGESToBRep::WriteShape (shape,1);
4746 DBRep::Set(fname,shape);
4748 catch(Standard_Failure) {
4749 di << "** Exception : ";
4750 di << Standard_Failure::Caught()->GetMessageString();
4751 di<<" ** Skip"<<"\n";
4752 di << "Saving shape in variable Draw : " << fname << "\n";
4753 IGESToBRep::WriteShape (shape,1);
4757 else if (answer == 2 || answer == 4) {
4758 Standard_Integer numshape = Reader.NbShapes();
4759 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
4760 // save all the shapes
4761 TopoDS_Shape shape = Reader.Shape(inum);
4762 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4764 Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
4765 di << "Saving shape in variable Draw : " << fname << "\n";
4766 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
4769 DBRep::Set(fname,shape);
4771 catch(Standard_Failure) {
4772 di << "** Exception : ";
4773 di << Standard_Failure::Caught()->GetMessageString();
4774 di<<" ** Skip"<<"\n";
4781 else if (modepri == 3) { // One Entity
4782 cout << "Only One Entity"<<endl;
4783 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
4784 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
4785 cout << " give the number of the Entity : " << flush;
4786 nent = XSDRAW::GetEntityNumber();
4788 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4790 nbs = Reader.NbShapes();
4791 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
4792 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4793 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4794 TopoDS_Shape sh = Reader.Shape(nbs);
4795 DBRep::Set (shname,sh);
4799 else if (modepri == 4) { // Selection
4800 Standard_Integer answer = 1;
4801 Handle(TColStd_HSequenceOfTransient) list;
4803 // Selection, nommee ou via tcl. tcl : raccourcis admis
4804 // * donne iges-visible + xst-transferrable-roots
4805 // *r donne xst-model-roots (TOUTES racines)
4807 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
4808 di << "All Geometry Transfer"<<"\n";
4809 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4810 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4811 Handle(XSControl_WorkSession) thesession = Reader.WS();
4812 thesession->ClearContext();
4813 XSDRAW::SetTransferProcess (thesession->MapReader());
4814 progress->NewScope ( 80, "Translation" );
4816 thesession->MapReader()->SetProgress ( progress );
4818 Reader.SetReadVisible (Standard_True);
4819 Reader.TransferRoots();
4821 thesession->MapReader()->SetProgress ( 0 );
4822 progress->EndScope();
4825 // result in only one shape for all the roots
4826 TopoDS_Shape shape = Reader.OneShape();
4829 Sprintf(fname, "%s", rnom.ToCString());
4830 di << "Saving shape in variable Draw : " << fname << "\n";
4833 DBRep::Set(fname,shape);
4835 catch(Standard_Failure) {
4836 di << "** Exception : ";
4837 di << Standard_Failure::Caught()->GetMessageString();
4838 di<<" ** Skip"<<"\n";
4839 di << "Saving shape in variable Draw : " << fname << "\n";
4840 IGESToBRep::WriteShape (shape,1);
4846 modepri = 0; // d office, une seule passe
4847 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
4849 list = XSDRAW::GetList ("xst-model-roots");
4852 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
4853 di<<"List given by "<<compart.ToCString()<<" : ";
4854 list = XSDRAW::GetList (compart.ToCString());
4856 if (list.IsNull()) {
4857 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
4862 cout<<"Name of Selection :"<<flush;
4863 list = XSDRAW::GetList();
4864 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
4867 Standard_Integer nbl = list->Length();
4868 di<<"Nb entities selected : "<<nbl<<"\n";
4869 if (nbl == 0) continue;
4872 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
4875 char str_answer[80];
4877 answer = Draw::Atoi(str_answer);
4879 if (answer <= 0 || answer > 3) continue;
4881 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
4882 Handle(Standard_Transient) ent = list->Value(ill);
4883 di<<" ";// model->Print(ent,di);
4887 if (answer == 1 || answer == 2) {
4888 Standard_Integer nbt = 0;
4889 Handle(XSControl_WorkSession) thesession = Reader.WS();
4891 XSDRAW::SetTransferProcess (thesession->MapReader());
4892 progress->NewScope ( 80, "Translation" );
4894 thesession->MapReader()->SetProgress ( progress );
4896 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
4897 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
4899 nent = Reader.Model()->Number(list->Value(ill));
4900 if (nent == 0) continue;
4901 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4903 nbs = Reader.NbShapes();
4904 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
4905 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4906 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4907 TopoDS_Shape sh = Reader.Shape(nbs);
4908 DBRep::Set (shname,sh);
4912 thesession->MapReader()->SetProgress ( 0 );
4913 progress->EndScope();
4915 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
4916 answer = 0; // on ne reboucle pas
4920 else di<<"Unknown mode n0 "<<modepri<<"\n";
4924 //In order to clear memory after IGES reading you could add the following code
4925 Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
4926 Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
4929 Reader.WS()->Model()->Clear();
4930 Standard_Integer i =1;
4932 Reader.WS()->ClearData(i);
4938 #include <Geom_Plane.hxx>
4939 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4943 di << "Usage : " << argv[0] << " plane a b c d\n";
4947 Standard_Real A = Draw::Atof(argv[2]);
4948 Standard_Real B = Draw::Atof(argv[3]);
4949 Standard_Real C = Draw::Atof(argv[4]);
4950 Standard_Real D = Draw::Atof(argv[5]);
4952 Handle(Geom_Geometry) result;
4954 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4957 DrawTrSurf::Set(argv[1],result);
4961 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4965 di << "Usage : " << argv[0] << " MaxNbr" << "\n";
4968 Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
4970 for (Standard_Integer i=0;i<aMaxNbr;i++)
4972 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4974 TopoDS_Wire wireShape( w.Wire());
4975 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4976 TopoDS_Face f( faceBuilder.Face());
4977 BRepMesh_IncrementalMesh im(f,1);
4978 BRepTools::Clean(f);
4983 #include <Graphic3d_Vector.hxx>
4984 Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4988 di << "Wrong number of arguments" << "\n";
4991 Standard_Real X1_Pnt = Draw::Atof(argv[1]);
4992 Standard_Real Y1_Pnt = Draw::Atof(argv[2]);
4993 Standard_Real Z1_Pnt = Draw::Atof(argv[3]);
4994 Standard_Real X2_Pnt = Draw::Atof(argv[4]);
4995 Standard_Real Y2_Pnt = Draw::Atof(argv[5]);
4996 Standard_Real Z2_Pnt = Draw::Atof(argv[6]);
4998 Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
4999 Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
5001 di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
5008 #include <IntCurvesFace_ShapeIntersector.hxx>
5009 #include <gp_Lin.hxx>
5010 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5014 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
5018 TopoDS_Shape shape = DBRep::Get(argv[1]);
5020 if (shape.IsNull()) {
5021 di<<" Null shape is not allowed";
5025 Standard_Real X_Pnt = Draw::Atof(argv[2]);
5026 Standard_Real Y_Pnt = Draw::Atof(argv[3]);
5027 Standard_Real Z_Pnt = Draw::Atof(argv[4]);
5029 Standard_Real X_Dir = Draw::Atof(argv[5]);
5030 Standard_Real Y_Dir = Draw::Atof(argv[6]);
5031 Standard_Real Z_Dir = Draw::Atof(argv[7]);
5033 Standard_Real PInf = Draw::Atof(argv[8]);
5035 IntCurvesFace_ShapeIntersector intersector;
5036 intersector.Load(shape, Precision::Intersection());
5038 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
5039 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
5040 gp_Lin ray(origin, dir);
5042 Standard_Real PSup = RealLast();
5043 intersector.PerformNearest(ray, PInf, PSup);
5044 if (intersector.NbPnt() != 0)
5046 di << argv[0] << " status = 0 \n";
5047 Standard_Real w = intersector.WParameter(1);
5048 di << "w = " << w << "\n";
5050 di << argv[0] << " status = -1 \n";
5055 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5058 di << "Usage : " << argv[0] << "\n";
5062 // Create mask 1111: extent == 4
5063 TColStd_PackedMapOfInteger aFullMask;
5064 for (Standard_Integer i = 0; i < 4; i++)
5067 // Create mask 1100: extent == 2
5068 TColStd_PackedMapOfInteger aPartMask;
5069 for (Standard_Integer i = 0; i < 2; i++)
5072 di << "aFullMask = 1111" << "\n";
5073 di << "aPartMask = 1100" << "\n";
5075 Standard_Boolean isAffected;
5077 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
5078 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5079 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
5080 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5081 isAffected = aFullMask.Subtract(aPartMask); // false (?)
5082 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5086 #include <ShapeFix_FixSmallFace.hxx>
5087 Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5091 di << "Usage : " << argv[0] << " shape resshape\n";
5095 // try to read a shape:
5096 TopoDS_Shape aShape=DBRep::Get(argv[1]);
5097 ShapeFix_FixSmallFace aFixSmallFaces;
5098 aFixSmallFaces.Init (aShape);
5099 aFixSmallFaces.Perform();
5100 TopoDS_Shape aResShape = aFixSmallFaces.Shape();
5101 DBRep::Set(argv[2],aResShape);
5107 #include <NCollection_DataMap.hxx>
5108 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5112 di << "Usage : " << argv[0] << "\n";
5116 TCollection_ExtendedString anExtString;
5118 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
5119 anExtString.Insert(1, aNonAsciiChar);
5121 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
5122 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
5123 aMap.Bind(anExtString, 0);
5129 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5132 di << "Wrong number of arguments" << argv[0] << "\n";
5136 Standard_Real X_vec = Draw::Atof(argv[1]);
5137 Standard_Real Y_vec = Draw::Atof(argv[2]);
5138 Standard_Real Z_vec = Draw::Atof(argv[3]);
5140 Standard_Real X_dir = Draw::Atof(argv[4]);
5141 Standard_Real Y_dir = Draw::Atof(argv[5]);
5142 Standard_Real Z_dir = Draw::Atof(argv[6]);
5144 Standard_Real X_pnt = Draw::Atof(argv[7]);
5145 Standard_Real Y_pnt = Draw::Atof(argv[8]);
5146 Standard_Real Z_pnt = Draw::Atof(argv[9]);
5148 gp_Dir toSym(X_vec, Y_vec, Z_vec);
5149 gp_Dir dir(X_dir, Y_dir, Z_dir);
5150 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
5151 gp_Ax2 symObj(loc,dir);
5152 toSym.Mirror(symObj);
5154 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
5159 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5163 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
5167 Standard_Real X_mirrorFirstPoint = Draw::Atof(argv[1]);
5168 Standard_Real Y_mirrorFirstPoint = Draw::Atof(argv[2]);
5169 Standard_Real X_mirrorSecondPoint = Draw::Atof(argv[3]);
5170 Standard_Real Y_mirrorSecondPoint = Draw::Atof(argv[4]);
5171 Standard_Real X_p1 = Draw::Atof(argv[5]);
5172 Standard_Real Y_p1 = Draw::Atof(argv[6]);
5173 Standard_Real X_p2 = Draw::Atof(argv[7]);
5174 Standard_Real Y_p2 = Draw::Atof(argv[8]);
5176 gp_Trsf2d identityTransformation;
5178 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
5179 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
5180 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
5182 gp_Pnt2d p1(X_p1,Y_p1);
5183 gp_Pnt2d p2(X_p2,Y_p2);
5186 M1.SetMirror(mirrorAxis);
5188 M2.SetMirror(mirrorAxis);
5190 Tcomp = M2.Multiplied(M1);
5192 Standard_Real aTol = Precision::Confusion();
5193 Standard_Integer aStatus = 0;
5195 //After applying two times the same mirror the point is located on the same location OK
5196 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
5197 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
5199 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
5202 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
5203 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
5205 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
5208 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
5209 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
5210 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
5212 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
5215 di << "Status = " << aStatus << "\n";
5219 Standard_Integer OCC23429(Draw_Interpretor& di,
5220 Standard_Integer narg, const char** a)
5222 if (narg < 4) return 1;
5224 TopoDS_Shape aShape = DBRep::Get(a[2]);
5225 if (aShape.IsNull()) return 1;
5227 BRepFeat_SplitShape Spls(aShape);
5228 Spls.SetCheckInterior(Standard_False);
5230 TopoDS_Shape aTool = DBRep::Get(a[3]);
5232 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
5233 Builder.ComputePCurveOn1(Standard_True);
5235 Builder.Approximation(Standard_True);
5237 TopoDS_Shape aSection = Builder.Shape();
5239 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
5240 for (; ExpSec.More(); ExpSec.Next())
5242 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
5243 Handle(Geom2d_Curve) thePCurve;
5244 Handle(Geom_Surface) theSurface;
5245 TopLoc_Location theLoc;
5246 Standard_Real fpar, lpar;
5247 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
5249 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
5250 for (; ExpShape.More(); ExpShape.Next())
5252 aFace = TopoDS::Face(ExpShape.Current());
5253 TopLoc_Location aLoc;
5254 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
5255 if (aSurface == theSurface && aLoc == theLoc)
5258 Spls.Add(anEdge, aFace);
5261 TopoDS_Shape Result = Spls.Shape();
5262 DBRep::Set(a[1], Result);
5267 #include <ExprIntrp_GenExp.hxx>
5268 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5272 di << "Usage : " << argv[0] << " string\n";
5276 Standard_CString aString = argv[1];
5277 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
5280 myExpr->Process( aString );
5282 catch(Standard_Failure) {
5283 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
5284 di << "Exception : " << aFail->GetMessageString() << "\n";
5290 #include <Quantity_NameOfColor.hxx>
5291 #include <TopAbs_ShapeEnum.hxx>
5292 Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5294 // Check the command arguments
5297 di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
5298 di << "Usage : " << argv[0] << " mode(0/1)\n";
5299 return 1; //TCL_ERROR
5302 const Standard_Integer aMode = Draw::Atoi(argv[1]);
5304 //===================================================================
5306 Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
5307 if (aisContext.IsNull())
5309 di <<"Error: call 'vinit' first"<< "\n";
5310 return 1; //TCL_ERROR
5313 if (aisContext->HasOpenedContext())
5315 aisContext->CloseAllContexts();
5316 aisContext->RemoveAll(false);
5317 aisContext->EraseSelected(false, false);
5319 aisContext->EraseAll(false,false);
5320 Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
5321 Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
5323 trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
5324 trihedron->SetSize(20);
5325 trihedron->SetColor(Quantity_NOC_GRAY30);
5326 trihedron->SetArrowColor(Quantity_NOC_GRAY30);
5327 trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
5329 //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5330 //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5331 //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
5334 aisContext->Display(trihedron, true);
5335 aisContext->OpenLocalContext();
5336 //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
5337 aisContext->ActivateStandardMode(TopAbs_EDGE);
5338 aisContext->SetSensitivity(8);
5343 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
5344 const char *group = "QABugs";
5346 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
5348 // Remove as bad version of QAAddOrRemoveSelected from QADraw
5349 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
5351 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
5352 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
5353 theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
5355 //====================================================
5357 // Following commands are inserted from
5358 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
5359 // ( 75455 Apr 16 18:59)
5361 //====================================================
5363 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
5364 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
5366 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
5368 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
5369 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
5370 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
5371 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
5372 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
5373 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
5376 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
5377 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
5378 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
5380 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
5381 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
5382 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
5384 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
5385 theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
5387 theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
5389 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
5391 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
5392 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
5393 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
5394 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
5395 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
5396 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
5397 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
5398 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
5399 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
5400 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
5401 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
5402 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
5403 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
5404 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
5405 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5406 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5407 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5408 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5410 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5411 theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
5412 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5413 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5414 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5415 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5417 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5418 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
5420 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5421 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5422 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5423 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5424 theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
5425 theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
5426 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5427 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5428 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5429 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5430 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5431 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5432 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5433 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5434 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5435 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5436 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5437 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5438 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5439 theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
5440 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5441 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5442 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5443 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5444 theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
5445 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5446 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5447 theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
5448 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);
5449 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5450 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5451 theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);