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.
25 #include <Draw_Interpretor.hxx>
27 #include <DrawTrSurf.hxx>
28 #include <AIS_InteractiveContext.hxx>
29 #include <ViewerTest.hxx>
30 #include <AIS_Shape.hxx>
31 #include <TopoDS_Shape.hxx>
33 #include <Geom_Axis2Placement.hxx>
35 #include <gp_Trsf.hxx>
36 #include <AIS_Trihedron.hxx>
37 #include <BRepPrimAPI_MakeBox.hxx>
38 #include <Graphic3d_MaterialAspect.hxx>
39 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
40 #include <TopoDS_Solid.hxx>
41 #include <BRepPrimAPI_MakeSphere.hxx>
42 #include <BRepPrimAPI_MakeCone.hxx>
43 #include <BRepPrimAPI_MakeCylinder.hxx>
44 #include <IGESToBRep_Reader.hxx>
45 #include <TopExp_Explorer.hxx>
47 #include <GCPnts_UniformDeflection.hxx>
48 #include <BRepAdaptor_Curve.hxx>
49 #include <IGESToBRep.hxx>
50 #include <V3d_Viewer.hxx>
51 #include <BRepAdaptor_CompCurve.hxx>
52 #include <GCPnts_AbscissaPoint.hxx>
53 #include <Standard_ErrorHandler.hxx>
54 #include <Standard_Overflow.hxx>
55 #include <Standard_Underflow.hxx>
56 #include <Standard_DivideByZero.hxx>
57 #include <OSD_SIGSEGV.hxx>
58 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
59 #include <OSD_Exception_STACK_OVERFLOW.hxx>
61 #include <STEPCAFControl_Writer.hxx>
62 #include <STEPControl_StepModelType.hxx>
63 #include <Interface_Static.hxx>
64 #include <IFSelect_ReturnStatus.hxx>
65 #include <Standard_Failure.hxx>
66 #include <TColgp_HArray1OfPnt2d.hxx>
67 #include <Geom2dAPI_Interpolate.hxx>
68 #include <Geom2d_BSplineCurve.hxx>
69 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
70 #include <Geom2d_BezierCurve.hxx>
71 #include <BRep_Tool.hxx>
72 #include <GeomProjLib.hxx>
73 #include <Geom2dAPI_InterCurveCurve.hxx>
74 #include <IntRes2d_IntersectionSegment.hxx>
75 #include <TDataStd_RealArray.hxx>
76 #include <TDF_CopyLabel.hxx>
77 #include <NCollection_Vector.hxx>
78 #include <TColStd_Array1OfInteger.hxx>
79 #include <Geom_BSplineCurve.hxx>
80 #include <TColgp_Array1OfPnt.hxx>
81 #include <AIS_ListOfInteractive.hxx>
82 #include <AIS_ListIteratorOfListOfInteractive.hxx>
83 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
84 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
85 #include <BRepBuilderAPI_MakePolygon.hxx>
86 #include <gp_GTrsf.hxx>
87 #include <Poly_Triangulation.hxx>
88 #include <IGESControl_Reader.hxx>
89 #include <IGESData_IGESModel.hxx>
90 #include <IGESData_IGESEntity.hxx>
91 #include <V3d_View.hxx>
92 #include <BRepFeat_SplitShape.hxx>
93 #include <BRepAlgoAPI_Section.hxx>
98 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
100 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
103 static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
105 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
106 if(myAISContext.IsNull()) {
107 di << "use 'vinit' command before " << argv[0] ;
111 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
114 trsf1.SetTranslation(gp_Vec(100, 100, 0));
115 aTrihedronAxis->Transform(trsf1);
116 Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
117 myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
118 myTrihedron->SetSize(100);
119 myAISContext->Display(myTrihedron, Standard_True);
121 // TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
122 TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
123 Handle(AIS_Shape) AS = new AIS_Shape(shape1);
124 AS->SetDisplayMode(1);
125 Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
126 AS->SetMaterial(mat);
127 AS->SetColor(Quantity_NOC_RED);
128 myAISContext->Display(AS);
131 TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
133 myAISContext->ResetLocation(AS);
134 myAISContext->SetLocation(AS , TouchTrsf) ;
135 myAISContext->Redisplay(AS, Standard_True);
140 // Remove as bad version of QAAddOrRemoveSelected from QADraw
141 //static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
144 // di<<"Usage : " << argv[0] << " shape islocal\n";
148 // Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
150 // // ViewerTest_DoubleMapOfInteractiveAndName& aMap =
151 // // ViewerTest::GetDataMapOfAIS ();
152 // ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
154 // TCollection_AsciiString aName(argv[1]);
155 // Handle(AIS_InteractiveObject) AISObj;
157 // if(aMap.IsBound2(aName)) {
158 // AISObj = aMap.Find2(aName);
159 // if(AISObj.IsNull()){
160 // di<<"No interactive object \n";
164 // Standard_Integer aNum = -1;
166 // if(Draw::Atoi(argv[2])) {
167 // aNum = anAISCtx->OpenLocalContext();
170 // if(anAISCtx->HasOpenedContext()){
171 // anAISCtx->InitSelected();
172 // anAISCtx->AddOrRemoveSelected(AISObj);
175 // anAISCtx->InitCurrent();
176 // anAISCtx->AddOrRemoveCurrentObject(AISObj);
180 // // anAISCtx->CloseLocalContext(aNum);
185 // //select this shape:
187 // di<<"Use 'vdisplay' before";
192 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
195 di<<"Usage: OCC136\n";
199 //create some primitives:
201 Standard_Real Size=100;
202 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
204 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
206 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
208 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
209 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
211 anAx2.SetLocation(gp_Pnt(Size,0,0));
212 anAx2.SetDirection(gp_Dir(-1,-1,1));
213 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
215 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
216 if(anAISCtx.IsNull()){
217 di<<"Null interactive context. Use 'vinit' at first.\n";
221 if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
222 anAISCtx->EraseAll();
224 //load primitives to context
225 Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
226 anAISCtx->Display(aSh1);
228 Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
229 anAISCtx->Display(aSh2);
231 Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
232 anAISCtx->Display(aSh3);
234 Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
235 anAISCtx->Display(aSh4);
238 anAISCtx->InitCurrent();
239 anAISCtx->AddOrRemoveCurrentObject(aSh1);
240 anAISCtx->AddOrRemoveCurrentObject(aSh2);
241 anAISCtx->AddOrRemoveCurrentObject(aSh3);
242 anAISCtx->AddOrRemoveCurrentObject(aSh4);
244 //remove all this objects from context
245 anAISCtx->Clear(aSh1, Standard_False);
246 anAISCtx->Clear(aSh2, Standard_False);
247 anAISCtx->Clear(aSh3, Standard_False);
248 anAISCtx->Clear(aSh4, Standard_False);
252 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
254 printf("Usage: %s iges_input [name]\n",argv[0]);
257 Standard_Character *Ch = NULL;
260 Ch = new Standard_Character[strlen(argv[2])+3];
262 IGESToBRep_Reader IR;
263 IR.LoadFile (argv[1]);
266 TopoDS_Shape aTopShape = IR.OneShape();
267 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
268 Standard_Integer i=0;
269 for( ; ex.More(); ex.Next()){
270 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
271 BRepAdaptor_Curve aCurve(E);
272 GCPnts_UniformDeflection plin(aCurve, 0.1);
273 di << "Num points = " << plin.NbPoints() << "\n";
276 Sprintf(Ch,"%s_%i",argv[2],1);
283 static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
287 di << "Usage : " << a[0] << " file.igs" << "\n";
291 Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
293 if(myContext.IsNull()) {
294 di << "use 'vinit' command before " << a[0] << "\n";
299 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
300 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
302 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
305 Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
306 Sprintf(file1,"%s/%s",DD,a[1]);
308 IGESToBRep_Reader reader;
309 Standard_Integer status = reader.LoadFile(file1);
312 reader.TransferRoots();
313 TopoDS_Shape shape = reader.OneShape();
315 Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
317 Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
319 if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
320 importedShape->SetDisplayMode(AIS_WireFrame);
321 else importedShape->SetDisplayMode(AIS_Shaded);
322 myContext->Display(importedShape);
325 printf("\n End of my IGES to 3D-viewer *****************>\n");
330 //====================================================
332 // Following code is inserted from
333 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
334 // ( 75455 Apr 16 18:59)
336 //====================================================
339 #include <BRepTools_WireExplorer.hxx>
340 #include <BRep_Tool.hxx>
341 #include <GCPnts_UniformAbscissa.hxx>
342 #include <TopExp.hxx>
345 // usage : OCC105 shape
348 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
350 //Value Pnt = -338.556216693211 -394.465571897208 0
352 //Value Pnt = -307.47165394 -340.18073533 0
354 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
357 di<<"Usage : OCC105 shape\n";
360 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
361 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
362 Standard_Real l = 0.5; //Draw::Atof(argv[2]);
363 // Find the first vertex of the wire
364 BRepTools_WireExplorer wire_exp(myTopoDSWire);
367 TopoDS_Vertex vw1, vw2;
368 TopExp::Vertices(myTopoDSWire,vw1,vw2);
369 TopoDS_Vertex ve1, ve2;
370 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
371 TopExp::Vertices(edge,ve1,ve2);
372 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
375 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
379 for ( ; wire_exp.More(); wire_exp.Next())
381 di << "\n\n New Edge \n" << "\n";
382 Standard_Real newufirst, newulast;
383 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
384 Standard_Real ufirst, ulast;
385 Handle(Geom_Curve) acurve;
386 TopoDS_Vertex ve1, ve2;
387 TopExp::Vertices(edge,ve1,ve2);
388 if (ve1.IsSame(vlast))
390 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
397 // assert(ve2.IsSame(vlast));
398 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
399 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
400 newufirst = acurve->ReversedParameter( ufirst );
401 newulast = acurve->ReversedParameter( ulast );
402 acurve = acurve->Reversed( );
406 GeomAdaptor_Curve curve;
407 GCPnts_UniformAbscissa algo;
409 algo.Initialize( curve, l, newufirst, newulast );
411 di << "Not Done!!!" << "\n";
412 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
413 Standard_Real t = algo.Parameter(Index);
414 gp_Pnt pt3 = curve.Value(t);
415 di << "Parameter t = " << t << "\n";
416 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
423 #include <TColStd_SequenceOfTransient.hxx>
424 #include <GeomFill_Pipe.hxx>
425 static int pipe_OCC9 (Draw_Interpretor& di,
426 Standard_Integer n, const char ** a)
429 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
433 TColStd_SequenceOfTransient aCurveSeq;
435 for (i=2 ; i<=4; i++) {
436 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
438 di << a[i] << " is not a curve" << "\n";
441 aCurveSeq.Append(aC);
444 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
445 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
446 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
450 aPipe.Perform(Draw::Atof (a[6]), Standard_True);
452 aPipe.Perform(Standard_True/*, Standard_True*/);
455 Handle(Geom_Surface) aSurf = aPipe.Surface();
457 DrawTrSurf::Set(a[1], aSurf);
461 //======================================================================
463 // usage : OCC125 shell
464 //======================================================================
465 #include <ShapeFix_Shell.hxx>
467 Standard_Integer OCC125(Draw_Interpretor& di ,
472 di<<" Use OCC125 shell";
476 TopoDS_Shape S = DBRep::Get(a[1]);
479 di<<" Null shape is not allowed";
485 if (aT!=TopAbs_SHELL) {
486 di<<" Shape Type must be SHELL";
490 const TopoDS_Shell& aShell = TopoDS::Shell(S);
492 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
494 isAccountMultiConex=Standard_True;
495 bNonManifold=Standard_False;
497 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
498 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
500 di<<"bResult="<<(Standard_Integer)bResult;
503 aShape=aFix->Shape();
505 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
508 DBRep::Set (aRName.ToCString(), aShape);
509 di<<aRName.ToCString();
514 #include <BRepLib_FindSurface.hxx>
515 #include <BRepBuilderAPI_MakeFace.hxx>
516 Standard_Integer OCC157(Draw_Interpretor& di,
519 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
522 di << "bad number of arguments" <<"\n";
526 // try to read a shape:
527 TopoDS_Shape inputShape=DBRep::Get(a[2]);
528 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
529 di << "Invalid input shape"<< "\n";
532 Standard_Real toler = Draw::Atof(a[3]);
533 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
534 BRepLib_FindSurface FS(aWire, toler, Standard_True);
536 di<<"OCC157: OK; Planar surface is found"<<"\n";
537 Handle(Geom_Surface) aSurf = FS.Surface();
538 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
539 if(aMakeFace.IsDone()) {
540 TopoDS_Face aFace = aMakeFace.Face();
541 DBRep::Set(a[1],aFace);
544 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
549 // #include <MyCommandsCMD.h>
550 #include <ShapeFix_Shape.hxx>
551 #include <BRepOffset_MakeOffset.hxx>
552 #include <BRepOffsetAPI_MakeOffset.hxx>
553 #include <BRepOffset_Mode.hxx>
554 #include <GeomAbs_JoinType.hxx>
555 #include <AIS_Shape.hxx>
557 #include <BRepTools.hxx>
559 Standard_Integer OCC165(Draw_Interpretor& di ,
564 //=======================================================================
566 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
568 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
570 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
573 //=======================================================================
575 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
579 di <<"Usage : " << a[0] << " [file]"<<"\n";
584 #define _OFFSET_TELCO_
585 #ifdef _OFFSET_TELCO_
587 Standard_CString file = a[1];
589 BRep_Builder aBuilder;
590 TopoDS_Shape theShape;
591 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
592 BRepTools::Read(theShape, file, aBuilder);
593 DBRep::Set("shape", theShape);
595 TopoDS_Wire theWire = TopoDS::Wire(theShape);
597 Standard_Real anOffset = 1.5;
601 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
602 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
603 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
605 BRepBuilderAPI_MakePolygon theSquare;
606 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
608 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
610 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
612 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
616 TopoDS_Wire theWire = theSquare.Wire();
618 Standard_Real anOffset = 10;
621 #endif /* _OFFSET_TELCO_ */
624 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
625 DBRep::Set("face", theFace);
628 Standard_Real anAlt = 0.;
629 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
630 //GeomAbs_Intersection; //GeomAbs_Arc;
631 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
632 aMakeOffset.AddWire(theWire);
634 aMakeOffset.Perform(anOffset, anAlt);
636 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
637 DBRep::Set("offset", theOffsetShapePos);
642 #include<BRepAlgoAPI_Cut.hxx>
643 #include<BRepAlgo_Cut.hxx>
645 #include<BRepPrimAPI_MakeHalfSpace.hxx>
646 #include<Handle_Geom_CartesianPoint.hxx>
647 #include<Geom_CartesianPoint.hxx>
648 #include<AIS_Point.hxx>
650 #include <BRepBuilderAPI_MakeEdge.hxx>
651 #include <BRepBuilderAPI_MakeWire.hxx>
652 #include <BRepBuilderAPI_MakeFace.hxx>
654 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
658 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
659 if(myAISContext.IsNull()) {
660 di << "use 'vinit' command before " << argv[0] << "\n";
665 gp_Pnt pt1_(250.,250.,0.);
666 gp_Pnt pt2_(-250.,250.,0.);
667 gp_Pnt pt3_(-250.,-250.,0.);
668 gp_Pnt pt4_(250.,-250.,0.);
669 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
670 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
671 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
672 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
674 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
675 BRepBuilderAPI_MakeFace face_(wire_);
676 TopoDS_Face sh_ = face_.Face();
682 g_pnt = gp_Pnt(0,0,-100);
684 g_pnt = gp_Pnt(0,0,100);
686 myAISContext->EraseAll(Standard_False);
687 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
688 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
689 myAISContext->Display(AISPoint);
691 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
692 TopoDS_Solid sol1_ = half_.Solid();
693 // Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
694 // AISHalf->SetColor(Quantity_NOC_GREEN);
695 // myAISContext->Display(AISHalf);
697 DBRep::Set("Face",sol1_);
699 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
701 Standard_Real x=0., y=0., z=-80.;
703 BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
704 // Handle(AIS_Shape) AISBox = new AIS_Shape(box);
705 // AISBox->SetColor(Quantity_NOC_BLUE1);
706 // myAISContext->Display(AISBox);
708 DBRep::Set("Box",box.Shape());
710 // BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
711 // //BRepAlgoAPI_Cut cut( box.Shape(), sol1_ );
712 // TopoDS_Shape sh1_ = cut.Shape();
713 // Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
714 // AISCut->SetColor(Quantity_NOC_RED);
715 // myAISContext->Display(AISCut);
717 // DBRep::Set("Cut",sh1_);
722 #include<GProp_GProps.hxx>
723 #include<BRepGProp.hxx>
725 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
730 di <<"Usage : " << argv[0] << " file"<<"\n";
733 Standard_CString file = argv[1];
735 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
736 if(myAISContext.IsNull()) {
737 di << "use 'vinit' command before " << argv[0] << "\n";
742 BRep_Builder builder;
743 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
744 BRepTools::Read(sh, file, builder);
747 builder.MakeWire(wire);
749 TopoDS_Vertex vt1, vt2;
750 TopExp_Explorer wex(sh, TopAbs_EDGE);
751 for(;wex.More();wex.Next())
753 ed = TopoDS::Edge(wex.Current());
754 TopExp::Vertices(ed, vt1, vt2);
755 builder.UpdateVertex(vt1, 0.01);
756 builder.UpdateVertex(vt2, 0.01);
757 builder.UpdateEdge(ed, 0.01);
758 builder.Add(wire, ed);
762 BRepGProp::LinearProperties(ed, lprop);
763 printf("\n length = %f", lprop.Mass());
765 DBRep::Set("Wire",wire);
766 // Handle(AIS_Shape) res = new AIS_Shape( wire );
767 // aContext->SetColor( res, Quantity_NOC_RED );
768 // aContext->Display( res );
770 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
771 // off.Perform(0.5, 0);
773 // printf("\n IsDone = %d", off.IsDone());
775 // res = new AIS_Shape( sh );
776 // aContext->SetColor( res, Quantity_NOC_GREEN );
777 // aContext->Display( res );
783 static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
786 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
787 if(myAISContext.IsNull()) {
788 di << "use 'vinit' command before " << argv[0];
792 BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
793 Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
794 myAISContext->Display(anAISBox, 1);
795 anAISBox->SetSelectionMode(-1);
796 Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
797 myAISContext->CloseLocalContext(myLocContInd);
798 Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
805 #include <TDocStd_Document.hxx>
806 #include <DDocStd.hxx>
807 #include <PCDM_StoreStatus.hxx>
808 #include <TDocStd_Application.hxx>
810 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
813 di << "Usage: " << a[0] << " Doc" << "\n";
817 Handle(TDocStd_Document) D;
818 if (!DDocStd::GetDocument(a[1],D)) return 1;
820 Handle(TDocStd_Application) A;
821 if (!DDocStd::Find(A)) return 1;
823 TCollection_ExtendedString theStatusMessage;
825 di << "this document has never been saved" << "\n";
828 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
829 if (theStatus != PCDM_SS_OK ) {
830 switch ( theStatus ) {
831 case PCDM_SS_DriverFailure: {
832 di << " Could not store , no driver found to make it " <<"\n" ;
835 case PCDM_SS_WriteFailure: {
836 di << " Write access failure " << "\n" ;
839 case PCDM_SS_Failure: {
840 di << " Write failure " << "\n" ;
848 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
851 di << "Usage: " << a[0] << " Doc Path" << "\n";
855 Handle(TDocStd_Document) D;
856 if (!DDocStd::GetDocument(a[1],D)) return 1;
858 TCollection_ExtendedString path (a[2]);
859 Handle(TDocStd_Application) A;
860 if (!DDocStd::Find(A)) return 1;
862 TCollection_ExtendedString theStatusMessage;
863 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
864 if (theStatus != PCDM_SS_OK ) {
865 switch ( theStatus ) {
866 case PCDM_SS_DriverFailure: {
867 di << " Could not store , no driver found to make it " <<"\n" ;
870 case PCDM_SS_WriteFailure: {
871 di << " Write access failure " << "\n" ;
874 case PCDM_SS_Failure: {
875 di << " Write failure " << "\n" ;
884 #include <BRepClass3d_SolidClassifier.hxx>
886 Standard_Integer OCC299bug (Draw_Interpretor& theDi,
887 Standard_Integer theArgNb,
888 const char** theArgVec)
892 theDi << "Usage : " << theArgVec[0] << " Solid Point [Tolerance=1.e-7]\n";
896 TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
899 theDi << " Null Shape is not allowed here\n";
902 else if (aS.ShapeType() != TopAbs_SOLID)
904 theDi << " Shape type must be SOLID\n";
908 gp_Pnt aP (8., 9., 10.);
909 if (!DrawTrSurf::GetPoint (theArgVec[2], aP))
911 theDi << " Null Point is not allowed here\n";
914 const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : 1.e-7;
916 BRepClass3d_SolidClassifier aSC (aS);
917 aSC.Perform (aP, aTol);
921 case TopAbs_IN: theDi << "The point is IN shape\n"; return 0;
922 case TopAbs_OUT: theDi << "The point is OUT of shape\n"; return 0;
923 case TopAbs_ON: theDi << "The point is ON shape\n"; return 0;
925 default: theDi << "The point is UNKNOWN shape\n"; return 0;
929 #include <OSD_Process.hxx>
930 #include <OSD_Path.hxx>
932 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
935 di << "Usage: " << a[0] << "\n";
939 OSD_Path d = p.CurrentDirectory();
940 TCollection_AsciiString s;
942 di << "*" << s.ToCString() << "*" << "\n";
945 di << "*" << s.ToCString() << "*" <<"\n";
949 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
952 di << "Usage: " << a[0] << "\n";
955 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
956 di << p.Trek().ToCString() << "\n";
958 di << p.Trek().ToCString() << "\n";
962 #include <BRepAlgoAPI_Fuse.hxx>
963 #include <BRepAlgoAPI_Common.hxx>
964 #include <BRepAlgo_Fuse.hxx>
965 #include <BRepAlgo_Common.hxx>
967 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
970 // cout << "Usage: " << a[0] << endl;
973 if(nb < 1 || nb > 2) {
974 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
977 Standard_Boolean IsBRepAlgoAPI = Standard_True;
979 Standard_Integer IsB = Draw::Atoi(a[1]);
981 IsBRepAlgoAPI = Standard_False;
985 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
986 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
988 TopoDS_Shape shape1 = box1.Shape();
989 TopoDS_Shape shape2 = box2.Shape();
991 //#if ! defined(BRepAlgoAPI_def01)
992 // TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
993 // TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
995 // TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
996 // TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
998 TopoDS_Shape fuse,comm;
1000 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
1001 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
1002 fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1003 comm = BRepAlgoAPI_Common( shape1, shape2 );
1005 di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
1006 fuse = BRepAlgo_Fuse( shape1, shape2 );
1007 di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
1008 comm = BRepAlgo_Common( shape1, shape2 );
1014 #include <ShapeAnalysis_Edge.hxx>
1016 static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
1020 di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
1023 TopoDS_Shape Sh1 = DBRep::Get(a[1]);
1024 TopoDS_Shape Sh2 = DBRep::Get(a[2]);
1025 if(Sh1.IsNull() || Sh2.IsNull()) {
1027 di<<"Invalid arguments"<<"\n";
1030 TopoDS_Edge e1 = TopoDS::Edge(Sh1);
1031 TopoDS_Edge e2 = TopoDS::Edge(Sh2);
1032 if(e1.IsNull() || e2.IsNull()) {
1034 di<<"Invalid type of arguments"<<"\n";
1037 Standard_Real aTol = Precision::Confusion();
1038 Standard_Real aDistDomain = 0.0;
1039 Standard_Integer k = 3;
1041 aTol = Draw::Atof(a[k++]);
1043 aDistDomain = Draw::Atof(a[k++]);
1045 ShapeAnalysis_Edge sae;
1046 if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
1047 if(aDistDomain ==0.0) {
1049 di<<"Edges is overlaping comletly"<<"\n";
1052 di<<"Edges is overlaped"<<"\n";
1053 di<<"with tolerance = "<<aTol<<"\n";
1054 di<<"on segment length = "<<aDistDomain<<"\n";
1058 di<<"Edges is not overlaped"<<"\n";
1064 #include <DDocStd_DrawDocument.hxx>
1065 #include <TDataStd_Name.hxx>
1067 #include <XCAFDoc_ShapeTool.hxx>
1068 #include <XCAFDoc_DocumentTool.hxx>
1069 #include <TDF_LabelSequence.hxx>
1070 #include <TPrsStd_AISPresentation.hxx>
1071 #include <TDF_Data.hxx>
1072 #include <TDF_Label.hxx>
1073 #include <XCAFPrs_Driver.hxx>
1075 //------------------------------------------------------------------------------------------
1078 //------------------------------------------------------------------------------------------
1079 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1084 // 1. Verufy amount of arguments
1085 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
1087 // 2. Retrieve DDocStd application
1088 Handle(TDocStd_Application) App;
1089 if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
1092 TCollection_ExtendedString name(argv[2]);
1093 Handle(TDocStd_Document) Doc;
1094 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
1095 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
1096 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
1097 Draw::Set(argv[1],DD);
1099 // 4. Create prsentations
1100 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1101 TDF_LabelSequence seq;
1102 shapes->GetFreeShapes ( seq );
1103 Handle(TPrsStd_AISPresentation) prs;
1104 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
1105 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
1106 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
1108 catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
1110 di << "OCC363 OK\n";
1115 ////======================================================================================
1116 //// Function : OCC372
1118 ////======================================================================================
1119 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1123 // OCC_CATCH_SIGNALS
1124 // // 1. Verufy amount of arguments
1125 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
1129 // TopoDS_Shape Ref;
1130 // BRepTools::Read(Ref, argv[1], B);
1132 // // 3. Calculate location of aP3d in relation to the solid
1133 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
1134 // BRepClass3d_SolidClassifier SC(Ref);
1135 // SC.Perform(aP3d, 1e-7);
1137 // // 4. Check returned state. The point must be inside the solid.
1138 // TopAbs_State aState=SC.State();
1142 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
1145 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
1148 // di<<"OCC372 OK. aState = TopAbs_IN" ;
1151 // di<<"OCC372 FAULTY. aState = UNKNOWN";
1155 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
1160 #include <BRepTopAdaptor_FClass2d.hxx>
1162 //======================================================================================
1163 // Function : OCC377
1165 //======================================================================================
1166 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1171 // 1. Verify validity of arguments
1172 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
1174 // 2. Initialize parameters
1176 p2d.SetX ( Draw::Atof(argv[2]) );
1177 p2d.SetY ( Draw::Atof(argv[3]) );
1178 Standard_Real precuv = Draw::Atof (argv[4] );
1183 BRepTools::Read ( Shape, argv[1], B );
1185 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1186 TopExp_Explorer exp;
1187 Standard_Integer i=1;
1188 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1190 // 4.1. Verify whether enrtry point is on wire
1191 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1192 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1194 TopAbs_Orientation orWire = wir.Orientation();
1195 newFace.Orientation(TopAbs_FORWARD);
1198 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1199 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1200 //di << "Wire " << i << ": Infinite point is " <<
1201 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1203 TCollection_AsciiString TmpString;
1204 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1205 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1207 stat1 = FClass2d1.Perform(p2d);
1208 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1209 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1212 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1213 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1215 // 4.2. Verify whether enrtry point is on reversed wire
1216 newFace = TopoDS::Face(Shape.EmptyCopied());
1217 newFace.Orientation(TopAbs_FORWARD);
1218 orWire = TopAbs::Reverse(orWire);
1219 B.Add(newFace,wir.Oriented(orWire));
1220 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1221 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1222 //di << "Reversed Wire " << i << ": Infinite point is " <<
1223 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1226 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1227 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1229 stat2 = FClass2d2.Perform(p2d);
1230 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1231 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1234 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1235 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1237 // 4.3. Compare results (they must be same)
1238 if(stat1 ==stat2) di << "OCC377 OK" << "\n";
1239 else {di << "OCC377 FAULTY" << "\n"; return 0;}
1242 catch(Standard_Failure)
1244 di << "OCC377 Exception";
1250 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1251 #include <ShapeBuild_ReShape.hxx>
1253 //=======================================================================
1256 //=======================================================================
1257 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1262 // 1. Verify arguments of the command
1263 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1265 Standard_Boolean aConsiderLocation;
1266 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1267 else aConsiderLocation = Standard_True;
1269 // 2. Iniitialize aShapeUpgrade
1270 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1272 aShapeUpgrade.SetPrecision (Precision::Confusion());
1274 aShapeUpgrade.SetMaxTolerance(0.1);
1275 // subshapes to be divided
1276 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1277 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1278 aShapeUpgrade.Init(aSubShapesToBeDivided);
1280 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1281 aShapeUpgrade.SetContext(aReshape);
1282 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1284 // 3. Perform splitting
1285 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1286 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1287 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1289 // 4. Perform rebuilding shape
1290 // 4.1. Retrieve Shape
1291 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1292 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1293 // 4.2 Rebuid retrieved shape
1294 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1295 // 4.3. Create result Draw shape
1296 DBRep::Set(argv[1], aResultShape);
1298 catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
1304 #include <ShapeProcess_OperLibrary.hxx>
1305 #include <ShapeProcess_ShapeContext.hxx>
1306 #include <ShapeProcess.hxx>
1308 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1309 #include <BRepMesh_IncrementalMesh.hxx>
1311 //=======================================================================
1314 //=======================================================================
1315 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1320 // 1. Verify amount of arguments of the command
1321 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1323 // 2. Retrieve parameters
1325 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1326 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1327 // compound of subshapes
1328 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1329 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1330 // name of resource file
1331 const char* aResourceFile = argv[4];
1332 // name of sequence from resource file to be executed
1333 const char* aSequenceName = argv[5];
1335 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1336 ShapeProcess_OperLibrary::Init();
1337 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1338 aShapeContext->SetDetalisation (TopAbs_EDGE);
1339 ShapeProcess::Perform (aShapeContext, aSequenceName);
1341 // 4. Rebuild initil shape in accordance with performed operation
1342 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1343 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1344 for (; anIter.More(); anIter.Next())
1345 aReshape->Replace(anIter.Key(), anIter.Value());
1346 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1348 // 5 Create resultant Draw shape
1349 DBRep::Set(argv[1], aResultShape);
1352 catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
1357 //=======================================================================
1359 //purpose : Verify whether exception occurs during building mesh
1360 //=======================================================================
1361 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1366 // 1. Verify amount of arguments of the command
1367 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1369 // 2. Retrieve shape
1370 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1371 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1374 BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
1377 catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
1379 di << "OCC369 OK \n";
1383 #include <math_Vector.hxx>
1384 #include <math_Matrix.hxx>
1385 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1388 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1391 Standard_Integer LowerVector = Draw::Atoi(argv[1]);
1392 Standard_Integer UpperVector = Draw::Atoi(argv[2]);
1393 Standard_Real InitialValueVector = Draw::Atof(argv[3]);
1394 Standard_Integer LowerRowMatrix = Draw::Atoi(argv[4]);
1395 Standard_Integer UpperRowMatrix = Draw::Atoi(argv[5]);
1396 Standard_Integer LowerColMatrix = Draw::Atoi(argv[6]);
1397 Standard_Integer UpperColMatrix = Draw::Atoi(argv[7]);
1398 Standard_Real InitialValueMatrix = Draw::Atof(argv[8]);
1400 math_Vector Vector1(LowerVector, UpperVector);
1401 math_Vector Vector2(LowerVector, UpperVector);
1403 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1404 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1406 //Vector.Dump(cout);
1409 //Matrix.Dump(cout);
1412 Vector1.Multiply(Vector, Matrix);
1414 //Vector1.Dump(cout);
1415 Standard_SStream aSStream1;
1416 Vector1.Dump(aSStream1);
1420 if (Matrix.RowNumber() > 1) {
1421 Matrix(Matrix.LowerRow() + 1, Matrix.LowerCol()) += 1.;
1423 Vector2.TMultiply(Vector, Matrix);
1425 //Vector2.Dump(cout);
1426 Standard_SStream aSStream2;
1427 Vector2.Dump(aSStream2);
1434 #include <GeomPlate_BuildPlateSurface.hxx>
1435 //=======================================================================
1438 //=======================================================================
1439 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1444 GeomPlate_BuildPlateSurface aBuilder;
1447 catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
1448 //catch (...) { di << "OCC525 Exception \n" ;return 0; }
1450 di << "OCC525 OK \n";
1454 #include <BRepPrimAPI_MakeWedge.hxx>
1455 #include <gce_MakeRotation.hxx>
1456 #include <gce_MakeTranslation.hxx>
1457 #include <BRepBuilderAPI_Transform.hxx>
1458 #include <BRepPrimAPI_MakeWedge.hxx>
1459 #include <BRepAlgoAPI_Fuse.hxx>
1460 #include <BRepAlgoAPI_Cut.hxx>
1461 #include <BRepAlgo_Fuse.hxx>
1462 #include <BRepAlgo_Cut.hxx>
1463 //=======================================================================
1466 //=======================================================================
1467 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1470 // di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
1473 if(argc < 4 || argc > 5) {
1474 di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1477 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1479 Standard_Integer IsB = Draw::Atoi(argv[4]);
1481 IsBRepAlgoAPI = Standard_False;
1482 // di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1484 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
1490 double xperiod = 1.0;
1491 double yperiod = 1.0;
1492 double sub_thick = 0.5;
1495 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1496 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1498 // --------------------------------------------------------------------
1501 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1502 // 0.1, 0.1 , 0.4, 0.4 );
1503 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1504 0.1, 0.1 , 0.4, 0.4 ).Shape();
1506 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1507 gp_Dir(1.0,0.0,0.0),
1510 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1511 gp_Pnt( 0.25, 0.25, 0.5)
1514 rotate.PreMultiply( translate );
1516 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1518 if (wedge1a.IsNull()) {
1519 di<<" Null shape1 is not allowed\n";
1522 DBRep::Set(argv[1], wedge1a);
1524 // --------------------------------------------------------------------
1527 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1528 // 0.1, 0.1 , 0.4, 0.4 );
1529 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1530 0.1, 0.1 , 0.4, 0.4 ).Shape();
1532 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1533 gp_Dir(1.0,0.0,0.0),
1536 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1537 gp_Pnt( 0.25, 0.25, 0.5)
1540 rotate2.PreMultiply( translate2 );
1542 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1544 if (wedge2a.IsNull()) {
1545 di<<" Null shape2 is not allowed\n";
1548 DBRep::Set(argv[2], wedge2a);
1552 //#if ! defined(BRepAlgoAPI_def01)
1553 // TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1555 // TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1557 TopoDS_Shape wedge_common;
1558 if (IsBRepAlgoAPI) {
1559 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
1560 wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1562 di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
1563 wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1566 // remove wedge area from substrate
1567 //#if ! defined(BRepAlgoAPI_def01)
1568 // TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1570 // TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1572 TopoDS_Shape sub_etch1;
1573 if (IsBRepAlgoAPI) {
1574 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
1575 sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1577 di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
1578 sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1581 if (sub_etch1.IsNull()) {
1582 di<<" Null shape3 is not allowed\n";
1585 DBRep::Set(argv[3], sub_etch1);
1590 #include <Standard_GUID.hxx>
1591 //=======================================================================
1594 //=======================================================================
1595 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1598 di<<"Usage : " << argv[0] << " GUID\n";
1601 Standard_GUID guid(argv[1]);
1602 //guid.ShallowDump(cout);
1603 Standard_SStream aSStream;
1604 guid.ShallowDump(aSStream);
1610 #include <XCAFDoc.hxx>
1611 //=======================================================================
1612 //function : OCC738_ShapeRef
1614 //=======================================================================
1615 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1618 di<<"Usage : " << argv[0] << "\n";
1621 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1622 //guid.ShallowDump(cout);
1623 Standard_SStream aSStream;
1624 guid.ShallowDump(aSStream);
1629 //=======================================================================
1630 //function : OCC738_Assembly
1632 //=======================================================================
1633 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1636 di<<"Usage : " << argv[0] << "\n";
1639 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1640 //guid.ShallowDump(cout);
1641 Standard_SStream aSStream;
1642 guid.ShallowDump(aSStream);
1647 #if defined(DDataStd_def01)
1648 #include <DDataStd_DrawPresentation.hxx>
1649 //=======================================================================
1650 //function : OCC739_DrawPresentation
1652 //=======================================================================
1653 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1656 di<<"Usage : " << argv[0] << "\n";
1659 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1660 //guid.ShallowDump(cout);
1661 Standard_SStream aSStream;
1662 guid.ShallowDump(aSStream);
1668 //=======================================================================
1671 //=======================================================================
1672 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1674 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1675 if(aContext.IsNull()) {
1676 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
1681 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
1685 Standard_Boolean updateviewer = Standard_True;
1687 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1689 TCollection_AsciiString aName(argv[1]);
1690 Handle(AIS_InteractiveObject) AISObj;
1692 if(!aMap.IsBound2(aName)) {
1693 di << "Use 'vdisplay' before" << "\n";
1696 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
1697 if(AISObj.IsNull()){
1698 di << argv[1] << " : No interactive object" << "\n";
1701 AISObj->UnsetTransformation();
1702 if (!aContext->HasOpenedContext()) {
1703 aContext->OpenLocalContext();
1705 aContext->Erase(AISObj, updateviewer);
1706 aContext->UpdateCurrentViewer();
1707 aContext->Display(AISObj, updateviewer);
1708 aContext->UpdateCurrentViewer();
1713 //=======================================================================
1716 //=======================================================================
1717 #include <TColStd_Array2OfInteger.hxx>
1718 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1721 di<<"Usage : " << argv[0] << "\n";
1724 TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
1725 Array2OfInteger.SetValue(5,5,55);
1729 #include <GeomAPI_ProjectPointOnSurf.hxx>
1730 //=======================================================================
1733 //=======================================================================
1734 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1738 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1743 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1744 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1745 Standard_Real Umin=Draw::Atof(argv[3]);
1746 Standard_Real Usup=Draw::Atof(argv[4]);
1747 Standard_Real Vmin=Draw::Atof(argv[5]);
1748 Standard_Real Vsup=Draw::Atof(argv[6]);
1750 if (aSurface.IsNull()) {
1751 di << argv[2] << " Null surface \n" ;
1755 GeomAPI_ProjectPointOnSurf PonSurf;
1756 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1757 PonSurf.Perform(aPoint3d);
1762 //=======================================================================
1765 //=======================================================================
1766 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1770 di<<"Usage : " << argv[0] << " wire face\n";
1774 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1775 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1776 if (awire.IsNull() || aface.IsNull()) {
1777 di << "Null object" << "\n";
1781 Standard_Integer count = 0;
1782 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1784 BRepTools_WireExplorer WE;
1785 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1786 TopoDS_Edge E = WE.Current();
1790 di << "Count = " << count << "\n";
1795 //=======================================================================
1798 //=======================================================================
1799 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1803 di <<"Usage : " << argv[0] << " face"<<"\n";
1806 Standard_Real u1, u2, v1, v2;
1807 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1810 BRepTools::UVBounds(F, u1, u2, v1, v2);
1811 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1815 #include <Expr_NamedUnknown.hxx>
1816 #include <Expr_GeneralExpression.hxx>
1817 #include <Expr_Exponential.hxx>
1818 //=======================================================================
1821 //=======================================================================
1822 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1826 di <<"Usage : " << argv[0] << " expression"<<"\n";
1830 TCollection_AsciiString myStr(argv[1]);
1832 Handle (Expr_NamedUnknown) myNamed = new Expr_NamedUnknown(myStr);
1833 Handle (Expr_Exponential) oldExpr = new Expr_Exponential(myNamed);
1834 Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
1837 TCollection_AsciiString res = newExpr->String();
1838 Standard_CString resStr = res.ToCString();
1839 TCollection_AsciiString res_old = oldExpr->String();
1840 Standard_CString res_oldStr = res_old.ToCString();
1843 di << "X = " << argv[1] << "\n";
1844 di << "Y = " << res_oldStr << "\n";
1845 di << "Y' = " << resStr << "\n";
1851 #include <TPrsStd_AISViewer.hxx>
1852 #include <TDF_Label.hxx>
1853 #include <TPrsStd_AISPresentation.hxx>
1854 //=======================================================================
1855 //function : OCC1029_AISTransparency
1856 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1857 //=======================================================================
1859 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1860 Standard_Integer nb,
1864 Handle(TDocStd_Document) D;
1865 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1867 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1869 Handle(TPrsStd_AISViewer) viewer;
1870 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1872 Handle(TPrsStd_AISPresentation) prs;
1873 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1875 prs->SetTransparency(Draw::Atof(arg[3]));
1876 TPrsStd_AISViewer::Update(L);
1879 di << "Transparency = " << prs->Transparency() << "\n";
1884 di << arg[0] << " : Error" << "\n";
1888 //=======================================================================
1889 //function : OCC1030_AISColor
1890 //purpose : OCC1030_AISColor (DOC,entry,[color])
1891 //=======================================================================
1893 static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
1894 Standard_Integer nb,
1898 Handle(TDocStd_Document) D;
1899 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1901 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1903 Handle(TPrsStd_AISViewer) viewer;
1904 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1906 Handle(TPrsStd_AISPresentation) prs;
1907 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1909 prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3]));
1910 TPrsStd_AISViewer::Update(L);
1913 di << "Color = " << prs->Color() << "\n";
1917 di << arg[0] << " : Error" << "\n";
1921 //=======================================================================
1922 //function : OCC1031_AISMaterial
1923 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
1924 //=======================================================================
1926 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
1927 Standard_Integer nb,
1931 Handle(TDocStd_Document) D;
1932 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1934 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1936 Handle(TPrsStd_AISViewer) viewer;
1937 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1939 Handle(TPrsStd_AISPresentation) prs;
1940 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1942 prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3]));
1943 TPrsStd_AISViewer::Update(L);
1946 di << "Material = " << prs->Material() << "\n";
1951 di << arg[0] << " : Error" << "\n";
1955 //=======================================================================
1956 //function : OCC1032_AISWidth
1957 //purpose : OCC1032_AISWidth (DOC,entry,[width])
1958 //=======================================================================
1960 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
1961 Standard_Integer nb,
1965 Handle(TDocStd_Document) D;
1966 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1968 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1970 Handle(TPrsStd_AISViewer) viewer;
1971 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1973 Handle(TPrsStd_AISPresentation) prs;
1974 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1976 prs->SetWidth(Draw::Atof(arg[3]));
1977 TPrsStd_AISViewer::Update(L);
1980 di << "Width = " << prs->Width() << "\n";
1985 di << arg[0] << " : Error" << "\n";
1989 //=======================================================================
1990 //function : OCC1033_AISMode
1991 //purpose : OCC1033_AISMode (DOC,entry,[mode])
1992 //=======================================================================
1994 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
1995 Standard_Integer nb,
1999 Handle(TDocStd_Document) D;
2000 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2002 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2004 Handle(TPrsStd_AISViewer) viewer;
2005 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2007 Handle(TPrsStd_AISPresentation) prs;
2008 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2010 prs->SetMode(Draw::Atoi(arg[3]));
2011 TPrsStd_AISViewer::Update(L);
2014 di << "Mode = " << prs->Mode() << "\n";
2019 di << arg[0] << " : Error" << "\n";
2023 //=======================================================================
2024 //function : OCC1034_AISSelectionMode
2025 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
2026 //=======================================================================
2028 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
2029 Standard_Integer nb,
2033 Handle(TDocStd_Document) D;
2034 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2036 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2038 Handle(TPrsStd_AISViewer) viewer;
2039 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2041 Handle(TPrsStd_AISPresentation) prs;
2042 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2044 prs->SetSelectionMode(Draw::Atoi(arg[3]));
2045 TPrsStd_AISViewer::Update(L);
2048 di << "SelectionMode = " << prs->SelectionMode() << "\n";
2053 di << arg[0] << " : Error" << "\n";
2057 #include<BRepAlgoAPI_Cut.hxx>
2058 #include<BRepAlgo_Cut.hxx>
2059 //=======================================================================
2060 //function : OCC1487
2062 //=======================================================================
2063 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2066 // cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
2069 if(argc < 5 || argc > 6) {
2070 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
2073 Standard_Boolean IsBRepAlgoAPI = Standard_True;
2075 Standard_Integer IsB = Draw::Atoi(argv[5]);
2077 IsBRepAlgoAPI = Standard_False;
2078 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
2083 Standard_Integer CaseNumber = Draw::Atoi(argv[1]);
2085 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
2086 gp_Dir myDir(1,0,0);
2087 gp_Pnt myPnt(0,-50,140);
2088 gp_Ax2 myAx2(myPnt, myDir);
2089 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
2091 TopoDS_Shape cyl1 = o_mc1.Shape();
2094 TopoDS_Shape o_cut_shape;
2095 if (CaseNumber == 1) {
2096 //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);
2097 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
2098 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
2099 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2100 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2102 cyl2 = o_mc2.Shape();
2103 //#if ! defined(BRepAlgoAPI_def01)
2104 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2106 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2108 if (IsBRepAlgoAPI) {
2109 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2110 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2112 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2113 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2116 //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);
2117 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
2118 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
2119 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2120 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2122 cyl2 = o_mc2.Shape();
2123 //#if ! defined(BRepAlgoAPI_def01)
2124 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2126 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2128 if (IsBRepAlgoAPI) {
2129 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2130 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2132 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2133 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2137 DBRep::Set(argv[2],cyl1);
2138 DBRep::Set(argv[3],cyl2);
2139 DBRep::Set(argv[4],o_cut_shape);
2144 #include<TopTools_ListIteratorOfListOfShape.hxx>
2145 #include<BRepFilletAPI_MakeFillet.hxx>
2146 //=======================================================================
2147 //function : OCC1077
2149 //=======================================================================
2150 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
2152 Standard_Real t3d = 1.e-4;
2153 Standard_Real t2d = 1.e-5;
2154 Standard_Real ta = 1.e-2;
2155 Standard_Real fl = 1.e-3;
2156 Standard_Real tapp_angle = 1.e-2;
2157 GeomAbs_Shape blend_cont = GeomAbs_C1;
2159 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
2162 // Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
2164 TopTools_ListIteratorOfListOfShape its;
2166 TopoDS_Compound result;
2168 B.MakeCompound(result);
2171 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
2173 const TopoDS_Shape& cutsol = ex.Current();
2175 BRepFilletAPI_MakeFillet fill(cutsol);
2176 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
2177 fill.SetContinuity(blend_cont, tapp_angle);
2179 // its = build->Section();
2181 its = aBoolenaOperation.SectionEdges();
2185 TopoDS_Edge E = TopoDS::Edge(its.Value());
2186 fill.Add(aRadius, E);
2193 B.Add(result, fill.Shape());
2197 B.Add(result, cutsol);
2203 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
2205 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
2206 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
2207 return OCC1077_boolbl(aCut,aRadius);
2210 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
2212 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
2215 TopoDS_Shape OCC1077_Bug()
2217 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
2218 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
2220 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
2221 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
2222 gp_Dir(0, 0, 1)), 3, 20).Shape();
2223 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
2224 gp_Dir(1, 0, 0)), 3, 20).Shape();
2225 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
2226 gp_Dir(0, 1, 0)), 3, 20).Shape();
2227 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
2228 Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
2230 theTmp1 = fixer->Shape();
2231 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
2232 fixer->Init(theTmp2);
2234 theTmp2 = fixer->Shape();
2235 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
2236 fixer->Init(theResult);
2238 theResult = fixer->Shape();
2242 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2244 if(argc < 1 || argc > 2) {
2245 di << "Usage : " << argv[0] << " result" << "\n";
2249 TopoDS_Shape S = OCC1077_Bug();
2250 DBRep::Set(argv[1],S);
2255 //////////////////////////////////////////////////////////////
2257 * Compute uniform distribution of points using GCPnts_UniformAbscissa
2259 //////////////////////////////////////////////////////////////
2260 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2264 di << "Usage : " << argv[0] << " name shape step" << "\n";
2267 const char *name = argv[1];
2268 Adaptor3d_Curve *adapCurve=NULL;
2269 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
2270 if (!curve.IsNull())
2271 adapCurve = new GeomAdaptor_Curve(curve);
2274 TopoDS_Shape wire = DBRep::Get(argv[2]);
2275 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2277 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
2280 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2282 double step = Draw::Atof(argv[3]);
2283 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2287 di << argv[0] <<" : fail"<<"\n";
2292 int i, np = aUni.NbPoints();
2293 for (i=0; i < np; i++)
2295 double par = aUni.Parameter(i+1);
2296 gp_Pnt p = adapCurve->Value(par);
2297 char n[20], *pname=n;
2298 Sprintf(n,"%s_%d",name,i+1);
2299 DrawTrSurf::Set(pname,p);
2308 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2312 di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
2316 Standard_Integer nb = Draw::Atoi(argv[1]);
2317 Standard_Integer sz = Draw::Atoi(argv[2]);
2318 Standard_Real val = 10;
2319 math_Vector **pv = new math_Vector *[nb];
2321 di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
2323 for (i=0; i < nb; i++) {
2324 pv[i] = new math_Vector (1, sz, val);
2325 if ((i % (nb/10)) == 0) {
2332 di<<"deleting them ..."<<"\n";
2333 for (i=0; i < nb; i++) {
2335 if ((i % (nb/10)) == 0) {
2348 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2352 di << "Usage : " << argv[0] << " wire" << "\n";
2355 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2358 TopoDS_Wire wire = TopoDS::Wire(shape);
2359 // create curve parameterised by curvilinear distance
2360 BRepAdaptor_CompCurve curve(wire,Standard_True);
2361 Standard_Real length = curve.LastParameter();
2362 Standard_Real need_length = length/2;
2364 curve.D0(need_length,pnt);
2365 // create check_curve parameterised in a general way
2366 BRepAdaptor_CompCurve check_curve(wire);
2367 Standard_Real check_par =
2368 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2370 check_curve.D0(check_par,check_pnt);
2371 // check that points are coinsiding
2372 Standard_Real error_dist = pnt.Distance(check_pnt);
2373 if (error_dist > Precision::Confusion()) {
2374 //cout.precision(3);
2375 di<<"error_dist = "<<error_dist<<
2376 " ( "<<error_dist/need_length*100<<" %)"<<"\n";
2384 static int StackOverflow (int i = -1)
2387 memset (arr, 0, sizeof(arr));
2393 // this code does not work with optimize mode on Windows
2394 #pragma optimize( "", off )
2396 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2400 cout << "Usage : " << argv[0] << "\n";
2403 Standard_Boolean Succes;
2405 Succes = Standard_True;
2408 {//==== Test Divide ByZero (Integer) ========================================
2411 cout << "(Integer) Divide By Zero..." << endl;
2412 di << "(Integer) Divide By Zero...";
2415 Standard_Integer res, a =4, b = 0 ;
2417 di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n";
2418 Succes = Standard_False;
2420 #if defined(SOLARIS) || defined(WNT)
2421 catch(Standard_DivideByZero)
2423 catch(Standard_NumericError)
2428 catch(Standard_Failure) {
2429 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2431 di << Standard_Failure::Caught()->GetMessageString();
2432 di << ")... KO" << "\n";
2433 Succes = Standard_False;
2435 #ifndef NO_CXX_EXCEPTION
2436 // this case tests if (...) supersedes (Standard_*),
2437 // the normal behaviour is not
2439 di<<" unknown exception... (But) Ok"<<"\n";
2444 {//==== Test Divide ByZero (Real) ===========================================
2447 cout << "(Real) Divide By Zero..." << endl;
2448 di << "(Real) Divide By Zero...";
2451 Standard_Real res, a= 4.0, b=0.0;
2453 di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n";
2454 Succes = Standard_False;
2456 catch(Standard_DivideByZero) // Solaris, Windows w/o SSE2
2458 di << " Ok" << "\n";
2460 catch(Standard_NumericError) // Linux, Windows with SSE2
2462 di << " Ok" << "\n";
2464 catch(Standard_Failure) {
2465 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2467 di << Standard_Failure::Caught()->GetMessageString();
2468 di << ")... KO" << "\n";
2469 Succes = Standard_False;
2473 {//==== Test Overflow (Integer) =============================================
2476 cout << "(Integer) Overflow..." << endl;
2477 di << "(Integer) Overflow...";
2480 Standard_Integer res, i=IntegerLast();
2482 //++++ cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< endl;
2483 //++++ Succes = Standard_False;
2484 di << " "<<res<<"="<<i<<"+1 Does not Caught... (But) Ok"<< "\n";
2486 catch(Standard_Overflow) {
2489 catch(Standard_Failure) {
2490 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2492 di << Standard_Failure::Caught()->GetMessageString();
2493 di << ")... KO" << "\n";
2494 Succes = Standard_False;
2498 {//==== Test Overflow (Real) ================================================
2501 cout << "(Real) Overflow..." << endl;
2502 di << "(Real) Overflow...";
2505 Standard_Real res, r=RealLast();
2508 sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2510 di << "-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<< "\n";
2511 Succes = Standard_False;
2513 catch(Standard_Overflow) // Solaris, Windows w/o SSE2
2515 di << " Ok" << "\n";
2517 catch(Standard_NumericError) // Linux, Windows with SSE2
2519 di << " Ok" << "\n";
2521 catch(Standard_Failure) {
2522 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2524 di << Standard_Failure::Caught()->GetMessageString();
2525 di << ")... KO" << "\n";
2526 Succes = Standard_False;
2530 {//==== Test Underflow (Real) ===============================================
2533 cout << "(Real) Underflow" << endl; // to have message in log even if process crashed
2534 di << "(Real) Underflow";
2537 Standard_Real res, r=1.0e-308;
2540 //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<endl;
2541 //++++ Succes = Standard_False;
2542 di<<" -- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... (But) Ok"<<"\n";
2544 catch(Standard_Underflow) // could be on Solaris, Windows w/o SSE2
2546 di << " Ok" << "\n";
2548 catch(Standard_NumericError) // could be on Linux, Windows with SSE2
2550 di << " Ok" << "\n";
2552 catch(Standard_Failure) {
2553 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2555 di << Standard_Failure::Caught()->GetMessageString();
2556 di << ")... KO" << "\n";
2557 Succes = Standard_False;
2561 {//==== Test Invalid Operation (Real) ===============================================
2564 cout << "(Real) Invalid Operation..." << endl;
2565 di << "(Real) Invalid Operation...";
2568 Standard_Real res, r=-1;
2570 di<<" "<<res<<"=sqrt("<<r<<") Does not Caught... KO"<<"\n";
2571 Succes = Standard_False;
2573 catch(Standard_NumericError) {
2576 catch(Standard_Failure) {
2577 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2579 di << Standard_Failure::Caught()->GetMessageString();
2580 di << ")... KO" << "\n";
2581 Succes = Standard_False;
2585 {//==== Test Access Violation ===============================================
2588 cout << "Segmentation Fault..." << endl;
2589 di << "Segmentation Fault...";
2594 di << " Does not Caught... KO"<<"\n";
2595 Succes = Standard_False;
2598 catch(OSD_Exception_ACCESS_VIOLATION)
2604 } catch(Standard_Failure) {
2605 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2607 di << Standard_Failure::Caught()->GetMessageString();
2608 di << ")... KO" << "\n";
2609 Succes = Standard_False;
2614 {//==== Test Stack Overflow ===============================================
2617 cout << "Stack Overflow..." << endl;
2618 di << "Stack Overflow...";
2622 di << " Does not Caught... KO"<<"\n";
2623 Succes = Standard_False;
2625 catch(OSD_Exception_STACK_OVERFLOW) {
2628 catch(Standard_Failure) {
2629 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2631 di << Standard_Failure::Caught()->GetMessageString();
2632 di << ")... KO" << "\n";
2633 Succes = Standard_False;
2639 di << "TestExcept: Successfull completion" << "\n";
2641 di << "TestExcept: failure" << "\n";
2647 #pragma optimize( "", on )
2650 static TopoDS_Compound AddTestStructure(int nCount_)
2656 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2657 for (int i=0; i<nCount; i++) {
2658 for (int j=0; j<nCount; j++) {
2660 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2661 TopLoc_Location topLoc(trsf);
2662 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2663 B.Add(C, tempShape);
2669 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2675 di << "Usage : " << argv[0] << " [nCount] path" << "\n";
2680 nCount = Draw::Atoi(argv[1]);
2681 TCollection_AsciiString aFilePath = argv[2];
2682 STEPCAFControl_Writer writer;
2683 Handle_TDocStd_Document document;
2684 document = new TDocStd_Document("Pace Test-StepExporter-");
2685 Handle_XCAFDoc_ShapeTool shapeTool;
2686 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2687 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2688 STEPControl_StepModelType mode = STEPControl_AsIs;
2689 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2690 di << "Failed to set assembly mode for step data\n" << "\n";
2695 if( writer.Transfer(document, mode)) {
2696 writer.Write(aFilePath.ToCString());
2699 catch(OSD_Exception_STACK_OVERFLOW) {
2700 di << "Failed : STACK OVERFLOW\n" << "\n";
2702 catch (Standard_Failure) {
2703 di << "Failed :\n" << "\n";
2704 //cout << Standard_Failure::Caught() << endl;
2705 di << Standard_Failure::Caught()->GetMessageString();
2707 di << argv[0] << " : Finish" << "\n";
2712 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2716 di << "Usage : " << argv[0] << "\n";
2720 // 1. Create an array of points
2721 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2722 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2723 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2724 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2725 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2726 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2728 // 2. Create a periodic bspline through these 5 points
2729 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2731 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2733 // 3. Increase degree of curve from 3 to 8
2734 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2735 Standard_CString CString1 = "BSplineCurve";
2736 DrawTrSurf::Set(CString1,bspline1);
2738 // 4. Convers BSpline curve to Bezier segments
2739 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2741 // 5. Test the result of conversion
2742 TCollection_AsciiString aRName;
2743 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2744 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2746 aRName=aRName+TCollection_AsciiString(i);
2747 Standard_CString aRNameStr = aRName.ToCString();
2748 DrawTrSurf::Set(aRNameStr,arc);
2749 di << aRNameStr << " ";
2755 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2759 di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
2762 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2763 if (theEdge1.IsNull()) {
2764 di << "Invalid input shape " << argv[1] << "\n";
2767 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2768 if (theEdge2.IsNull()) {
2769 di << "Invalid input shape " << argv[2] << "\n";
2772 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2773 if (theFace.IsNull()) {
2774 di << "Invalid input shape " << argv[3] << "\n";
2778 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2780 Standard_Real aConfusion = Precision::Confusion();
2781 Standard_Real aP1first, aP1last, aP2first, aP2last;
2783 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2784 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2785 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2786 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2788 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2790 Standard_Integer NbPoints = anInter.NbPoints();
2792 di << "NbPoints = " << NbPoints << "\n" ;
2796 for (i=1; i<=NbPoints; i++) {
2797 gp_Pnt2d aPi = anInter.Point(i);
2798 di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2802 Standard_Integer NbSegments = anInter.NbSegments();
2804 di << "\nNbSegments = " << NbSegments << "\n" ;
2806 if (NbSegments > 0) {
2807 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2809 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2810 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2812 Standard_Real aDist = aP1.Distance(aP2);
2814 di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
2815 di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
2817 di << "Distance = " << aDist << "\n" ;
2819 di << "Confusion = " << aConfusion << "\n" ;
2821 if (aDist > aConfusion) {
2822 di << "\n" << argv[0] << " Faulty" << "\n" ;
2824 di << "\n" << argv[0] << " OK" << "\n" ;
2827 di << "\n" << argv[0] << " OK" << "\n" ;
2832 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2836 di << "Usage : " << argv[0] << " lower upper" << "\n";
2840 Standard_Integer LOWER = Draw::Atoi(argv[1]);
2841 Standard_Integer UPPER = Draw::Atoi(argv[2]);
2843 //! 0. Create an empty document with several test labels
2844 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2845 doc->SetUndoLimit(100);
2846 TDF_Label main_label = doc->Main();
2847 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2848 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2850 //! 1. Set/Get OCAF attribute
2852 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2853 Handle(TDataStd_RealArray) array;
2854 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2855 array->Lower() == LOWER && array->Upper() == UPPER)
2856 cout<<"1: OK"<<endl;
2859 cout<<"1: Failed.."<<endl;
2862 doc->CommitCommand();
2864 //! 2. Set/Get value
2867 for (i = LOWER; i <= UPPER; i++)
2868 array->SetValue(i, i);
2869 for (i = LOWER; i <= UPPER; i++)
2871 if (array->Value(i) != i)
2873 cout<<"2: Failed.."<<endl;
2877 cout<<"2: OK"<<endl;
2878 doc->CommitCommand();
2880 //! 3. Re-init the array
2882 array->Init(LOWER + 2, UPPER + 4);
2883 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2885 cout<<"3: Failed.."<<endl;
2888 for (i = LOWER + 2; i <= UPPER + 4; i++)
2889 array->SetValue(i, i);
2890 for (i = LOWER + 2; i <= UPPER + 4; i++)
2892 if (array->Value(i) != i)
2894 cout<<"3: Failed.."<<endl;
2898 cout<<"3: OK"<<endl;
2899 doc->CommitCommand();
2903 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2904 for (i = LOWER + 5; i <= UPPER + 5; i++)
2905 arr->SetValue(i, i);
2906 array->ChangeArray(arr);
2907 for (i = LOWER + 5; i <= UPPER + 5; i++)
2909 if (array->Value(i) != i)
2911 cout<<"4: Failed.."<<endl;
2915 cout<<"4: OK"<<endl;
2916 doc->CommitCommand();
2918 //! 5. Copy the array
2920 TDF_CopyLabel copier(label1, label2);
2922 if (!copier.IsDone())
2924 cout<<"5: Failed.."<<endl;
2927 Handle(TDataStd_RealArray) array2;
2928 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2930 cout<<"5: Failed.."<<endl;
2933 for (i = LOWER + 5; i <= UPPER + 5; i++)
2935 if (array->Value(i) != i)
2937 cout<<"5: Failed.."<<endl;
2941 cout<<"5: OK"<<endl;
2942 doc->CommitCommand();
2945 //! 6.a: undoes the 5th action: the copied array should disappear
2947 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2948 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2950 cout<<"6.a: Failed.."<<endl;
2953 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2955 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2956 array->Lower() != LOWER + 2 ||
2957 array->Upper() != UPPER + 4)
2959 cout<<"6.b: Failed.."<<endl;
2962 for (i = LOWER + 2; i <= UPPER + 4; i++)
2964 if (array->Value(i) != i)
2966 cout<<"6.b: Failed.."<<endl;
2970 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
2972 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2973 array->Lower() != LOWER ||
2974 array->Upper() != UPPER)
2976 cout<<"6.c: Failed.."<<endl;
2979 for (i = LOWER; i <= UPPER; i++)
2981 if (array->Value(i) != i)
2983 cout<<"6.c: Failed.."<<endl;
2987 //! 6.d: undoes and redoes the 2nd action: no change is expected.
2990 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2991 array->Lower() != LOWER ||
2992 array->Upper() != UPPER)
2994 cout<<"6.d: Failed.."<<endl;
2997 for (i = LOWER; i <= UPPER; i++)
2999 if (array->Value(i) != i)
3001 cout<<"6.d: Failed.."<<endl;
3005 cout<<"6: OK"<<endl;
3007 //! 7. Re-set the array
3009 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
3010 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
3012 cout<<"7: Failed.."<<endl;
3015 for (i = LOWER + 1; i <= UPPER + 1; i++)
3016 array->SetValue(i, i);
3017 for (i = LOWER + 1; i <= UPPER + 1; i++)
3019 if (array->Value(i) != i)
3021 cout<<"7: Failed.."<<endl;
3025 cout<<"7: OK"<<endl;
3026 doc->CommitCommand();
3028 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
3029 //! measure the time spent by this test.
3035 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3037 Standard_Boolean IsEvenArgc = Standard_True;
3038 if (argc % 2 == 0) {
3039 IsEvenArgc = Standard_True;
3041 IsEvenArgc = Standard_False;
3044 if (argc < 3 || IsEvenArgc)
3046 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
3050 Standard_Integer i, aValue, aPosition;
3051 NCollection_Vector<int> vec;
3052 for (i = 0; i < argc - 1; i++) {
3054 aValue = Draw::Atoi(argv[i]);
3055 aPosition = Draw::Atoi(argv[i+1]);
3056 vec.SetValue(aValue, aPosition);
3058 NCollection_Vector<int>::Iterator it(vec);
3060 for (j = 0; it.More(); it.Next(), j++) {
3061 //di << it.Value() << "\n";
3062 di << j << " " << it.Value() << "\n";
3068 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3071 di << "Usage : " << argv[0] << "\n";
3075 gp_Pnt point(0.0,0.0,0.0);
3077 TColgp_Array1OfPnt poles(0,6);
3080 point.SetCoord(1.0,1.0,0.0);
3083 point.SetCoord(2.0,1.0,0.0);
3086 point.SetCoord(3.0,0.0,0.0);
3089 point.SetCoord(4.0,1.0,0.0);
3092 point.SetCoord(5.0,1.0,0.0);
3095 point.SetCoord(6.0,0.0,0.0);
3098 TColStd_Array1OfReal knots(0,2);
3103 TColStd_Array1OfInteger multi(0,2);
3108 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
3111 Standard_Real l_abcissa,l_gprop;
3112 GeomAdaptor_Curve adaptor_spline(spline);
3113 GCPnts_AbscissaPoint temp;
3114 l_abcissa=temp.Length(adaptor_spline);
3115 cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
3118 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
3120 BRepGProp::LinearProperties(edge,prop);
3121 l_gprop=prop.Mass();
3122 cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
3124 cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
3129 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3133 di << "Usage : " << argv[0] << "\n";
3137 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3138 if(AISContext.IsNull())
3140 di << "use 'vinit' command before " << argv[0] << "\n";
3145 AIS_ListOfInteractive ListOfIO_1;
3146 AISContext->ObjectsInside(ListOfIO_1);
3147 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3148 if (!ListOfIO_1.IsEmpty() ) {
3149 AIS_ListIteratorOfListOfInteractive iter;
3150 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3151 Handle(AIS_InteractiveObject) aIO=iter.Value();
3152 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3159 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3161 if ((argc < 9) || (((argc-3) % 3) != 0))
3163 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3166 Standard_Integer i, j, np = (argc-3) / 3;
3167 BRepBuilderAPI_MakePolygon W;
3169 for (i = 1; i <= np; i ++) {
3170 W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2])));
3174 DBRep::Set(argv[1],W.Wire());
3175 DBRep::Set(argv[2],W.Edge());
3179 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3182 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3185 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3186 gp_Dir(1., -1., 0.));
3188 aTrf.SetAffinity (aPln, Draw::Atof(argv[4]));
3189 gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3190 gp_XYZ aResult (aOrigin);
3191 aTrf.Transforms(aResult);
3193 Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3194 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3195 aResult.X(), aResult.Y(), aResult.Z());
3200 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3203 di << "Usage : " << argv[0] << " shape [deflection]\n";
3207 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3209 if (aShape.IsNull()) {
3210 di<<" Null shape is not allowed";
3214 Standard_Real aDeflection = 0.45110277533;
3216 aDeflection = Draw::Atof(argv[2]);
3218 di<<"deflection="<< aDeflection << "\n";
3220 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
3221 TopLoc_Location aLocation;
3222 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3224 if(aTriang.IsNull()) {
3225 di << argv[0] << " : Faulty\n" ;
3227 di << argv[0] << " : OK\n" ;
3228 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3229 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3234 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3237 di << "Usage : " << argv[0] << " A B C\n";
3242 gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3243 gp_Pnt2d anOrigin = aLin2d.Location();
3244 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3246 catch(Standard_ConstructionError)
3248 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3253 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3256 di << "Usage : " << argv[0] << " file shape\n";
3260 IGESControl_Reader aReader;
3261 aReader.ReadFile(argv[1]);
3262 aReader.SetReadVisible(Standard_True);
3263 aReader.TransferRoots();
3265 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3266 if (model.IsNull()) {
3267 di << "model.IsNull()\n";
3270 Standard_Integer nb = model->NbEntities();
3271 for (Standard_Integer i = 1; i <= nb; i ++) {
3272 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3273 Handle(TCollection_HAsciiString) name;
3274 name = ent->NameValue();
3275 Standard_CString aStr = name->ToCString();
3276 di << "NameValue = " << aStr << "\n";
3279 TopoDS_Shape shape = aReader.OneShape();
3280 DBRep::Set(argv[2],shape);
3284 // For OCC16782 testing
3285 #include <AppStd_Application.hxx>
3286 #include <TDF_Tool.hxx>
3287 #include <TColStd_HArray1OfInteger.hxx>
3289 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3290 #include <TColStd_ListIteratorOfListOfReal.hxx>
3291 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3292 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3293 #include <TDF_ListIteratorOfLabelList.hxx>
3295 #include <TDataStd_Tick.hxx>
3296 #include <TDataStd_IntegerList.hxx>
3297 #include <TDataStd_RealList.hxx>
3298 #include <TDataStd_ExtStringList.hxx>
3299 #include <TDataStd_BooleanList.hxx>
3300 #include <TDataStd_ReferenceList.hxx>
3301 #include <TDataStd_BooleanArray.hxx>
3302 #include <TDataStd_ReferenceArray.hxx>
3303 #include <TDataStd_ByteArray.hxx>
3304 #include <TDataStd_NamedData.hxx>
3305 #include <TDF_Reference.hxx>
3307 Handle(AppStd_Application) app;
3308 int TestSetGet(const Handle(TDocStd_Document)& doc)
3312 TDataStd_Tick::Set(doc->Main());
3314 Handle(TDataStd_Tick) tick;
3315 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3318 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3319 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3321 doc->Main().ResumeAttribute(tick);
3322 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3325 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3326 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3329 // TDataStd_IntegerList:
3331 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3332 setintlist->Append(2);
3333 setintlist->Prepend(1);
3334 setintlist->InsertAfter(3, 2);
3335 setintlist->InsertBefore(0, 1);
3336 setintlist->Append(200);
3337 setintlist->Remove(0);
3338 setintlist->Remove(200);
3340 Handle(TDataStd_IntegerList) getintlist;
3341 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3343 if (getintlist->First() != 1)
3345 if (getintlist->Last() != 3)
3347 const TColStd_ListOfInteger& intlist = getintlist->List();
3348 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3349 for (; itr_intlist.More(); itr_intlist.Next())
3351 if (itr_intlist.Value() != 1 &&
3352 itr_intlist.Value() != 2 &&
3353 itr_intlist.Value() != 3)
3358 getintlist->Clear();
3360 // TDataStd_RealList:
3362 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3363 setdbllist->Append(2.5);
3364 setdbllist->Prepend(1.5);
3365 setdbllist->InsertAfter(3.5, 2.5);
3366 setdbllist->InsertBefore(0.5, 1.5);
3367 setdbllist->Append(200.5);
3368 setdbllist->Remove(0.5);
3369 setdbllist->Remove(200.5);
3371 Handle(TDataStd_RealList) getdbllist;
3372 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3374 if (getdbllist->First() != 1.5)
3376 if (getdbllist->Last() != 3.5)
3378 const TColStd_ListOfReal& dbllist = getdbllist->List();
3379 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3380 for (; itr_dbllist.More(); itr_dbllist.Next())
3382 if (itr_dbllist.Value() != 1.5 &&
3383 itr_dbllist.Value() != 2.5 &&
3384 itr_dbllist.Value() != 3.5)
3389 getdbllist->Clear();
3391 // TDataStd_ExtStringList:
3393 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3394 setstrlist->Append("Hello");
3395 setstrlist->Prepend("Guten Tag");
3396 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3397 setstrlist->InsertBefore("Bonsoir", "Hello");
3398 setstrlist->Append("Good bye");
3399 setstrlist->Remove("Bonsoir");
3400 setstrlist->Remove("Good bye");
3402 Handle(TDataStd_ExtStringList) getstrlist;
3403 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3405 if (getstrlist->First() != "Guten Tag")
3407 if (getstrlist->Last() != "Hello")
3409 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3410 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3411 for (; itr_strlist.More(); itr_strlist.Next())
3413 if (itr_strlist.Value() != "Guten Tag" &&
3414 itr_strlist.Value() != "Bonjour" &&
3415 itr_strlist.Value() != "Hello")
3420 getstrlist->Clear();
3422 // TDataStd_BooleanList:
3424 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3425 setboollist->Append(Standard_True);
3426 setboollist->Prepend(Standard_False);
3428 Handle(TDataStd_BooleanList) getboollist;
3429 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3431 if (getboollist->First() != Standard_False)
3433 if (getboollist->Last() != Standard_True)
3435 const TDataStd_ListOfByte& boollist = getboollist->List();
3436 TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
3437 for (; itr_boollist.More(); itr_boollist.Next())
3439 if (itr_boollist.Value() != Standard_True &&
3440 itr_boollist.Value() != Standard_False)
3445 getboollist->Clear();
3447 // TDataStd_ReferenceList:
3448 TDF_Label L1 = doc->Main().FindChild(100);
3449 TDF_Label L2 = doc->Main().FindChild(101);
3450 TDF_Label L3 = doc->Main().FindChild(102);
3451 TDF_Label L4 = doc->Main().FindChild(103);
3452 TDF_Label L5 = doc->Main().FindChild(104);
3454 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3455 setreflist->Append(L1);
3456 setreflist->Prepend(L2);
3457 setreflist->InsertAfter(L3, L2);
3458 setreflist->InsertBefore(L4, L1);
3459 setreflist->Append(L5);
3460 setreflist->Remove(L4);
3461 setreflist->Remove(L5);
3463 Handle(TDataStd_ReferenceList) getreflist;
3464 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3466 if (getreflist->First() != L2)
3468 if (getreflist->Last() != L1)
3470 const TDF_LabelList& reflist = getreflist->List();
3471 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3472 for (; itr_reflist.More(); itr_reflist.Next())
3474 if (itr_reflist.Value() != L1 &&
3475 itr_reflist.Value() != L2 &&
3476 itr_reflist.Value() != L3)
3481 getreflist->Clear();
3483 // TDataStd_BooleanArray:
3485 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3486 setboolarr->SetValue(12, Standard_True);
3487 setboolarr->SetValue(13, Standard_False);
3488 setboolarr->SetValue(14, Standard_False);
3489 setboolarr->SetValue(15, Standard_False);
3490 setboolarr->SetValue(16, Standard_True);
3491 setboolarr->SetValue(14, Standard_True);
3493 Handle(TDataStd_BooleanArray) getboolarr;
3494 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3496 if (getboolarr->Value(12) != Standard_True)
3498 if (getboolarr->Value(13) != Standard_False)
3500 if (getboolarr->Value(14) != Standard_True)
3502 if (getboolarr->Value(15) != Standard_False)
3504 if (getboolarr->Value(16) != Standard_True)
3507 // TDataStd_ReferenceArray:
3509 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3510 setrefarr->SetValue(0, L1);
3511 setrefarr->SetValue(1, L2);
3512 setrefarr->SetValue(2, L3);
3513 setrefarr->SetValue(3, L4);
3514 setrefarr->SetValue(4, L5);
3516 Handle(TDataStd_ReferenceArray) getrefarr;
3517 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3519 if (getrefarr->Value(0) != L1)
3521 if (getrefarr->Value(1) != L2)
3523 if (getrefarr->Value(2) != L3)
3525 if (getrefarr->Value(3) != L4)
3527 if (getrefarr->Value(4) != L5)
3530 // TDataStd_ByteArray:
3532 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3533 setbytearr->SetValue(12, 0);
3534 setbytearr->SetValue(13, 1);
3535 setbytearr->SetValue(14, 2);
3536 setbytearr->SetValue(15, 3);
3537 setbytearr->SetValue(16, 255);
3539 Handle(TDataStd_ByteArray) getbytearr;
3540 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3542 if (getbytearr->Value(12) != 0)
3544 if (getbytearr->Value(13) != 1)
3546 if (getbytearr->Value(14) != 2)
3548 if (getbytearr->Value(15) != 3)
3550 if (getbytearr->Value(16) != 255)
3553 // TDataStd_NamedData:
3555 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3556 setnd->SetInteger("Integer1", 1);
3557 setnd->SetInteger("Integer2", 2);
3558 setnd->SetInteger("Integer3", 8);
3559 setnd->SetInteger("Integer3", 3);
3561 Handle(TDataStd_NamedData) getnd;
3562 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3564 if (!getnd->HasIntegers())
3566 if (!getnd->HasInteger("Integer1"))
3568 if (getnd->GetInteger("Integer2") != 2)
3570 if (getnd->GetInteger("Integer3") != 3)
3576 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3580 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3581 doc->CommitCommand();
3582 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3585 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3588 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3591 // TDataStd_IntegerList:
3593 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3595 intlist->Prepend(1);
3596 intlist->InsertBefore(0, 1);
3597 intlist->InsertAfter(3, 2);
3598 doc->CommitCommand();
3599 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3602 if (!intlist->IsEmpty())
3605 if (!intlist->Extent())
3607 if (intlist->First() != 0)
3609 if (intlist->Last() != 3)
3613 // TDataStd_RealList:
3615 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3616 dbllist->Append(2.5);
3617 dbllist->Prepend(1.5);
3618 dbllist->InsertBefore(0.5, 1.5);
3619 dbllist->InsertAfter(3.5, 2.5);
3620 doc->CommitCommand();
3621 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3624 if (!dbllist->IsEmpty())
3627 if (!dbllist->Extent())
3629 if (dbllist->First() != 0.5)
3631 if (dbllist->Last() != 3.5)
3635 // TDataStd_ExtStringList:
3637 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3638 strlist->Append("Hello");
3639 strlist->Prepend("Guten Tag");
3640 strlist->InsertAfter("Bonjour", "Guten Tag");
3641 strlist->InsertBefore("Bonsoir", "Hello");
3642 doc->CommitCommand();
3643 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3646 if (!strlist->IsEmpty())
3649 if (!strlist->Extent())
3651 if (strlist->First() != "Guten Tag")
3653 if (strlist->Last() != "Hello")
3657 // TDataStd_BooleanList:
3659 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3660 boollist->Append(Standard_True);
3661 boollist->Prepend(Standard_False);
3662 doc->CommitCommand();
3663 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3666 if (!boollist->IsEmpty())
3669 if (!boollist->Extent())
3671 if (boollist->First() != Standard_False)
3673 if (boollist->Last() != Standard_True)
3677 // TDataStd_ReferenceList:
3678 TDF_Label L1 = doc->Main().FindChild(100);
3679 TDF_Label L2 = doc->Main().FindChild(101);
3680 TDF_Label L3 = doc->Main().FindChild(102);
3681 TDF_Label L4 = doc->Main().FindChild(103);
3683 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3684 reflist->Append(L1);
3685 reflist->Prepend(L2);
3686 reflist->InsertBefore(L3, L1);
3687 reflist->InsertAfter(L4, L2);
3688 doc->CommitCommand();
3689 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3692 if (!reflist->IsEmpty())
3695 if (!reflist->Extent())
3697 if (reflist->First() != L2)
3699 if (reflist->Last() != L1)
3703 // TDataStd_BooleanArray:
3705 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3706 boolarr->SetValue(23, Standard_True);
3707 boolarr->SetValue(25, Standard_True);
3708 doc->CommitCommand();
3710 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3711 boolarr->SetValue(230, Standard_True);
3712 boolarr->SetValue(250, Standard_True);
3713 doc->CommitCommand();
3715 if (boolarr->Value(23) != Standard_True)
3717 if (boolarr->Value(24) != Standard_False)
3719 if (boolarr->Value(25) != Standard_True)
3722 if (boolarr->Value(230) != Standard_True)
3724 if (boolarr->Value(240) != Standard_False)
3726 if (boolarr->Value(250) != Standard_True)
3729 // TDataStd_ReferenceArray:
3731 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3732 refarr->SetValue(5, L1);
3733 refarr->SetValue(6, L2);
3734 refarr->SetValue(7, L3);
3735 refarr->SetValue(8, L4);
3736 doc->CommitCommand();
3737 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3741 if (refarr->Value(5) != L1)
3743 if (refarr->Value(6) != L2)
3745 if (refarr->Value(7) != L3)
3747 if (refarr->Value(8) != L4)
3750 // TDataStd_ByteArray:
3752 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3753 bytearr->SetValue(23, 23);
3754 bytearr->SetValue(25, 25);
3755 doc->CommitCommand();
3757 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3758 bytearr->SetValue(230, 230);
3759 bytearr->SetValue(250, 250);
3760 doc->CommitCommand();
3762 if (bytearr->Value(23) != 23)
3764 if (bytearr->Value(25) != 25)
3767 if (bytearr->Value(230) != 230)
3769 if (bytearr->Value(250) != 250)
3772 // TDataStd_NamedData:
3774 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3775 nd->SetByte("b14", 12);
3776 nd->SetByte("b17", 18);
3777 nd->SetByte("b14", 14);
3778 nd->SetByte("b17", 17);
3779 doc->CommitCommand();
3781 nd = TDataStd_NamedData::Set(doc->Main());
3782 nd->SetReal("r14", 14);
3783 nd->SetReal("r17", 17);
3784 nd->SetReal("r14", 14.4);
3785 nd->SetReal("r17", 17.7);
3786 doc->CommitCommand();
3788 if (nd->HasStrings())
3792 if (nd->HasReal("r17"))
3794 if (!nd->HasBytes())
3796 if (nd->GetByte("b14") != 14)
3798 if (nd->GetByte("b17") != 17)
3800 if (nd->HasByte("b18"))
3803 if (!nd->HasBytes())
3805 if (!nd->HasReals())
3807 if (nd->GetByte("b14") != 14)
3809 if (nd->GetReal("r14") != 14.4)
3811 if (nd->GetReal("r17") != 17.7)
3817 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3819 TDF_Label L1 = doc->Main().FindChild(1);
3820 TDF_Label L2 = doc->Main().FindChild(2);
3821 TDF_CopyLabel copier(L1, L2);
3824 TDataStd_Tick::Set(L1);
3826 if (!copier.IsDone())
3828 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3831 // TDataStd_IntegerList:
3832 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3834 intlist->InsertAfter(2, 1);
3836 if (!copier.IsDone())
3840 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3842 if (intlist->First() != 1)
3844 if (intlist->Last() != 2)
3848 // TDataStd_RealList:
3849 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3850 dbllist->Append(1.5);
3851 dbllist->InsertAfter(2.5, 1.5);
3853 if (!copier.IsDone())
3857 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3859 if (dbllist->First() != 1.5)
3861 if (dbllist->Last() != 2.5)
3865 // TDataStd_ExtStringList:
3866 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3867 strlist->Append("Open CASCADE");
3868 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3870 if (!copier.IsDone())
3874 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3876 if (strlist->First() != "Open CASCADE")
3878 if (strlist->Last() != " - is the best set of libraries!")
3882 // TDataStd_BooleanList:
3883 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3884 boollist->Append(Standard_True);
3885 boollist->Prepend(Standard_False);
3887 if (!copier.IsDone())
3891 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3893 if (boollist->First() != Standard_False)
3895 if (boollist->Last() != Standard_True)
3899 // TDataStd_ReferenceList:
3900 TDF_Label L100 = doc->Main().FindChild(100);
3901 TDF_Label L101 = doc->Main().FindChild(101);
3902 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3903 reflist->Append(L100);
3904 reflist->InsertAfter(L101, L100);
3906 if (!copier.IsDone())
3910 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3912 if (reflist->First() != L100)
3914 if (reflist->Last() != L101)
3918 // TDataStd_BooleanArray:
3919 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3920 boolarr->SetValue(4, Standard_True);
3921 boolarr->SetValue(6, Standard_True);
3923 if (!copier.IsDone())
3926 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3928 if (boolarr->Value(4) != Standard_True)
3930 if (boolarr->Value(5) != Standard_False)
3932 if (boolarr->Value(6) != Standard_True)
3935 // TDataStd_ReferenceArray:
3936 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3937 refarr->SetValue(3, L100);
3938 refarr->SetValue(4, L101);
3940 if (!copier.IsDone())
3943 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3945 if (refarr->Value(3) != L100)
3947 if (refarr->Value(4) != L101)
3950 // TDataStd_ByteArray:
3951 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
3952 bytearr->SetValue(4, 40);
3953 bytearr->SetValue(6, 60);
3955 if (!copier.IsDone())
3958 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
3960 if (bytearr->Value(4) != 40)
3962 if (bytearr->Value(6) != 60)
3965 // TDataStd_NamedData:
3966 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
3967 nd->SetInteger("Integer1", 11);
3968 nd->SetReal("Real1", 11.1);
3969 nd->SetString("String1", "11.11111111");
3970 nd->SetByte("Byte1", 111);
3971 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
3972 ints_arr->SetValue(4, 4);
3973 ints_arr->SetValue(5, 5);
3974 nd->SetArrayOfIntegers("Integers1", ints_arr);
3976 if (!copier.IsDone())
3979 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
3981 if (!nd->HasIntegers())
3983 if (!nd->HasReals())
3985 if (!nd->HasStrings())
3987 if (!nd->HasBytes())
3989 if (!nd->HasArraysOfIntegers())
3991 if (nd->HasArraysOfReals())
3993 if (!nd->HasInteger("Integer1"))
3995 if (nd->GetInteger("Integer1") != 11)
3997 if (!nd->HasReal("Real1"))
3999 if (nd->GetReal("Real1") != 11.1)
4001 if (!nd->HasString("String1"))
4003 if (nd->GetString("String1") != "11.11111111")
4005 if (!nd->HasByte("Byte1"))
4007 if (nd->GetByte("Byte1") != 111)
4009 if (!nd->HasArrayOfIntegers("Integers1"))
4011 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
4012 if (ints_arr_out.IsNull())
4014 if (ints_arr_out->Value(5) != 5)
4020 int TestOpenSave(TCollection_ExtendedString aFile1,
4021 TCollection_ExtendedString aFile2,
4022 TCollection_ExtendedString aFile3)
4025 Handle(TDocStd_Document) doc_std, doc_std_open;
4026 app->NewDocument("MDTV-Standard", doc_std);
4028 TDataStd_Tick::Set(doc_std->Main());
4029 // TDataStd_IntegerList:
4030 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
4033 // TDataStd_RealList:
4034 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
4035 dbllist->Append(1.5);
4036 dbllist->Append(5.5);
4037 // TDataStd_ExtStringList:
4038 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
4039 strlist->Append("Auf");
4040 strlist->Append("Wiedersehen");
4041 // TDataStd_BooleanList:
4042 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
4043 boollist->Append(Standard_False);
4044 boollist->Append(Standard_True);
4045 // TDataStd_ReferenceList:
4046 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
4047 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
4048 TDF_Tool::Entry(Lstd1, entry1);
4049 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
4050 TDF_Tool::Entry(Lstd2, entry2);
4051 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
4052 reflist->Append(Lstd1);
4053 reflist->Append(Lstd2);
4054 // TDataStd_BooleanArray:
4055 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
4056 boolarr->SetValue(15, Standard_False);
4057 boolarr->SetValue(16, Standard_True);
4058 boolarr->SetValue(17, Standard_True);
4059 boolarr->SetValue(18, Standard_True);
4060 // TDataStd_ReferenceArray:
4061 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
4062 refarr->SetValue(45, Lstd1);
4063 refarr->SetValue(46, Lstd2);
4064 // TDataStd_ByteArray:
4065 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
4066 bytearr->SetValue(15, 150);
4067 bytearr->SetValue(16, 160);
4068 bytearr->SetValue(17, 170);
4069 bytearr->SetValue(18, 180);
4070 // TDataStd_NamedData:
4071 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
4073 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
4074 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
4077 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
4078 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
4087 app->Close(doc_std);
4089 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
4090 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
4092 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4094 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4096 if (intlist->First() != 1)
4098 if (intlist->Last() != 5)
4100 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4102 if (dbllist->First() != 1.5)
4104 if (dbllist->Last() != 5.5)
4106 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4108 if (strlist->First() != "Auf")
4110 if (strlist->Last() != "Wiedersehen")
4112 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4114 if (boollist->First() != Standard_False)
4116 if (boollist->Last() != Standard_True)
4118 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4120 TDF_Tool::Entry(reflist->First(), entry_first);
4121 if (entry1 != entry_first)
4123 TDF_Tool::Entry(reflist->Last(), entry_last);
4124 if (entry2 != entry_last)
4126 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4128 if (boolarr->Value(15) != Standard_False)
4130 if (boolarr->Value(16) != Standard_True)
4132 if (boolarr->Value(17) != Standard_True)
4134 if (boolarr->Value(18) != Standard_True)
4136 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4138 TDF_Tool::Entry(refarr->Value(45), entry_first);
4139 if (entry1 != entry_first)
4141 TDF_Tool::Entry(refarr->Value(46), entry_last);
4142 if (entry2 != entry_last)
4144 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4146 if (bytearr->Value(15) != 150)
4148 if (bytearr->Value(16) != 160)
4150 if (bytearr->Value(17) != 170)
4152 if (bytearr->Value(18) != 180)
4154 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4156 if (ref->Get().IsNull())
4158 if (ref->Get().Tag() != 103)
4162 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4163 app->NewDocument("XmlOcaf", doc_xml);
4165 TDataStd_Tick::Set(doc_xml->Main());
4166 // TDataStd_IntegerList:
4167 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4170 // TDataStd_RealList:
4171 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4172 dbllist->Append(1.5);
4173 dbllist->Append(5.5);
4174 // TDataStd_ExtStringList:
4175 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4176 strlist->Append("Guten ");
4177 strlist->Append("Tag");
4178 // TDataStd_BooleanList:
4179 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4180 boollist->Append(Standard_False);
4181 boollist->Append(Standard_True);
4182 // TDataStd_ReferenceList:
4183 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4184 TDF_Tool::Entry(Lxml1, entry1);
4185 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4186 TDF_Tool::Entry(Lxml2, entry2);
4187 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4188 reflist->Append(Lxml1);
4189 reflist->Append(Lxml2);
4190 // TDataStd_BooleanArray:
4191 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4192 boolarr->SetValue(15, Standard_False);
4193 boolarr->SetValue(16, Standard_True);
4194 boolarr->SetValue(17, Standard_True);
4195 boolarr->SetValue(18, Standard_True);
4196 boolarr->SetValue(19, Standard_True);
4197 boolarr->SetValue(20, Standard_True);
4198 boolarr->SetValue(21, Standard_False);
4199 boolarr->SetValue(22, Standard_True);
4200 boolarr->SetValue(23, Standard_True);
4201 boolarr->SetValue(24, Standard_True);
4202 // TDataStd_ReferenceArray:
4203 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4204 refarr->SetValue(444, Lxml1);
4205 refarr->SetValue(445, Lxml2);
4206 // TDataStd_ByteArray:
4207 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4208 bytearr->SetValue(15, 0);
4209 bytearr->SetValue(16, 10);
4210 bytearr->SetValue(17, 100);
4211 bytearr->SetValue(18, 200);
4212 bytearr->SetValue(19, 250);
4213 bytearr->SetValue(20, 251);
4214 bytearr->SetValue(21, 252);
4215 bytearr->SetValue(22, 253);
4216 bytearr->SetValue(23, 254);
4217 bytearr->SetValue(24, 255);
4219 Lstd3 = doc_xml->Main().FindChild(103);
4220 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4223 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4224 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4228 app->Close(doc_xml);
4230 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4231 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4233 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4235 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4237 if (intlist->First() != 1)
4239 if (intlist->Last() != 5)
4241 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4243 if (dbllist->First() != 1.5)
4245 if (dbllist->Last() != 5.5)
4247 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4249 if (strlist->First() != "Guten ")
4251 if (strlist->Last() != "Tag")
4253 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4255 if (boollist->First() != Standard_False)
4257 if (boollist->Last() != Standard_True)
4259 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4261 TDF_Tool::Entry(reflist->First(), entry_first);
4262 if (entry1 != entry_first)
4264 TDF_Tool::Entry(reflist->Last(), entry_last);
4265 if (entry2 != entry_last)
4267 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4269 if (boolarr->Value(15) != Standard_False)
4271 if (boolarr->Value(16) != Standard_True)
4273 if (boolarr->Value(17) != Standard_True)
4275 if (boolarr->Value(18) != Standard_True)
4277 if (boolarr->Value(19) != Standard_True)
4279 if (boolarr->Value(20) != Standard_True)
4281 if (boolarr->Value(21) != Standard_False)
4283 if (boolarr->Value(22) != Standard_True)
4285 if (boolarr->Value(23) != Standard_True)
4287 if (boolarr->Value(24) != Standard_True)
4289 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4291 TDF_Tool::Entry(refarr->Value(444), entry_first);
4292 if (entry1 != entry_first)
4294 TDF_Tool::Entry(refarr->Value(445), entry_last);
4295 if (entry2 != entry_last)
4297 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4299 if (bytearr->Value(15) != 0)
4301 if (bytearr->Value(16) != 10)
4303 if (bytearr->Value(17) != 100)
4305 if (bytearr->Value(18) != 200)
4307 if (bytearr->Value(19) != 250)
4309 if (bytearr->Value(20) != 251)
4311 if (bytearr->Value(21) != 252)
4313 if (bytearr->Value(22) != 253)
4315 if (bytearr->Value(23) != 254)
4317 if (bytearr->Value(24) != 255)
4319 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4321 if (ref->Get().IsNull())
4323 if (ref->Get().Tag() != 103)
4327 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4328 app->NewDocument("BinOcaf", doc_bin);
4330 TDataStd_Tick::Set(doc_bin->Main());
4331 // TDataStd_IntegerList:
4332 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4335 // TDataStd_RealList:
4336 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4337 dbllist->Append(1.5);
4338 dbllist->Append(5.5);
4339 // TDataStd_ExtStringList:
4340 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4341 strlist->Append("Bonjour");
4342 strlist->Append("Bonsoir");
4343 // TDataStd_BooleanList:
4344 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4345 boollist->Append(Standard_False);
4346 boollist->Append(Standard_True);
4347 // TDataStd_ReferenceList:
4348 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4349 TDF_Tool::Entry(Lbin1, entry1);
4350 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4351 TDF_Tool::Entry(Lbin2, entry2);
4352 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4353 reflist->Append(Lbin1);
4354 reflist->Append(Lbin2);
4355 // TDataStd_BooleanArray:
4356 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4357 boolarr->SetValue(15, Standard_False);
4358 boolarr->SetValue(16, Standard_True);
4359 boolarr->SetValue(17, Standard_True);
4360 boolarr->SetValue(18, Standard_True);
4361 boolarr->SetValue(19, Standard_True);
4362 boolarr->SetValue(20, Standard_True);
4363 boolarr->SetValue(21, Standard_False);
4364 boolarr->SetValue(22, Standard_True);
4365 boolarr->SetValue(23, Standard_True);
4366 boolarr->SetValue(24, Standard_True);
4367 // TDataStd_ReferenceArray:
4368 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4369 refarr->SetValue(0, Lbin1);
4370 refarr->SetValue(1, Lbin2);
4371 // TDataStd_ByteArray:
4372 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4373 bytearr->SetValue(15, 0);
4374 bytearr->SetValue(16, 255);
4375 // TDataStd_NamedData:
4376 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4377 nameddata->SetByte("A", 12);
4378 nameddata->SetByte("B", 234);
4380 Lstd3 = doc_bin->Main().FindChild(103);
4381 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4384 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4385 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4389 app->Close(doc_bin);
4391 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4392 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4394 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4396 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4398 if (intlist->First() != 1)
4400 if (intlist->Last() != 5)
4402 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4404 if (dbllist->First() != 1.5)
4406 if (dbllist->Last() != 5.5)
4408 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4410 if (strlist->First() != "Bonjour")
4412 if (strlist->Last() != "Bonsoir")
4414 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4416 if (boollist->First() != Standard_False)
4418 if (boollist->Last() != Standard_True)
4420 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4422 TDF_Tool::Entry(reflist->First(), entry_first);
4423 if (entry1 != entry_first)
4425 TDF_Tool::Entry(reflist->Last(), entry_last);
4426 if (entry2 != entry_last)
4428 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4430 if (boolarr->Value(15) != Standard_False)
4432 if (boolarr->Value(16) != Standard_True)
4434 if (boolarr->Value(17) != Standard_True)
4436 if (boolarr->Value(18) != Standard_True)
4438 if (boolarr->Value(19) != Standard_True)
4440 if (boolarr->Value(20) != Standard_True)
4442 if (boolarr->Value(21) != Standard_False)
4444 if (boolarr->Value(22) != Standard_True)
4446 if (boolarr->Value(23) != Standard_True)
4448 if (boolarr->Value(24) != Standard_True)
4450 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4452 TDF_Tool::Entry(refarr->Value(0), entry_first);
4453 if (entry1 != entry_first)
4455 TDF_Tool::Entry(refarr->Value(1), entry_last);
4456 if (entry2 != entry_last)
4458 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4460 if (bytearr->Value(15) != 0)
4462 if (bytearr->Value(16) != 255)
4464 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4466 if (nameddata->GetByte("A") != 12)
4468 if (nameddata->GetByte("B") != 234)
4470 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4472 if (ref->Get().IsNull())
4474 if (ref->Get().Tag() != 103)
4479 // For OCC16782 testing
4481 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4485 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4488 TCollection_ExtendedString aFile1(argv[1]);
4489 TCollection_ExtendedString aFile2(argv[2]);
4490 TCollection_ExtendedString aFile3(argv[3]);
4493 app = new AppStd_Application();
4497 Handle(TDocStd_Document) doc;
4498 app->NewDocument("MDTV-Standard", doc);
4499 doc->SetUndoLimit(10);
4501 di <<"\nTestSetGet start\n";
4502 good += TestSetGet(doc);
4503 di <<"TestSetGet finish\n";
4504 di <<"Status = " << good << "\n";
4506 di <<"\nTestUndoRedo start\n";
4507 good += TestUndoRedo(doc);
4508 di <<"TestUndoRedo finish\n";
4509 di <<"Status = " << good << "\n";
4511 di <<"\nTestCopyPaste start\n";
4512 good += TestCopyPaste(doc);
4513 di <<"TestCopyPaste finish\n";
4514 di <<"Status = " << good << "\n";
4516 di <<"\nTestOpenSave start\n";
4517 good += TestOpenSave(aFile1, aFile2, aFile3);
4518 di <<"TestOpenSave finish\n";
4519 di <<"Status = " << good << "\n";
4522 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4524 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4529 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4531 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4532 if(aContext.IsNull()) {
4533 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
4539 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4542 Standard_Integer mode = 0;
4545 mode = Draw::Atoi(argv[1]);
4547 if (mode > 2 || mode < 0)
4549 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4552 Handle(V3d_View) V = ViewerTest::CurrentView();
4553 if ( !V.IsNull() ) {
4555 V->ColorScaleDisplay();
4558 V->ColorScaleErase();
4563 Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
4565 di <<"ColorScaleIsDisplayed = " << "1" << "\n";
4567 di <<"ColorScaleIsDisplayed = " << "0" << "\n";
4573 #include <Interface_Macros.hxx>
4574 #include <IGESControl_Controller.hxx>
4575 #include <XSDRAW.hxx>
4576 #include <Draw_ProgressIndicator.hxx>
4577 #include <XSControl_WorkSession.hxx>
4578 #include <Transfer_TransientProcess.hxx>
4579 #include <XSDRAW_Commands.hxx>
4580 #include <TColStd_HSequenceOfTransient.hxx>
4581 #include <Message_ProgressSentry.hxx>
4582 #include <XSControl_TransferReader.hxx>
4584 static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4586 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
4587 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
4589 // Progress indicator
4590 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
4591 progress->SetScale ( 0, 100, 1 );
4594 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
4596 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
4598 TCollection_AsciiString fnom,rnom;
4600 Standard_Boolean modfic = XSDRAW::FileAndVar
4601 (argv[1],argv[2],"IGESBREP",fnom,rnom);
4602 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
4603 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
4604 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
4605 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
4608 OSD_Timer Chr; Chr.Reset();
4614 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
4618 //In order to decrease number of produced edges during translation it is possible to set following parameter
4619 Interface_Static::SetIVal("read.iges.bspline.continuity",0);
4622 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
4623 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
4625 progress->EndScope();
4628 if (readstat != IFSelect_RetDone) {
4629 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
4630 else di<<"No model loaded"<<"\n";
4633 // Choice of treatment
4634 Standard_Boolean fromtcl = (argc > 3);
4635 Standard_Integer modepri = 1, nent, nbs;
4636 if (fromtcl) modepri = 4;
4639 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
4640 //mode OnlyVisible does not work.
4641 // nent = Reader.NbRootsForTransfer();
4643 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
4646 // amv 26.09.2003 : this is used to avoid error of enter's simbol
4649 modepri = Draw::Atoi(str);
4652 if (modepri == 0) { //fin
4653 di << "Bye and good luck! " << "\n";
4657 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
4658 di << "All Geometry Transfer"<<"\n";
4659 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4660 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4661 Handle(XSControl_WorkSession) thesession = Reader.WS();
4662 thesession->ClearContext();
4663 XSDRAW::SetTransferProcess (thesession->MapReader());
4664 progress->NewScope ( 80, "Translation" );
4666 thesession->MapReader()->SetProgress ( progress );
4668 if (modepri == 1) Reader.SetReadVisible (Standard_True);
4669 Reader.TransferRoots();
4671 thesession->MapReader()->SetProgress ( 0 );
4672 progress->EndScope();
4674 // result in only one shape for all the roots
4675 // or in one shape for one root.
4676 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
4677 Standard_Integer answer = 1;
4678 if (Reader.NbShapes() > 1) {
4679 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;
4684 answer = Draw::Atoi(str_a);
4686 if ( answer == 0) continue;
4687 if ( answer == 1 || answer == 3) {
4688 TopoDS_Shape shape = Reader.OneShape();
4690 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4692 Sprintf(fname, "%s", rnom.ToCString());
4693 di << "Saving shape in variable Draw : " << fname << "\n";
4694 if (answer == 3) IGESToBRep::WriteShape (shape,1);
4697 DBRep::Set(fname,shape);
4699 catch(Standard_Failure) {
4700 di << "** Exception : ";
4701 di << Standard_Failure::Caught()->GetMessageString();
4702 di<<" ** Skip"<<"\n";
4703 di << "Saving shape in variable Draw : " << fname << "\n";
4704 IGESToBRep::WriteShape (shape,1);
4708 else if (answer == 2 || answer == 4) {
4709 Standard_Integer numshape = Reader.NbShapes();
4710 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
4711 // save all the shapes
4712 TopoDS_Shape shape = Reader.Shape(inum);
4713 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4715 Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
4716 di << "Saving shape in variable Draw : " << fname << "\n";
4717 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
4720 DBRep::Set(fname,shape);
4722 catch(Standard_Failure) {
4723 di << "** Exception : ";
4724 di << Standard_Failure::Caught()->GetMessageString();
4725 di<<" ** Skip"<<"\n";
4732 else if (modepri == 3) { // One Entity
4733 cout << "Only One Entity"<<endl;
4734 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
4735 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
4736 cout << " give the number of the Entity : " << flush;
4737 nent = XSDRAW::GetEntityNumber();
4739 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4741 nbs = Reader.NbShapes();
4742 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
4743 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4744 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4745 TopoDS_Shape sh = Reader.Shape(nbs);
4746 DBRep::Set (shname,sh);
4750 else if (modepri == 4) { // Selection
4751 Standard_Integer answer = 1;
4752 Handle(TColStd_HSequenceOfTransient) list;
4754 // Selection, nommee ou via tcl. tcl : raccourcis admis
4755 // * donne iges-visible + xst-transferrable-roots
4756 // *r donne xst-model-roots (TOUTES racines)
4758 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
4759 di << "All Geometry Transfer"<<"\n";
4760 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4761 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4762 Handle(XSControl_WorkSession) thesession = Reader.WS();
4763 thesession->ClearContext();
4764 XSDRAW::SetTransferProcess (thesession->MapReader());
4765 progress->NewScope ( 80, "Translation" );
4767 thesession->MapReader()->SetProgress ( progress );
4769 Reader.SetReadVisible (Standard_True);
4770 Reader.TransferRoots();
4772 thesession->MapReader()->SetProgress ( 0 );
4773 progress->EndScope();
4776 // result in only one shape for all the roots
4777 TopoDS_Shape shape = Reader.OneShape();
4780 Sprintf(fname, "%s", rnom.ToCString());
4781 di << "Saving shape in variable Draw : " << fname << "\n";
4784 DBRep::Set(fname,shape);
4786 catch(Standard_Failure) {
4787 di << "** Exception : ";
4788 di << Standard_Failure::Caught()->GetMessageString();
4789 di<<" ** Skip"<<"\n";
4790 di << "Saving shape in variable Draw : " << fname << "\n";
4791 IGESToBRep::WriteShape (shape,1);
4797 modepri = 0; // d office, une seule passe
4798 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
4800 list = XSDRAW::GetList ("xst-model-roots");
4803 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
4804 di<<"List given by "<<compart.ToCString()<<" : ";
4805 list = XSDRAW::GetList (compart.ToCString());
4807 if (list.IsNull()) {
4808 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
4813 cout<<"Name of Selection :"<<flush;
4814 list = XSDRAW::GetList();
4815 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
4818 Standard_Integer nbl = list->Length();
4819 di<<"Nb entities selected : "<<nbl<<"\n";
4820 if (nbl == 0) continue;
4823 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
4826 char str_answer[80];
4828 answer = Draw::Atoi(str_answer);
4830 if (answer <= 0 || answer > 3) continue;
4832 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
4833 Handle(Standard_Transient) ent = list->Value(ill);
4834 di<<" ";// model->Print(ent,di);
4838 if (answer == 1 || answer == 2) {
4839 Standard_Integer nbt = 0;
4840 Handle(XSControl_WorkSession) thesession = Reader.WS();
4842 XSDRAW::SetTransferProcess (thesession->MapReader());
4843 progress->NewScope ( 80, "Translation" );
4845 thesession->MapReader()->SetProgress ( progress );
4847 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
4848 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
4850 nent = Reader.Model()->Number(list->Value(ill));
4851 if (nent == 0) continue;
4852 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4854 nbs = Reader.NbShapes();
4855 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
4856 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4857 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4858 TopoDS_Shape sh = Reader.Shape(nbs);
4859 DBRep::Set (shname,sh);
4863 thesession->MapReader()->SetProgress ( 0 );
4864 progress->EndScope();
4866 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
4867 answer = 0; // on ne reboucle pas
4871 else di<<"Unknown mode n0 "<<modepri<<"\n";
4875 //In order to clear memory after IGES reading you could add the following code
4876 Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
4877 Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
4880 Reader.WS()->Model()->Clear();
4881 Standard_Integer i =1;
4883 Reader.WS()->ClearData(i);
4889 #include <Geom_Plane.hxx>
4890 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4894 di << "Usage : " << argv[0] << " plane a b c d\n";
4898 Standard_Real A = Draw::Atof(argv[2]);
4899 Standard_Real B = Draw::Atof(argv[3]);
4900 Standard_Real C = Draw::Atof(argv[4]);
4901 Standard_Real D = Draw::Atof(argv[5]);
4903 Handle(Geom_Geometry) result;
4905 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4908 DrawTrSurf::Set(argv[1],result);
4912 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4916 di << "Usage : " << argv[0] << " MaxNbr" << "\n";
4919 Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
4921 for (Standard_Integer i=0;i<aMaxNbr;i++)
4923 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4925 TopoDS_Wire wireShape( w.Wire());
4926 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4927 TopoDS_Face f( faceBuilder.Face());
4928 BRepMesh_IncrementalMesh im(f,1);
4929 BRepTools::Clean(f);
4934 #include <Graphic3d_Vector.hxx>
4935 Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4939 di << "Wrong number of arguments" << "\n";
4942 Standard_Real X1_Pnt = Draw::Atof(argv[1]);
4943 Standard_Real Y1_Pnt = Draw::Atof(argv[2]);
4944 Standard_Real Z1_Pnt = Draw::Atof(argv[3]);
4945 Standard_Real X2_Pnt = Draw::Atof(argv[4]);
4946 Standard_Real Y2_Pnt = Draw::Atof(argv[5]);
4947 Standard_Real Z2_Pnt = Draw::Atof(argv[6]);
4949 Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
4950 Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
4952 di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
4959 #include <IntCurvesFace_ShapeIntersector.hxx>
4960 #include <gp_Lin.hxx>
4961 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4965 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
4969 TopoDS_Shape shape = DBRep::Get(argv[1]);
4971 if (shape.IsNull()) {
4972 di<<" Null shape is not allowed";
4976 Standard_Real X_Pnt = Draw::Atof(argv[2]);
4977 Standard_Real Y_Pnt = Draw::Atof(argv[3]);
4978 Standard_Real Z_Pnt = Draw::Atof(argv[4]);
4980 Standard_Real X_Dir = Draw::Atof(argv[5]);
4981 Standard_Real Y_Dir = Draw::Atof(argv[6]);
4982 Standard_Real Z_Dir = Draw::Atof(argv[7]);
4984 Standard_Real PInf = Draw::Atof(argv[8]);
4986 IntCurvesFace_ShapeIntersector intersector;
4987 intersector.Load(shape, Precision::Intersection());
4989 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
4990 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
4991 gp_Lin ray(origin, dir);
4993 Standard_Real PSup = RealLast();
4994 intersector.PerformNearest(ray, PInf, PSup);
4995 if (intersector.NbPnt() != 0)
4997 di << argv[0] << " status = 0 \n";
4998 Standard_Real w = intersector.WParameter(1);
4999 di << "w = " << w << "\n";
5001 di << argv[0] << " status = -1 \n";
5006 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5009 di << "Usage : " << argv[0] << "\n";
5013 // Create mask 1111: extent == 4
5014 TColStd_PackedMapOfInteger aFullMask;
5015 for (Standard_Integer i = 0; i < 4; i++)
5018 // Create mask 1100: extent == 2
5019 TColStd_PackedMapOfInteger aPartMask;
5020 for (Standard_Integer i = 0; i < 2; i++)
5023 di << "aFullMask = 1111" << "\n";
5024 di << "aPartMask = 1100" << "\n";
5026 Standard_Boolean isAffected;
5028 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
5029 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5030 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
5031 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5032 isAffected = aFullMask.Subtract(aPartMask); // false (?)
5033 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5037 #include <ShapeFix_FixSmallFace.hxx>
5038 Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5042 di << "Usage : " << argv[0] << " shape resshape\n";
5046 // try to read a shape:
5047 TopoDS_Shape aShape=DBRep::Get(argv[1]);
5048 ShapeFix_FixSmallFace aFixSmallFaces;
5049 aFixSmallFaces.Init (aShape);
5050 aFixSmallFaces.Perform();
5051 TopoDS_Shape aResShape = aFixSmallFaces.Shape();
5052 DBRep::Set(argv[2],aResShape);
5058 #include <NCollection_DataMap.hxx>
5059 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5063 di << "Usage : " << argv[0] << "\n";
5067 TCollection_ExtendedString anExtString;
5069 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
5070 anExtString.Insert(1, aNonAsciiChar);
5072 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
5073 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
5074 aMap.Bind(anExtString, 0);
5080 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5083 di << "Wrong number of arguments" << argv[0] << "\n";
5087 Standard_Real X_vec = Draw::Atof(argv[1]);
5088 Standard_Real Y_vec = Draw::Atof(argv[2]);
5089 Standard_Real Z_vec = Draw::Atof(argv[3]);
5091 Standard_Real X_dir = Draw::Atof(argv[4]);
5092 Standard_Real Y_dir = Draw::Atof(argv[5]);
5093 Standard_Real Z_dir = Draw::Atof(argv[6]);
5095 Standard_Real X_pnt = Draw::Atof(argv[7]);
5096 Standard_Real Y_pnt = Draw::Atof(argv[8]);
5097 Standard_Real Z_pnt = Draw::Atof(argv[9]);
5099 gp_Dir toSym(X_vec, Y_vec, Z_vec);
5100 gp_Dir dir(X_dir, Y_dir, Z_dir);
5101 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
5102 gp_Ax2 symObj(loc,dir);
5103 toSym.Mirror(symObj);
5105 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
5110 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5114 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
5118 Standard_Real X_mirrorFirstPoint = Draw::Atof(argv[1]);
5119 Standard_Real Y_mirrorFirstPoint = Draw::Atof(argv[2]);
5120 Standard_Real X_mirrorSecondPoint = Draw::Atof(argv[3]);
5121 Standard_Real Y_mirrorSecondPoint = Draw::Atof(argv[4]);
5122 Standard_Real X_p1 = Draw::Atof(argv[5]);
5123 Standard_Real Y_p1 = Draw::Atof(argv[6]);
5124 Standard_Real X_p2 = Draw::Atof(argv[7]);
5125 Standard_Real Y_p2 = Draw::Atof(argv[8]);
5127 gp_Trsf2d identityTransformation;
5129 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
5130 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
5131 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
5133 gp_Pnt2d p1(X_p1,Y_p1);
5134 gp_Pnt2d p2(X_p2,Y_p2);
5137 M1.SetMirror(mirrorAxis);
5139 M2.SetMirror(mirrorAxis);
5141 Tcomp = M2.Multiplied(M1);
5143 Standard_Real aTol = Precision::Confusion();
5144 Standard_Integer aStatus = 0;
5146 //After applying two times the same mirror the point is located on the same location OK
5147 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
5148 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
5150 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
5153 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
5154 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
5156 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
5159 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
5160 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
5161 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
5163 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
5166 di << "Status = " << aStatus << "\n";
5170 Standard_Integer OCC23429(Draw_Interpretor& /*di*/,
5171 Standard_Integer narg, const char** a)
5173 if (narg < 4) return 1;
5175 TopoDS_Shape aShape = DBRep::Get(a[2]);
5176 if (aShape.IsNull()) return 1;
5178 BRepFeat_SplitShape Spls(aShape);
5179 Spls.SetCheckInterior(Standard_False);
5181 TopoDS_Shape aTool = DBRep::Get(a[3]);
5183 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
5184 Builder.ComputePCurveOn1(Standard_True);
5186 Builder.Approximation(Standard_True);
5188 TopoDS_Shape aSection = Builder.Shape();
5190 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
5191 for (; ExpSec.More(); ExpSec.Next())
5193 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
5194 Handle(Geom2d_Curve) thePCurve;
5195 Handle(Geom_Surface) theSurface;
5196 TopLoc_Location theLoc;
5197 Standard_Real fpar, lpar;
5198 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
5200 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
5201 for (; ExpShape.More(); ExpShape.Next())
5203 aFace = TopoDS::Face(ExpShape.Current());
5204 TopLoc_Location aLoc;
5205 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
5206 if (aSurface == theSurface && aLoc == theLoc)
5209 Spls.Add(anEdge, aFace);
5212 TopoDS_Shape Result = Spls.Shape();
5213 DBRep::Set(a[1], Result);
5218 #include <ExprIntrp_GenExp.hxx>
5219 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5223 di << "Usage : " << argv[0] << " string\n";
5227 Standard_CString aString = argv[1];
5228 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
5231 myExpr->Process( aString );
5233 catch(Standard_Failure) {
5234 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
5235 di << "Exception : " << aFail->GetMessageString() << "\n";
5241 #include <Quantity_NameOfColor.hxx>
5242 #include <TopAbs_ShapeEnum.hxx>
5243 Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5245 // Check the command arguments
5248 di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
5249 di << "Usage : " << argv[0] << " mode(0/1)\n";
5250 return 1; //TCL_ERROR
5253 const Standard_Integer aMode = Draw::Atoi(argv[1]);
5255 //===================================================================
5257 Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
5258 if (aisContext.IsNull())
5260 di <<"Error: call 'vinit' first"<< "\n";
5261 return 1; //TCL_ERROR
5264 if (aisContext->HasOpenedContext())
5266 aisContext->CloseAllContexts();
5267 aisContext->RemoveAll(false);
5268 aisContext->EraseSelected(false);
5270 aisContext->EraseAll(false);
5271 Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
5272 Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
5274 trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
5275 trihedron->SetSize(20);
5276 trihedron->SetColor(Quantity_NOC_GRAY30);
5277 trihedron->SetArrowColor(Quantity_NOC_GRAY30);
5278 trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
5280 //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5281 //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5282 //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
5285 aisContext->Display(trihedron, true);
5286 aisContext->OpenLocalContext();
5287 //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
5288 aisContext->ActivateStandardMode(TopAbs_EDGE);
5289 aisContext->SetSensitivity(8);
5294 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
5295 const char *group = "QABugs";
5297 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
5299 // Remove as bad version of QAAddOrRemoveSelected from QADraw
5300 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
5302 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
5303 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
5304 theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
5306 //====================================================
5308 // Following commands are inserted from
5309 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
5310 // ( 75455 Apr 16 18:59)
5312 //====================================================
5314 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
5315 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
5317 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
5319 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
5320 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
5321 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
5322 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
5323 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
5324 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
5327 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
5328 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
5329 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
5331 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
5332 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
5333 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
5335 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
5336 theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
5338 theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
5340 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
5342 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
5343 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
5344 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
5345 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
5346 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
5347 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
5348 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
5349 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
5350 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
5351 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
5352 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
5353 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
5354 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
5355 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
5356 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5357 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5358 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5359 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5361 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5362 theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
5363 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5364 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5365 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5366 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5368 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5369 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
5371 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5372 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5373 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5374 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5375 theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
5376 theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
5377 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5378 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5379 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5380 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5381 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5382 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5383 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5384 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5385 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5386 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5387 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5388 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5389 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5390 theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
5391 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5392 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5393 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5394 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5395 theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
5396 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5397 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5398 theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
5399 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);
5400 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5401 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5402 theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);