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";
2745 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2749 di << "Usage : " << argv[0] << "\n";
2753 // 1. Create an array of points
2754 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2755 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2756 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2757 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2758 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2759 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2761 // 2. Create a periodic bspline through these 5 points
2762 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2764 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2766 // 3. Increase degree of curve from 3 to 8
2767 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2768 Standard_CString CString1 = "BSplineCurve";
2769 DrawTrSurf::Set(CString1,bspline1);
2771 // 4. Convers BSpline curve to Bezier segments
2772 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2774 // 5. Test the result of conversion
2775 TCollection_AsciiString aRName;
2776 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2777 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2779 aRName=aRName+TCollection_AsciiString(i);
2780 Standard_CString aRNameStr = aRName.ToCString();
2781 DrawTrSurf::Set(aRNameStr,arc);
2782 di << aRNameStr << " ";
2788 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2792 di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
2795 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2796 if (theEdge1.IsNull()) {
2797 di << "Invalid input shape " << argv[1] << "\n";
2800 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2801 if (theEdge2.IsNull()) {
2802 di << "Invalid input shape " << argv[2] << "\n";
2805 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2806 if (theFace.IsNull()) {
2807 di << "Invalid input shape " << argv[3] << "\n";
2811 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2813 Standard_Real aConfusion = Precision::Confusion();
2814 Standard_Real aP1first, aP1last, aP2first, aP2last;
2816 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2817 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2818 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2819 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2821 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2823 Standard_Integer NbPoints = anInter.NbPoints();
2825 di << "NbPoints = " << NbPoints << "\n" ;
2829 for (i=1; i<=NbPoints; i++) {
2830 gp_Pnt2d aPi = anInter.Point(i);
2831 di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2835 Standard_Integer NbSegments = anInter.NbSegments();
2837 di << "\nNbSegments = " << NbSegments << "\n" ;
2839 if (NbSegments > 0) {
2840 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2842 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2843 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2845 Standard_Real aDist = aP1.Distance(aP2);
2847 di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
2848 di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
2850 di << "Distance = " << aDist << "\n" ;
2852 di << "Confusion = " << aConfusion << "\n" ;
2854 if (aDist > aConfusion) {
2855 di << "\n" << argv[0] << " Faulty" << "\n" ;
2857 di << "\n" << argv[0] << " OK" << "\n" ;
2860 di << "\n" << argv[0] << " OK" << "\n" ;
2865 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2869 di << "Usage : " << argv[0] << " lower upper" << "\n";
2873 Standard_Integer LOWER = Draw::Atoi(argv[1]);
2874 Standard_Integer UPPER = Draw::Atoi(argv[2]);
2876 //! 0. Create an empty document with several test labels
2877 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2878 doc->SetUndoLimit(100);
2879 TDF_Label main_label = doc->Main();
2880 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2881 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2883 //! 1. Set/Get OCAF attribute
2885 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2886 Handle(TDataStd_RealArray) array;
2887 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2888 array->Lower() == LOWER && array->Upper() == UPPER)
2889 cout<<"1: OK"<<endl;
2892 cout<<"1: Failed.."<<endl;
2895 doc->CommitCommand();
2897 //! 2. Set/Get value
2900 for (i = LOWER; i <= UPPER; i++)
2901 array->SetValue(i, i);
2902 for (i = LOWER; i <= UPPER; i++)
2904 if (array->Value(i) != i)
2906 cout<<"2: Failed.."<<endl;
2910 cout<<"2: OK"<<endl;
2911 doc->CommitCommand();
2913 //! 3. Re-init the array
2915 array->Init(LOWER + 2, UPPER + 4);
2916 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2918 cout<<"3: Failed.."<<endl;
2921 for (i = LOWER + 2; i <= UPPER + 4; i++)
2922 array->SetValue(i, i);
2923 for (i = LOWER + 2; i <= UPPER + 4; i++)
2925 if (array->Value(i) != i)
2927 cout<<"3: Failed.."<<endl;
2931 cout<<"3: OK"<<endl;
2932 doc->CommitCommand();
2936 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2937 for (i = LOWER + 5; i <= UPPER + 5; i++)
2938 arr->SetValue(i, i);
2939 array->ChangeArray(arr);
2940 for (i = LOWER + 5; i <= UPPER + 5; i++)
2942 if (array->Value(i) != i)
2944 cout<<"4: Failed.."<<endl;
2948 cout<<"4: OK"<<endl;
2949 doc->CommitCommand();
2951 //! 5. Copy the array
2953 TDF_CopyLabel copier(label1, label2);
2955 if (!copier.IsDone())
2957 cout<<"5: Failed.."<<endl;
2960 Handle(TDataStd_RealArray) array2;
2961 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2963 cout<<"5: Failed.."<<endl;
2966 for (i = LOWER + 5; i <= UPPER + 5; i++)
2968 if (array->Value(i) != i)
2970 cout<<"5: Failed.."<<endl;
2974 cout<<"5: OK"<<endl;
2975 doc->CommitCommand();
2978 //! 6.a: undoes the 5th action: the copied array should disappear
2980 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2981 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2983 cout<<"6.a: Failed.."<<endl;
2986 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2988 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2989 array->Lower() != LOWER + 2 ||
2990 array->Upper() != UPPER + 4)
2992 cout<<"6.b: Failed.."<<endl;
2995 for (i = LOWER + 2; i <= UPPER + 4; i++)
2997 if (array->Value(i) != i)
2999 cout<<"6.b: Failed.."<<endl;
3003 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
3005 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3006 array->Lower() != LOWER ||
3007 array->Upper() != UPPER)
3009 cout<<"6.c: Failed.."<<endl;
3012 for (i = LOWER; i <= UPPER; i++)
3014 if (array->Value(i) != i)
3016 cout<<"6.c: Failed.."<<endl;
3020 //! 6.d: undoes and redoes the 2nd action: no change is expected.
3023 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3024 array->Lower() != LOWER ||
3025 array->Upper() != UPPER)
3027 cout<<"6.d: Failed.."<<endl;
3030 for (i = LOWER; i <= UPPER; i++)
3032 if (array->Value(i) != i)
3034 cout<<"6.d: Failed.."<<endl;
3038 cout<<"6: OK"<<endl;
3040 //! 7. Re-set the array
3042 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
3043 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
3045 cout<<"7: Failed.."<<endl;
3048 for (i = LOWER + 1; i <= UPPER + 1; i++)
3049 array->SetValue(i, i);
3050 for (i = LOWER + 1; i <= UPPER + 1; i++)
3052 if (array->Value(i) != i)
3054 cout<<"7: Failed.."<<endl;
3058 cout<<"7: OK"<<endl;
3059 doc->CommitCommand();
3061 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
3062 //! measure the time spent by this test.
3068 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3070 Standard_Boolean IsEvenArgc = Standard_True;
3071 if (argc % 2 == 0) {
3072 IsEvenArgc = Standard_True;
3074 IsEvenArgc = Standard_False;
3077 if (argc < 3 || IsEvenArgc)
3079 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
3083 Standard_Integer i, aValue, aPosition;
3084 NCollection_Vector<int> vec;
3085 for (i = 0; i < argc - 1; i++) {
3087 aValue = Draw::Atoi(argv[i]);
3088 aPosition = Draw::Atoi(argv[i+1]);
3089 vec.SetValue(aValue, aPosition);
3091 NCollection_Vector<int>::Iterator it(vec);
3093 for (j = 0; it.More(); it.Next(), j++) {
3094 //di << it.Value() << "\n";
3095 di << j << " " << it.Value() << "\n";
3101 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3104 di << "Usage : " << argv[0] << "\n";
3108 gp_Pnt point(0.0,0.0,0.0);
3110 TColgp_Array1OfPnt poles(0,6);
3113 point.SetCoord(1.0,1.0,0.0);
3116 point.SetCoord(2.0,1.0,0.0);
3119 point.SetCoord(3.0,0.0,0.0);
3122 point.SetCoord(4.0,1.0,0.0);
3125 point.SetCoord(5.0,1.0,0.0);
3128 point.SetCoord(6.0,0.0,0.0);
3131 TColStd_Array1OfReal knots(0,2);
3136 TColStd_Array1OfInteger multi(0,2);
3141 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
3144 Standard_Real l_abcissa,l_gprop;
3145 GeomAdaptor_Curve adaptor_spline(spline);
3146 GCPnts_AbscissaPoint temp;
3147 l_abcissa=temp.Length(adaptor_spline);
3148 cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
3151 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
3153 BRepGProp::LinearProperties(edge,prop);
3154 l_gprop=prop.Mass();
3155 cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
3157 cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
3162 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3166 di << "Usage : " << argv[0] << "\n";
3170 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3171 if(AISContext.IsNull())
3173 di << "use 'vinit' command before " << argv[0] << "\n";
3178 AIS_ListOfInteractive ListOfIO_1;
3179 AISContext->ObjectsInside(ListOfIO_1);
3180 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3181 if (!ListOfIO_1.IsEmpty() ) {
3182 AIS_ListIteratorOfListOfInteractive iter;
3183 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3184 Handle(AIS_InteractiveObject) aIO=iter.Value();
3185 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3189 // ObjectsInCollector
3190 AIS_ListOfInteractive ListOfIO_2;
3191 AISContext->ObjectsInCollector(ListOfIO_2);
3192 di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
3193 if (!ListOfIO_2.IsEmpty() ) {
3194 AIS_ListIteratorOfListOfInteractive iter;
3195 for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
3196 Handle(AIS_InteractiveObject) aIO=iter.Value();
3197 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3204 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3206 if ((argc < 9) || (((argc-3) % 3) != 0))
3208 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3211 Standard_Integer i, j, np = (argc-3) / 3;
3212 BRepBuilderAPI_MakePolygon W;
3214 for (i = 1; i <= np; i ++) {
3215 W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2])));
3219 DBRep::Set(argv[1],W.Wire());
3220 DBRep::Set(argv[2],W.Edge());
3224 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3227 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3230 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3231 gp_Dir(1., -1., 0.));
3233 aTrf.SetAffinity (aPln, Draw::Atof(argv[4]));
3234 gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3235 gp_XYZ aResult (aOrigin);
3236 aTrf.Transforms(aResult);
3238 Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3239 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3240 aResult.X(), aResult.Y(), aResult.Z());
3245 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3248 di << "Usage : " << argv[0] << " shape [deflection]\n";
3252 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3254 if (aShape.IsNull()) {
3255 di<<" Null shape is not allowed";
3259 Standard_Real aDeflection = 0.45110277533;
3261 aDeflection = Draw::Atof(argv[2]);
3263 di<<"deflection="<< aDeflection << "\n";
3265 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
3266 TopLoc_Location aLocation;
3267 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3269 if(aTriang.IsNull()) {
3270 di << argv[0] << " : Faulty\n" ;
3272 di << argv[0] << " : OK\n" ;
3273 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3274 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3279 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3282 di << "Usage : " << argv[0] << " A B C\n";
3287 gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3288 gp_Pnt2d anOrigin = aLin2d.Location();
3289 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3291 catch(Standard_ConstructionError)
3293 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3298 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3301 di << "Usage : " << argv[0] << " file shape\n";
3305 IGESControl_Reader aReader;
3306 aReader.ReadFile(argv[1]);
3307 aReader.SetReadVisible(Standard_True);
3308 aReader.TransferRoots();
3310 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3311 if (model.IsNull()) {
3312 di << "model.IsNull()\n";
3315 Standard_Integer nb = model->NbEntities();
3316 for (Standard_Integer i = 1; i <= nb; i ++) {
3317 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3318 Handle(TCollection_HAsciiString) name;
3319 name = ent->NameValue();
3320 Standard_CString aStr = name->ToCString();
3321 di << "NameValue = " << aStr << "\n";
3324 TopoDS_Shape shape = aReader.OneShape();
3325 DBRep::Set(argv[2],shape);
3329 // For OCC16782 testing
3330 #include <AppStd_Application.hxx>
3331 #include <TDF_Tool.hxx>
3332 #include <TColStd_HArray1OfInteger.hxx>
3334 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3335 #include <TColStd_ListIteratorOfListOfReal.hxx>
3336 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3337 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3338 #include <TDF_ListIteratorOfLabelList.hxx>
3340 #include <TDataStd_Tick.hxx>
3341 #include <TDataStd_IntegerList.hxx>
3342 #include <TDataStd_RealList.hxx>
3343 #include <TDataStd_ExtStringList.hxx>
3344 #include <TDataStd_BooleanList.hxx>
3345 #include <TDataStd_ReferenceList.hxx>
3346 #include <TDataStd_BooleanArray.hxx>
3347 #include <TDataStd_ReferenceArray.hxx>
3348 #include <TDataStd_ByteArray.hxx>
3349 #include <TDataStd_NamedData.hxx>
3350 #include <TDF_Reference.hxx>
3352 Handle(AppStd_Application) app;
3353 int TestSetGet(const Handle(TDocStd_Document)& doc)
3357 TDataStd_Tick::Set(doc->Main());
3359 Handle(TDataStd_Tick) tick;
3360 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3363 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3364 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3366 doc->Main().ResumeAttribute(tick);
3367 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3370 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3371 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3374 // TDataStd_IntegerList:
3376 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3377 setintlist->Append(2);
3378 setintlist->Prepend(1);
3379 setintlist->InsertAfter(3, 2);
3380 setintlist->InsertBefore(0, 1);
3381 setintlist->Append(200);
3382 setintlist->Remove(0);
3383 setintlist->Remove(200);
3385 Handle(TDataStd_IntegerList) getintlist;
3386 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3388 if (getintlist->First() != 1)
3390 if (getintlist->Last() != 3)
3392 const TColStd_ListOfInteger& intlist = getintlist->List();
3393 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3394 for (; itr_intlist.More(); itr_intlist.Next())
3396 if (itr_intlist.Value() != 1 &&
3397 itr_intlist.Value() != 2 &&
3398 itr_intlist.Value() != 3)
3403 getintlist->Clear();
3405 // TDataStd_RealList:
3407 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3408 setdbllist->Append(2.5);
3409 setdbllist->Prepend(1.5);
3410 setdbllist->InsertAfter(3.5, 2.5);
3411 setdbllist->InsertBefore(0.5, 1.5);
3412 setdbllist->Append(200.5);
3413 setdbllist->Remove(0.5);
3414 setdbllist->Remove(200.5);
3416 Handle(TDataStd_RealList) getdbllist;
3417 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3419 if (getdbllist->First() != 1.5)
3421 if (getdbllist->Last() != 3.5)
3423 const TColStd_ListOfReal& dbllist = getdbllist->List();
3424 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3425 for (; itr_dbllist.More(); itr_dbllist.Next())
3427 if (itr_dbllist.Value() != 1.5 &&
3428 itr_dbllist.Value() != 2.5 &&
3429 itr_dbllist.Value() != 3.5)
3434 getdbllist->Clear();
3436 // TDataStd_ExtStringList:
3438 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3439 setstrlist->Append("Hello");
3440 setstrlist->Prepend("Guten Tag");
3441 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3442 setstrlist->InsertBefore("Bonsoir", "Hello");
3443 setstrlist->Append("Good bye");
3444 setstrlist->Remove("Bonsoir");
3445 setstrlist->Remove("Good bye");
3447 Handle(TDataStd_ExtStringList) getstrlist;
3448 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3450 if (getstrlist->First() != "Guten Tag")
3452 if (getstrlist->Last() != "Hello")
3454 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3455 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3456 for (; itr_strlist.More(); itr_strlist.Next())
3458 if (itr_strlist.Value() != "Guten Tag" &&
3459 itr_strlist.Value() != "Bonjour" &&
3460 itr_strlist.Value() != "Hello")
3465 getstrlist->Clear();
3467 // TDataStd_BooleanList:
3469 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3470 setboollist->Append(Standard_True);
3471 setboollist->Prepend(Standard_False);
3473 Handle(TDataStd_BooleanList) getboollist;
3474 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3476 if (getboollist->First() != Standard_False)
3478 if (getboollist->Last() != Standard_True)
3480 const TDataStd_ListOfByte& boollist = getboollist->List();
3481 TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
3482 for (; itr_boollist.More(); itr_boollist.Next())
3484 if (itr_boollist.Value() != Standard_True &&
3485 itr_boollist.Value() != Standard_False)
3490 getboollist->Clear();
3492 // TDataStd_ReferenceList:
3493 TDF_Label L1 = doc->Main().FindChild(100);
3494 TDF_Label L2 = doc->Main().FindChild(101);
3495 TDF_Label L3 = doc->Main().FindChild(102);
3496 TDF_Label L4 = doc->Main().FindChild(103);
3497 TDF_Label L5 = doc->Main().FindChild(104);
3499 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3500 setreflist->Append(L1);
3501 setreflist->Prepend(L2);
3502 setreflist->InsertAfter(L3, L2);
3503 setreflist->InsertBefore(L4, L1);
3504 setreflist->Append(L5);
3505 setreflist->Remove(L4);
3506 setreflist->Remove(L5);
3508 Handle(TDataStd_ReferenceList) getreflist;
3509 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3511 if (getreflist->First() != L2)
3513 if (getreflist->Last() != L1)
3515 const TDF_LabelList& reflist = getreflist->List();
3516 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3517 for (; itr_reflist.More(); itr_reflist.Next())
3519 if (itr_reflist.Value() != L1 &&
3520 itr_reflist.Value() != L2 &&
3521 itr_reflist.Value() != L3)
3526 getreflist->Clear();
3528 // TDataStd_BooleanArray:
3530 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3531 setboolarr->SetValue(12, Standard_True);
3532 setboolarr->SetValue(13, Standard_False);
3533 setboolarr->SetValue(14, Standard_False);
3534 setboolarr->SetValue(15, Standard_False);
3535 setboolarr->SetValue(16, Standard_True);
3536 setboolarr->SetValue(14, Standard_True);
3538 Handle(TDataStd_BooleanArray) getboolarr;
3539 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3541 if (getboolarr->Value(12) != Standard_True)
3543 if (getboolarr->Value(13) != Standard_False)
3545 if (getboolarr->Value(14) != Standard_True)
3547 if (getboolarr->Value(15) != Standard_False)
3549 if (getboolarr->Value(16) != Standard_True)
3552 // TDataStd_ReferenceArray:
3554 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3555 setrefarr->SetValue(0, L1);
3556 setrefarr->SetValue(1, L2);
3557 setrefarr->SetValue(2, L3);
3558 setrefarr->SetValue(3, L4);
3559 setrefarr->SetValue(4, L5);
3561 Handle(TDataStd_ReferenceArray) getrefarr;
3562 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3564 if (getrefarr->Value(0) != L1)
3566 if (getrefarr->Value(1) != L2)
3568 if (getrefarr->Value(2) != L3)
3570 if (getrefarr->Value(3) != L4)
3572 if (getrefarr->Value(4) != L5)
3575 // TDataStd_ByteArray:
3577 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3578 setbytearr->SetValue(12, 0);
3579 setbytearr->SetValue(13, 1);
3580 setbytearr->SetValue(14, 2);
3581 setbytearr->SetValue(15, 3);
3582 setbytearr->SetValue(16, 255);
3584 Handle(TDataStd_ByteArray) getbytearr;
3585 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3587 if (getbytearr->Value(12) != 0)
3589 if (getbytearr->Value(13) != 1)
3591 if (getbytearr->Value(14) != 2)
3593 if (getbytearr->Value(15) != 3)
3595 if (getbytearr->Value(16) != 255)
3598 // TDataStd_NamedData:
3600 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3601 setnd->SetInteger("Integer1", 1);
3602 setnd->SetInteger("Integer2", 2);
3603 setnd->SetInteger("Integer3", 8);
3604 setnd->SetInteger("Integer3", 3);
3606 Handle(TDataStd_NamedData) getnd;
3607 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3609 if (!getnd->HasIntegers())
3611 if (!getnd->HasInteger("Integer1"))
3613 if (getnd->GetInteger("Integer2") != 2)
3615 if (getnd->GetInteger("Integer3") != 3)
3621 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3625 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3626 doc->CommitCommand();
3627 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3630 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3633 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3636 // TDataStd_IntegerList:
3638 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3640 intlist->Prepend(1);
3641 intlist->InsertBefore(0, 1);
3642 intlist->InsertAfter(3, 2);
3643 doc->CommitCommand();
3644 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3647 if (!intlist->IsEmpty())
3650 if (!intlist->Extent())
3652 if (intlist->First() != 0)
3654 if (intlist->Last() != 3)
3658 // TDataStd_RealList:
3660 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3661 dbllist->Append(2.5);
3662 dbllist->Prepend(1.5);
3663 dbllist->InsertBefore(0.5, 1.5);
3664 dbllist->InsertAfter(3.5, 2.5);
3665 doc->CommitCommand();
3666 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3669 if (!dbllist->IsEmpty())
3672 if (!dbllist->Extent())
3674 if (dbllist->First() != 0.5)
3676 if (dbllist->Last() != 3.5)
3680 // TDataStd_ExtStringList:
3682 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3683 strlist->Append("Hello");
3684 strlist->Prepend("Guten Tag");
3685 strlist->InsertAfter("Bonjour", "Guten Tag");
3686 strlist->InsertBefore("Bonsoir", "Hello");
3687 doc->CommitCommand();
3688 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3691 if (!strlist->IsEmpty())
3694 if (!strlist->Extent())
3696 if (strlist->First() != "Guten Tag")
3698 if (strlist->Last() != "Hello")
3702 // TDataStd_BooleanList:
3704 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3705 boollist->Append(Standard_True);
3706 boollist->Prepend(Standard_False);
3707 doc->CommitCommand();
3708 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3711 if (!boollist->IsEmpty())
3714 if (!boollist->Extent())
3716 if (boollist->First() != Standard_False)
3718 if (boollist->Last() != Standard_True)
3722 // TDataStd_ReferenceList:
3723 TDF_Label L1 = doc->Main().FindChild(100);
3724 TDF_Label L2 = doc->Main().FindChild(101);
3725 TDF_Label L3 = doc->Main().FindChild(102);
3726 TDF_Label L4 = doc->Main().FindChild(103);
3728 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3729 reflist->Append(L1);
3730 reflist->Prepend(L2);
3731 reflist->InsertBefore(L3, L1);
3732 reflist->InsertAfter(L4, L2);
3733 doc->CommitCommand();
3734 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3737 if (!reflist->IsEmpty())
3740 if (!reflist->Extent())
3742 if (reflist->First() != L2)
3744 if (reflist->Last() != L1)
3748 // TDataStd_BooleanArray:
3750 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3751 boolarr->SetValue(23, Standard_True);
3752 boolarr->SetValue(25, Standard_True);
3753 doc->CommitCommand();
3755 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3756 boolarr->SetValue(230, Standard_True);
3757 boolarr->SetValue(250, Standard_True);
3758 doc->CommitCommand();
3760 if (boolarr->Value(23) != Standard_True)
3762 if (boolarr->Value(24) != Standard_False)
3764 if (boolarr->Value(25) != Standard_True)
3767 if (boolarr->Value(230) != Standard_True)
3769 if (boolarr->Value(240) != Standard_False)
3771 if (boolarr->Value(250) != Standard_True)
3774 // TDataStd_ReferenceArray:
3776 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3777 refarr->SetValue(5, L1);
3778 refarr->SetValue(6, L2);
3779 refarr->SetValue(7, L3);
3780 refarr->SetValue(8, L4);
3781 doc->CommitCommand();
3782 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3786 if (refarr->Value(5) != L1)
3788 if (refarr->Value(6) != L2)
3790 if (refarr->Value(7) != L3)
3792 if (refarr->Value(8) != L4)
3795 // TDataStd_ByteArray:
3797 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3798 bytearr->SetValue(23, 23);
3799 bytearr->SetValue(25, 25);
3800 doc->CommitCommand();
3802 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3803 bytearr->SetValue(230, 230);
3804 bytearr->SetValue(250, 250);
3805 doc->CommitCommand();
3807 if (bytearr->Value(23) != 23)
3809 if (bytearr->Value(25) != 25)
3812 if (bytearr->Value(230) != 230)
3814 if (bytearr->Value(250) != 250)
3817 // TDataStd_NamedData:
3819 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3820 nd->SetByte("b14", 12);
3821 nd->SetByte("b17", 18);
3822 nd->SetByte("b14", 14);
3823 nd->SetByte("b17", 17);
3824 doc->CommitCommand();
3826 nd = TDataStd_NamedData::Set(doc->Main());
3827 nd->SetReal("r14", 14);
3828 nd->SetReal("r17", 17);
3829 nd->SetReal("r14", 14.4);
3830 nd->SetReal("r17", 17.7);
3831 doc->CommitCommand();
3833 if (nd->HasStrings())
3837 if (nd->HasReal("r17"))
3839 if (!nd->HasBytes())
3841 if (nd->GetByte("b14") != 14)
3843 if (nd->GetByte("b17") != 17)
3845 if (nd->HasByte("b18"))
3848 if (!nd->HasBytes())
3850 if (!nd->HasReals())
3852 if (nd->GetByte("b14") != 14)
3854 if (nd->GetReal("r14") != 14.4)
3856 if (nd->GetReal("r17") != 17.7)
3862 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3864 TDF_Label L1 = doc->Main().FindChild(1);
3865 TDF_Label L2 = doc->Main().FindChild(2);
3866 TDF_CopyLabel copier(L1, L2);
3869 TDataStd_Tick::Set(L1);
3871 if (!copier.IsDone())
3873 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3876 // TDataStd_IntegerList:
3877 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3879 intlist->InsertAfter(2, 1);
3881 if (!copier.IsDone())
3885 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3887 if (intlist->First() != 1)
3889 if (intlist->Last() != 2)
3893 // TDataStd_RealList:
3894 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3895 dbllist->Append(1.5);
3896 dbllist->InsertAfter(2.5, 1.5);
3898 if (!copier.IsDone())
3902 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3904 if (dbllist->First() != 1.5)
3906 if (dbllist->Last() != 2.5)
3910 // TDataStd_ExtStringList:
3911 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3912 strlist->Append("Open CASCADE");
3913 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3915 if (!copier.IsDone())
3919 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3921 if (strlist->First() != "Open CASCADE")
3923 if (strlist->Last() != " - is the best set of libraries!")
3927 // TDataStd_BooleanList:
3928 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3929 boollist->Append(Standard_True);
3930 boollist->Prepend(Standard_False);
3932 if (!copier.IsDone())
3936 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3938 if (boollist->First() != Standard_False)
3940 if (boollist->Last() != Standard_True)
3944 // TDataStd_ReferenceList:
3945 TDF_Label L100 = doc->Main().FindChild(100);
3946 TDF_Label L101 = doc->Main().FindChild(101);
3947 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3948 reflist->Append(L100);
3949 reflist->InsertAfter(L101, L100);
3951 if (!copier.IsDone())
3955 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3957 if (reflist->First() != L100)
3959 if (reflist->Last() != L101)
3963 // TDataStd_BooleanArray:
3964 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3965 boolarr->SetValue(4, Standard_True);
3966 boolarr->SetValue(6, Standard_True);
3968 if (!copier.IsDone())
3971 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3973 if (boolarr->Value(4) != Standard_True)
3975 if (boolarr->Value(5) != Standard_False)
3977 if (boolarr->Value(6) != Standard_True)
3980 // TDataStd_ReferenceArray:
3981 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3982 refarr->SetValue(3, L100);
3983 refarr->SetValue(4, L101);
3985 if (!copier.IsDone())
3988 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3990 if (refarr->Value(3) != L100)
3992 if (refarr->Value(4) != L101)
3995 // TDataStd_ByteArray:
3996 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
3997 bytearr->SetValue(4, 40);
3998 bytearr->SetValue(6, 60);
4000 if (!copier.IsDone())
4003 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4005 if (bytearr->Value(4) != 40)
4007 if (bytearr->Value(6) != 60)
4010 // TDataStd_NamedData:
4011 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
4012 nd->SetInteger("Integer1", 11);
4013 nd->SetReal("Real1", 11.1);
4014 nd->SetString("String1", "11.11111111");
4015 nd->SetByte("Byte1", 111);
4016 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
4017 ints_arr->SetValue(4, 4);
4018 ints_arr->SetValue(5, 5);
4019 nd->SetArrayOfIntegers("Integers1", ints_arr);
4021 if (!copier.IsDone())
4024 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
4026 if (!nd->HasIntegers())
4028 if (!nd->HasReals())
4030 if (!nd->HasStrings())
4032 if (!nd->HasBytes())
4034 if (!nd->HasArraysOfIntegers())
4036 if (nd->HasArraysOfReals())
4038 if (!nd->HasInteger("Integer1"))
4040 if (nd->GetInteger("Integer1") != 11)
4042 if (!nd->HasReal("Real1"))
4044 if (nd->GetReal("Real1") != 11.1)
4046 if (!nd->HasString("String1"))
4048 if (nd->GetString("String1") != "11.11111111")
4050 if (!nd->HasByte("Byte1"))
4052 if (nd->GetByte("Byte1") != 111)
4054 if (!nd->HasArrayOfIntegers("Integers1"))
4056 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
4057 if (ints_arr_out.IsNull())
4059 if (ints_arr_out->Value(5) != 5)
4065 int TestOpenSave(TCollection_ExtendedString aFile1,
4066 TCollection_ExtendedString aFile2,
4067 TCollection_ExtendedString aFile3)
4070 Handle(TDocStd_Document) doc_std, doc_std_open;
4071 app->NewDocument("MDTV-Standard", doc_std);
4073 TDataStd_Tick::Set(doc_std->Main());
4074 // TDataStd_IntegerList:
4075 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
4078 // TDataStd_RealList:
4079 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
4080 dbllist->Append(1.5);
4081 dbllist->Append(5.5);
4082 // TDataStd_ExtStringList:
4083 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
4084 strlist->Append("Auf");
4085 strlist->Append("Wiedersehen");
4086 // TDataStd_BooleanList:
4087 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
4088 boollist->Append(Standard_False);
4089 boollist->Append(Standard_True);
4090 // TDataStd_ReferenceList:
4091 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
4092 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
4093 TDF_Tool::Entry(Lstd1, entry1);
4094 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
4095 TDF_Tool::Entry(Lstd2, entry2);
4096 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
4097 reflist->Append(Lstd1);
4098 reflist->Append(Lstd2);
4099 // TDataStd_BooleanArray:
4100 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
4101 boolarr->SetValue(15, Standard_False);
4102 boolarr->SetValue(16, Standard_True);
4103 boolarr->SetValue(17, Standard_True);
4104 boolarr->SetValue(18, Standard_True);
4105 // TDataStd_ReferenceArray:
4106 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
4107 refarr->SetValue(45, Lstd1);
4108 refarr->SetValue(46, Lstd2);
4109 // TDataStd_ByteArray:
4110 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
4111 bytearr->SetValue(15, 150);
4112 bytearr->SetValue(16, 160);
4113 bytearr->SetValue(17, 170);
4114 bytearr->SetValue(18, 180);
4115 // TDataStd_NamedData:
4116 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
4118 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
4119 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
4122 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
4123 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
4132 app->Close(doc_std);
4134 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
4135 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
4137 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4139 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4141 if (intlist->First() != 1)
4143 if (intlist->Last() != 5)
4145 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4147 if (dbllist->First() != 1.5)
4149 if (dbllist->Last() != 5.5)
4151 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4153 if (strlist->First() != "Auf")
4155 if (strlist->Last() != "Wiedersehen")
4157 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4159 if (boollist->First() != Standard_False)
4161 if (boollist->Last() != Standard_True)
4163 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4165 TDF_Tool::Entry(reflist->First(), entry_first);
4166 if (entry1 != entry_first)
4168 TDF_Tool::Entry(reflist->Last(), entry_last);
4169 if (entry2 != entry_last)
4171 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4173 if (boolarr->Value(15) != Standard_False)
4175 if (boolarr->Value(16) != Standard_True)
4177 if (boolarr->Value(17) != Standard_True)
4179 if (boolarr->Value(18) != Standard_True)
4181 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4183 TDF_Tool::Entry(refarr->Value(45), entry_first);
4184 if (entry1 != entry_first)
4186 TDF_Tool::Entry(refarr->Value(46), entry_last);
4187 if (entry2 != entry_last)
4189 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4191 if (bytearr->Value(15) != 150)
4193 if (bytearr->Value(16) != 160)
4195 if (bytearr->Value(17) != 170)
4197 if (bytearr->Value(18) != 180)
4199 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4201 if (ref->Get().IsNull())
4203 if (ref->Get().Tag() != 103)
4207 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4208 app->NewDocument("XmlOcaf", doc_xml);
4210 TDataStd_Tick::Set(doc_xml->Main());
4211 // TDataStd_IntegerList:
4212 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4215 // TDataStd_RealList:
4216 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4217 dbllist->Append(1.5);
4218 dbllist->Append(5.5);
4219 // TDataStd_ExtStringList:
4220 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4221 strlist->Append("Guten ");
4222 strlist->Append("Tag");
4223 // TDataStd_BooleanList:
4224 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4225 boollist->Append(Standard_False);
4226 boollist->Append(Standard_True);
4227 // TDataStd_ReferenceList:
4228 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4229 TDF_Tool::Entry(Lxml1, entry1);
4230 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4231 TDF_Tool::Entry(Lxml2, entry2);
4232 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4233 reflist->Append(Lxml1);
4234 reflist->Append(Lxml2);
4235 // TDataStd_BooleanArray:
4236 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4237 boolarr->SetValue(15, Standard_False);
4238 boolarr->SetValue(16, Standard_True);
4239 boolarr->SetValue(17, Standard_True);
4240 boolarr->SetValue(18, Standard_True);
4241 boolarr->SetValue(19, Standard_True);
4242 boolarr->SetValue(20, Standard_True);
4243 boolarr->SetValue(21, Standard_False);
4244 boolarr->SetValue(22, Standard_True);
4245 boolarr->SetValue(23, Standard_True);
4246 boolarr->SetValue(24, Standard_True);
4247 // TDataStd_ReferenceArray:
4248 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4249 refarr->SetValue(444, Lxml1);
4250 refarr->SetValue(445, Lxml2);
4251 // TDataStd_ByteArray:
4252 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4253 bytearr->SetValue(15, 0);
4254 bytearr->SetValue(16, 10);
4255 bytearr->SetValue(17, 100);
4256 bytearr->SetValue(18, 200);
4257 bytearr->SetValue(19, 250);
4258 bytearr->SetValue(20, 251);
4259 bytearr->SetValue(21, 252);
4260 bytearr->SetValue(22, 253);
4261 bytearr->SetValue(23, 254);
4262 bytearr->SetValue(24, 255);
4264 Lstd3 = doc_xml->Main().FindChild(103);
4265 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4268 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4269 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4273 app->Close(doc_xml);
4275 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4276 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4278 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4280 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4282 if (intlist->First() != 1)
4284 if (intlist->Last() != 5)
4286 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4288 if (dbllist->First() != 1.5)
4290 if (dbllist->Last() != 5.5)
4292 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4294 if (strlist->First() != "Guten ")
4296 if (strlist->Last() != "Tag")
4298 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4300 if (boollist->First() != Standard_False)
4302 if (boollist->Last() != Standard_True)
4304 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4306 TDF_Tool::Entry(reflist->First(), entry_first);
4307 if (entry1 != entry_first)
4309 TDF_Tool::Entry(reflist->Last(), entry_last);
4310 if (entry2 != entry_last)
4312 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4314 if (boolarr->Value(15) != Standard_False)
4316 if (boolarr->Value(16) != Standard_True)
4318 if (boolarr->Value(17) != Standard_True)
4320 if (boolarr->Value(18) != Standard_True)
4322 if (boolarr->Value(19) != Standard_True)
4324 if (boolarr->Value(20) != Standard_True)
4326 if (boolarr->Value(21) != Standard_False)
4328 if (boolarr->Value(22) != Standard_True)
4330 if (boolarr->Value(23) != Standard_True)
4332 if (boolarr->Value(24) != Standard_True)
4334 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4336 TDF_Tool::Entry(refarr->Value(444), entry_first);
4337 if (entry1 != entry_first)
4339 TDF_Tool::Entry(refarr->Value(445), entry_last);
4340 if (entry2 != entry_last)
4342 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4344 if (bytearr->Value(15) != 0)
4346 if (bytearr->Value(16) != 10)
4348 if (bytearr->Value(17) != 100)
4350 if (bytearr->Value(18) != 200)
4352 if (bytearr->Value(19) != 250)
4354 if (bytearr->Value(20) != 251)
4356 if (bytearr->Value(21) != 252)
4358 if (bytearr->Value(22) != 253)
4360 if (bytearr->Value(23) != 254)
4362 if (bytearr->Value(24) != 255)
4364 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4366 if (ref->Get().IsNull())
4368 if (ref->Get().Tag() != 103)
4372 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4373 app->NewDocument("BinOcaf", doc_bin);
4375 TDataStd_Tick::Set(doc_bin->Main());
4376 // TDataStd_IntegerList:
4377 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4380 // TDataStd_RealList:
4381 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4382 dbllist->Append(1.5);
4383 dbllist->Append(5.5);
4384 // TDataStd_ExtStringList:
4385 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4386 strlist->Append("Bonjour");
4387 strlist->Append("Bonsoir");
4388 // TDataStd_BooleanList:
4389 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4390 boollist->Append(Standard_False);
4391 boollist->Append(Standard_True);
4392 // TDataStd_ReferenceList:
4393 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4394 TDF_Tool::Entry(Lbin1, entry1);
4395 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4396 TDF_Tool::Entry(Lbin2, entry2);
4397 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4398 reflist->Append(Lbin1);
4399 reflist->Append(Lbin2);
4400 // TDataStd_BooleanArray:
4401 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4402 boolarr->SetValue(15, Standard_False);
4403 boolarr->SetValue(16, Standard_True);
4404 boolarr->SetValue(17, Standard_True);
4405 boolarr->SetValue(18, Standard_True);
4406 boolarr->SetValue(19, Standard_True);
4407 boolarr->SetValue(20, Standard_True);
4408 boolarr->SetValue(21, Standard_False);
4409 boolarr->SetValue(22, Standard_True);
4410 boolarr->SetValue(23, Standard_True);
4411 boolarr->SetValue(24, Standard_True);
4412 // TDataStd_ReferenceArray:
4413 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4414 refarr->SetValue(0, Lbin1);
4415 refarr->SetValue(1, Lbin2);
4416 // TDataStd_ByteArray:
4417 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4418 bytearr->SetValue(15, 0);
4419 bytearr->SetValue(16, 255);
4420 // TDataStd_NamedData:
4421 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4422 nameddata->SetByte("A", 12);
4423 nameddata->SetByte("B", 234);
4425 Lstd3 = doc_bin->Main().FindChild(103);
4426 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4429 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4430 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4434 app->Close(doc_bin);
4436 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4437 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4439 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4441 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4443 if (intlist->First() != 1)
4445 if (intlist->Last() != 5)
4447 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4449 if (dbllist->First() != 1.5)
4451 if (dbllist->Last() != 5.5)
4453 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4455 if (strlist->First() != "Bonjour")
4457 if (strlist->Last() != "Bonsoir")
4459 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4461 if (boollist->First() != Standard_False)
4463 if (boollist->Last() != Standard_True)
4465 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4467 TDF_Tool::Entry(reflist->First(), entry_first);
4468 if (entry1 != entry_first)
4470 TDF_Tool::Entry(reflist->Last(), entry_last);
4471 if (entry2 != entry_last)
4473 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4475 if (boolarr->Value(15) != Standard_False)
4477 if (boolarr->Value(16) != Standard_True)
4479 if (boolarr->Value(17) != Standard_True)
4481 if (boolarr->Value(18) != Standard_True)
4483 if (boolarr->Value(19) != Standard_True)
4485 if (boolarr->Value(20) != Standard_True)
4487 if (boolarr->Value(21) != Standard_False)
4489 if (boolarr->Value(22) != Standard_True)
4491 if (boolarr->Value(23) != Standard_True)
4493 if (boolarr->Value(24) != Standard_True)
4495 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4497 TDF_Tool::Entry(refarr->Value(0), entry_first);
4498 if (entry1 != entry_first)
4500 TDF_Tool::Entry(refarr->Value(1), entry_last);
4501 if (entry2 != entry_last)
4503 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4505 if (bytearr->Value(15) != 0)
4507 if (bytearr->Value(16) != 255)
4509 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4511 if (nameddata->GetByte("A") != 12)
4513 if (nameddata->GetByte("B") != 234)
4515 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4517 if (ref->Get().IsNull())
4519 if (ref->Get().Tag() != 103)
4524 // For OCC16782 testing
4526 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4530 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4533 TCollection_ExtendedString aFile1(argv[1]);
4534 TCollection_ExtendedString aFile2(argv[2]);
4535 TCollection_ExtendedString aFile3(argv[3]);
4538 app = new AppStd_Application();
4542 Handle(TDocStd_Document) doc;
4543 app->NewDocument("MDTV-Standard", doc);
4544 doc->SetUndoLimit(10);
4546 di <<"\nTestSetGet start\n";
4547 good += TestSetGet(doc);
4548 di <<"TestSetGet finish\n";
4549 di <<"Status = " << good << "\n";
4551 di <<"\nTestUndoRedo start\n";
4552 good += TestUndoRedo(doc);
4553 di <<"TestUndoRedo finish\n";
4554 di <<"Status = " << good << "\n";
4556 di <<"\nTestCopyPaste start\n";
4557 good += TestCopyPaste(doc);
4558 di <<"TestCopyPaste finish\n";
4559 di <<"Status = " << good << "\n";
4561 di <<"\nTestOpenSave start\n";
4562 good += TestOpenSave(aFile1, aFile2, aFile3);
4563 di <<"TestOpenSave finish\n";
4564 di <<"Status = " << good << "\n";
4567 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4569 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4574 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4576 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4577 if(aContext.IsNull()) {
4578 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
4584 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4587 Standard_Integer mode = 0;
4590 mode = Draw::Atoi(argv[1]);
4592 if (mode > 2 || mode < 0)
4594 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4597 Handle(V3d_View) V = ViewerTest::CurrentView();
4598 if ( !V.IsNull() ) {
4600 V->ColorScaleDisplay();
4603 V->ColorScaleErase();
4608 Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
4610 di <<"ColorScaleIsDisplayed = " << "1" << "\n";
4612 di <<"ColorScaleIsDisplayed = " << "0" << "\n";
4618 #include <Interface_Macros.hxx>
4619 #include <IGESControl_Controller.hxx>
4620 #include <XSDRAW.hxx>
4621 #include <Draw_ProgressIndicator.hxx>
4622 #include <XSControl_WorkSession.hxx>
4623 #include <Transfer_TransientProcess.hxx>
4624 #include <XSDRAW_Commands.hxx>
4625 #include <TColStd_HSequenceOfTransient.hxx>
4626 #include <Message_ProgressSentry.hxx>
4627 #include <XSControl_TransferReader.hxx>
4629 static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4631 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
4632 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
4634 // Progress indicator
4635 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
4636 progress->SetScale ( 0, 100, 1 );
4639 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
4641 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
4643 TCollection_AsciiString fnom,rnom;
4645 Standard_Boolean modfic = XSDRAW::FileAndVar
4646 (argv[1],argv[2],"IGESBREP",fnom,rnom);
4647 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
4648 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
4649 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
4650 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
4653 OSD_Timer Chr; Chr.Reset();
4659 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
4663 //In order to decrease number of produced edges during translation it is possible to set following parameter
4664 Interface_Static::SetIVal("read.iges.bspline.continuity",0);
4667 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
4668 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
4670 progress->EndScope();
4673 if (readstat != IFSelect_RetDone) {
4674 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
4675 else di<<"No model loaded"<<"\n";
4678 // Choice of treatment
4679 Standard_Boolean fromtcl = (argc > 3);
4680 Standard_Integer modepri = 1, nent, nbs;
4681 if (fromtcl) modepri = 4;
4684 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
4685 //mode OnlyVisible does not work.
4686 // nent = Reader.NbRootsForTransfer();
4688 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
4691 // amv 26.09.2003 : this is used to avoid error of enter's simbol
4694 modepri = Draw::Atoi(str);
4697 if (modepri == 0) { //fin
4698 di << "Bye and good luck! " << "\n";
4702 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
4703 di << "All Geometry Transfer"<<"\n";
4704 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4705 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4706 Handle(XSControl_WorkSession) thesession = Reader.WS();
4707 thesession->ClearContext();
4708 XSDRAW::SetTransferProcess (thesession->MapReader());
4709 progress->NewScope ( 80, "Translation" );
4711 thesession->MapReader()->SetProgress ( progress );
4713 if (modepri == 1) Reader.SetReadVisible (Standard_True);
4714 Reader.TransferRoots();
4716 thesession->MapReader()->SetProgress ( 0 );
4717 progress->EndScope();
4719 // result in only one shape for all the roots
4720 // or in one shape for one root.
4721 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
4722 Standard_Integer answer = 1;
4723 if (Reader.NbShapes() > 1) {
4724 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;
4729 answer = Draw::Atoi(str_a);
4731 if ( answer == 0) continue;
4732 if ( answer == 1 || answer == 3) {
4733 TopoDS_Shape shape = Reader.OneShape();
4735 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4737 Sprintf(fname, "%s", rnom.ToCString());
4738 di << "Saving shape in variable Draw : " << fname << "\n";
4739 if (answer == 3) IGESToBRep::WriteShape (shape,1);
4742 DBRep::Set(fname,shape);
4744 catch(Standard_Failure) {
4745 di << "** Exception : ";
4746 di << Standard_Failure::Caught()->GetMessageString();
4747 di<<" ** Skip"<<"\n";
4748 di << "Saving shape in variable Draw : " << fname << "\n";
4749 IGESToBRep::WriteShape (shape,1);
4753 else if (answer == 2 || answer == 4) {
4754 Standard_Integer numshape = Reader.NbShapes();
4755 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
4756 // save all the shapes
4757 TopoDS_Shape shape = Reader.Shape(inum);
4758 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4760 Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
4761 di << "Saving shape in variable Draw : " << fname << "\n";
4762 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
4765 DBRep::Set(fname,shape);
4767 catch(Standard_Failure) {
4768 di << "** Exception : ";
4769 di << Standard_Failure::Caught()->GetMessageString();
4770 di<<" ** Skip"<<"\n";
4777 else if (modepri == 3) { // One Entity
4778 cout << "Only One Entity"<<endl;
4779 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
4780 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
4781 cout << " give the number of the Entity : " << flush;
4782 nent = XSDRAW::GetEntityNumber();
4784 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4786 nbs = Reader.NbShapes();
4787 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
4788 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4789 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4790 TopoDS_Shape sh = Reader.Shape(nbs);
4791 DBRep::Set (shname,sh);
4795 else if (modepri == 4) { // Selection
4796 Standard_Integer answer = 1;
4797 Handle(TColStd_HSequenceOfTransient) list;
4799 // Selection, nommee ou via tcl. tcl : raccourcis admis
4800 // * donne iges-visible + xst-transferrable-roots
4801 // *r donne xst-model-roots (TOUTES racines)
4803 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
4804 di << "All Geometry Transfer"<<"\n";
4805 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4806 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4807 Handle(XSControl_WorkSession) thesession = Reader.WS();
4808 thesession->ClearContext();
4809 XSDRAW::SetTransferProcess (thesession->MapReader());
4810 progress->NewScope ( 80, "Translation" );
4812 thesession->MapReader()->SetProgress ( progress );
4814 Reader.SetReadVisible (Standard_True);
4815 Reader.TransferRoots();
4817 thesession->MapReader()->SetProgress ( 0 );
4818 progress->EndScope();
4821 // result in only one shape for all the roots
4822 TopoDS_Shape shape = Reader.OneShape();
4825 Sprintf(fname, "%s", rnom.ToCString());
4826 di << "Saving shape in variable Draw : " << fname << "\n";
4829 DBRep::Set(fname,shape);
4831 catch(Standard_Failure) {
4832 di << "** Exception : ";
4833 di << Standard_Failure::Caught()->GetMessageString();
4834 di<<" ** Skip"<<"\n";
4835 di << "Saving shape in variable Draw : " << fname << "\n";
4836 IGESToBRep::WriteShape (shape,1);
4842 modepri = 0; // d office, une seule passe
4843 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
4845 list = XSDRAW::GetList ("xst-model-roots");
4848 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
4849 di<<"List given by "<<compart.ToCString()<<" : ";
4850 list = XSDRAW::GetList (compart.ToCString());
4852 if (list.IsNull()) {
4853 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
4858 cout<<"Name of Selection :"<<flush;
4859 list = XSDRAW::GetList();
4860 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
4863 Standard_Integer nbl = list->Length();
4864 di<<"Nb entities selected : "<<nbl<<"\n";
4865 if (nbl == 0) continue;
4868 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
4871 char str_answer[80];
4873 answer = Draw::Atoi(str_answer);
4875 if (answer <= 0 || answer > 3) continue;
4877 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
4878 Handle(Standard_Transient) ent = list->Value(ill);
4879 di<<" ";// model->Print(ent,di);
4883 if (answer == 1 || answer == 2) {
4884 Standard_Integer nbt = 0;
4885 Handle(XSControl_WorkSession) thesession = Reader.WS();
4887 XSDRAW::SetTransferProcess (thesession->MapReader());
4888 progress->NewScope ( 80, "Translation" );
4890 thesession->MapReader()->SetProgress ( progress );
4892 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
4893 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
4895 nent = Reader.Model()->Number(list->Value(ill));
4896 if (nent == 0) continue;
4897 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4899 nbs = Reader.NbShapes();
4900 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
4901 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4902 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4903 TopoDS_Shape sh = Reader.Shape(nbs);
4904 DBRep::Set (shname,sh);
4908 thesession->MapReader()->SetProgress ( 0 );
4909 progress->EndScope();
4911 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
4912 answer = 0; // on ne reboucle pas
4916 else di<<"Unknown mode n0 "<<modepri<<"\n";
4920 //In order to clear memory after IGES reading you could add the following code
4921 Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
4922 Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
4925 Reader.WS()->Model()->Clear();
4926 Standard_Integer i =1;
4928 Reader.WS()->ClearData(i);
4934 #include <Geom_Plane.hxx>
4935 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4939 di << "Usage : " << argv[0] << " plane a b c d\n";
4943 Standard_Real A = Draw::Atof(argv[2]);
4944 Standard_Real B = Draw::Atof(argv[3]);
4945 Standard_Real C = Draw::Atof(argv[4]);
4946 Standard_Real D = Draw::Atof(argv[5]);
4948 Handle(Geom_Geometry) result;
4950 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4953 DrawTrSurf::Set(argv[1],result);
4957 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4961 di << "Usage : " << argv[0] << " MaxNbr" << "\n";
4964 Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
4966 for (Standard_Integer i=0;i<aMaxNbr;i++)
4968 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4970 TopoDS_Wire wireShape( w.Wire());
4971 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4972 TopoDS_Face f( faceBuilder.Face());
4973 BRepMesh_IncrementalMesh im(f,1);
4974 BRepTools::Clean(f);
4979 #include <Graphic3d_Vector.hxx>
4980 Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4984 di << "Wrong number of arguments" << "\n";
4987 Standard_Real X1_Pnt = Draw::Atof(argv[1]);
4988 Standard_Real Y1_Pnt = Draw::Atof(argv[2]);
4989 Standard_Real Z1_Pnt = Draw::Atof(argv[3]);
4990 Standard_Real X2_Pnt = Draw::Atof(argv[4]);
4991 Standard_Real Y2_Pnt = Draw::Atof(argv[5]);
4992 Standard_Real Z2_Pnt = Draw::Atof(argv[6]);
4994 Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
4995 Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
4997 di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
5004 #include <IntCurvesFace_ShapeIntersector.hxx>
5005 #include <gp_Lin.hxx>
5006 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5010 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
5014 TopoDS_Shape shape = DBRep::Get(argv[1]);
5016 if (shape.IsNull()) {
5017 di<<" Null shape is not allowed";
5021 Standard_Real X_Pnt = Draw::Atof(argv[2]);
5022 Standard_Real Y_Pnt = Draw::Atof(argv[3]);
5023 Standard_Real Z_Pnt = Draw::Atof(argv[4]);
5025 Standard_Real X_Dir = Draw::Atof(argv[5]);
5026 Standard_Real Y_Dir = Draw::Atof(argv[6]);
5027 Standard_Real Z_Dir = Draw::Atof(argv[7]);
5029 Standard_Real PInf = Draw::Atof(argv[8]);
5031 IntCurvesFace_ShapeIntersector intersector;
5032 intersector.Load(shape, Precision::Intersection());
5034 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
5035 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
5036 gp_Lin ray(origin, dir);
5038 Standard_Real PSup = RealLast();
5039 intersector.PerformNearest(ray, PInf, PSup);
5040 if (intersector.NbPnt() != 0)
5042 di << argv[0] << " status = 0 \n";
5043 Standard_Real w = intersector.WParameter(1);
5044 di << "w = " << w << "\n";
5046 di << argv[0] << " status = -1 \n";
5051 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5054 di << "Usage : " << argv[0] << "\n";
5058 // Create mask 1111: extent == 4
5059 TColStd_PackedMapOfInteger aFullMask;
5060 for (Standard_Integer i = 0; i < 4; i++)
5063 // Create mask 1100: extent == 2
5064 TColStd_PackedMapOfInteger aPartMask;
5065 for (Standard_Integer i = 0; i < 2; i++)
5068 di << "aFullMask = 1111" << "\n";
5069 di << "aPartMask = 1100" << "\n";
5071 Standard_Boolean isAffected;
5073 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
5074 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5075 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
5076 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5077 isAffected = aFullMask.Subtract(aPartMask); // false (?)
5078 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5082 #include <ShapeFix_FixSmallFace.hxx>
5083 Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5087 di << "Usage : " << argv[0] << " shape resshape\n";
5091 // try to read a shape:
5092 TopoDS_Shape aShape=DBRep::Get(argv[1]);
5093 ShapeFix_FixSmallFace aFixSmallFaces;
5094 aFixSmallFaces.Init (aShape);
5095 aFixSmallFaces.Perform();
5096 TopoDS_Shape aResShape = aFixSmallFaces.Shape();
5097 DBRep::Set(argv[2],aResShape);
5103 #include <NCollection_DataMap.hxx>
5104 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5108 di << "Usage : " << argv[0] << "\n";
5112 TCollection_ExtendedString anExtString;
5114 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
5115 anExtString.Insert(1, aNonAsciiChar);
5117 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
5118 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
5119 aMap.Bind(anExtString, 0);
5125 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5128 di << "Wrong number of arguments" << argv[0] << "\n";
5132 Standard_Real X_vec = Draw::Atof(argv[1]);
5133 Standard_Real Y_vec = Draw::Atof(argv[2]);
5134 Standard_Real Z_vec = Draw::Atof(argv[3]);
5136 Standard_Real X_dir = Draw::Atof(argv[4]);
5137 Standard_Real Y_dir = Draw::Atof(argv[5]);
5138 Standard_Real Z_dir = Draw::Atof(argv[6]);
5140 Standard_Real X_pnt = Draw::Atof(argv[7]);
5141 Standard_Real Y_pnt = Draw::Atof(argv[8]);
5142 Standard_Real Z_pnt = Draw::Atof(argv[9]);
5144 gp_Dir toSym(X_vec, Y_vec, Z_vec);
5145 gp_Dir dir(X_dir, Y_dir, Z_dir);
5146 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
5147 gp_Ax2 symObj(loc,dir);
5148 toSym.Mirror(symObj);
5150 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
5155 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5159 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
5163 Standard_Real X_mirrorFirstPoint = Draw::Atof(argv[1]);
5164 Standard_Real Y_mirrorFirstPoint = Draw::Atof(argv[2]);
5165 Standard_Real X_mirrorSecondPoint = Draw::Atof(argv[3]);
5166 Standard_Real Y_mirrorSecondPoint = Draw::Atof(argv[4]);
5167 Standard_Real X_p1 = Draw::Atof(argv[5]);
5168 Standard_Real Y_p1 = Draw::Atof(argv[6]);
5169 Standard_Real X_p2 = Draw::Atof(argv[7]);
5170 Standard_Real Y_p2 = Draw::Atof(argv[8]);
5172 gp_Trsf2d identityTransformation;
5174 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
5175 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
5176 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
5178 gp_Pnt2d p1(X_p1,Y_p1);
5179 gp_Pnt2d p2(X_p2,Y_p2);
5182 M1.SetMirror(mirrorAxis);
5184 M2.SetMirror(mirrorAxis);
5186 Tcomp = M2.Multiplied(M1);
5188 Standard_Real aTol = Precision::Confusion();
5189 Standard_Integer aStatus = 0;
5191 //After applying two times the same mirror the point is located on the same location OK
5192 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
5193 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
5195 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
5198 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
5199 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
5201 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
5204 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
5205 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
5206 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
5208 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
5211 di << "Status = " << aStatus << "\n";
5215 Standard_Integer OCC23429(Draw_Interpretor& di,
5216 Standard_Integer narg, const char** a)
5218 if (narg < 4) return 1;
5220 TopoDS_Shape aShape = DBRep::Get(a[2]);
5221 if (aShape.IsNull()) return 1;
5223 BRepFeat_SplitShape Spls(aShape);
5224 Spls.SetCheckInterior(Standard_False);
5226 TopoDS_Shape aTool = DBRep::Get(a[3]);
5228 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
5229 Builder.ComputePCurveOn1(Standard_True);
5231 Builder.Approximation(Standard_True);
5233 TopoDS_Shape aSection = Builder.Shape();
5235 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
5236 for (; ExpSec.More(); ExpSec.Next())
5238 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
5239 Handle(Geom2d_Curve) thePCurve;
5240 Handle(Geom_Surface) theSurface;
5241 TopLoc_Location theLoc;
5242 Standard_Real fpar, lpar;
5243 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
5245 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
5246 for (; ExpShape.More(); ExpShape.Next())
5248 aFace = TopoDS::Face(ExpShape.Current());
5249 TopLoc_Location aLoc;
5250 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
5251 if (aSurface == theSurface && aLoc == theLoc)
5254 Spls.Add(anEdge, aFace);
5257 TopoDS_Shape Result = Spls.Shape();
5258 DBRep::Set(a[1], Result);
5263 #include <ExprIntrp_GenExp.hxx>
5264 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5268 di << "Usage : " << argv[0] << " string\n";
5272 Standard_CString aString = argv[1];
5273 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
5276 myExpr->Process( aString );
5278 catch(Standard_Failure) {
5279 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
5280 di << "Exception : " << aFail->GetMessageString() << "\n";
5286 #include <Quantity_NameOfColor.hxx>
5287 #include <TopAbs_ShapeEnum.hxx>
5288 Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5290 // Check the command arguments
5293 di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
5294 di << "Usage : " << argv[0] << " mode(0/1)\n";
5295 return 1; //TCL_ERROR
5298 const Standard_Integer aMode = Draw::Atoi(argv[1]);
5300 //===================================================================
5302 Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
5303 if (aisContext.IsNull())
5305 di <<"Error: call 'vinit' first"<< "\n";
5306 return 1; //TCL_ERROR
5309 if (aisContext->HasOpenedContext())
5311 aisContext->CloseAllContexts();
5312 aisContext->RemoveAll(false);
5313 aisContext->EraseSelected(false, false);
5315 aisContext->EraseAll(false,false);
5316 Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
5317 Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
5319 trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
5320 trihedron->SetSize(20);
5321 trihedron->SetColor(Quantity_NOC_GRAY30);
5322 trihedron->SetArrowColor(Quantity_NOC_GRAY30);
5323 trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
5325 //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5326 //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5327 //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
5330 aisContext->Display(trihedron, true);
5331 aisContext->OpenLocalContext();
5332 //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
5333 aisContext->ActivateStandardMode(TopAbs_EDGE);
5334 aisContext->SetSensitivity(8);
5339 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
5340 const char *group = "QABugs";
5342 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
5344 // Remove as bad version of QAAddOrRemoveSelected from QADraw
5345 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
5347 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
5348 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
5349 theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
5351 //====================================================
5353 // Following commands are inserted from
5354 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
5355 // ( 75455 Apr 16 18:59)
5357 //====================================================
5359 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
5360 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
5362 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
5364 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
5365 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
5366 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
5367 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
5368 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
5369 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
5372 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
5373 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
5374 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
5376 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
5377 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
5378 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
5380 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
5381 theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
5383 theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
5385 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
5387 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
5388 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
5389 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
5390 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
5391 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
5392 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
5393 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
5394 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
5395 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
5396 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
5397 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
5398 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
5399 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
5400 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
5401 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5402 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5403 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5404 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5406 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5407 theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
5408 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5409 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5410 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5411 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5413 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5414 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
5416 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5417 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5418 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5419 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5420 theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
5421 theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
5422 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5423 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5424 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5425 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5426 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5427 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5428 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5429 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5430 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5431 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5432 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5433 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5434 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5435 theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
5436 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5437 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5438 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5439 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5440 theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
5441 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5442 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5443 theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
5444 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);
5445 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5446 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5447 theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);