1 // Created on: 2002-03-20
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
26 #include <Draw_Interpretor.hxx>
28 #include <DrawTrSurf.hxx>
29 #include <AIS_InteractiveContext.hxx>
30 #include <ViewerTest.hxx>
31 #include <AIS_Shape.hxx>
32 #include <TopoDS_Shape.hxx>
34 #include <Geom_Axis2Placement.hxx>
36 #include <gp_Trsf.hxx>
37 #include <AIS_Trihedron.hxx>
38 #include <BRepPrimAPI_MakeBox.hxx>
39 #include <Graphic3d_MaterialAspect.hxx>
40 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
41 #include <TopoDS_Solid.hxx>
42 #include <BRepPrimAPI_MakeSphere.hxx>
43 #include <BRepPrimAPI_MakeCone.hxx>
44 #include <BRepPrimAPI_MakeCylinder.hxx>
45 #include <IGESToBRep_Reader.hxx>
46 #include <TopExp_Explorer.hxx>
48 #include <GCPnts_UniformDeflection.hxx>
49 #include <BRepAdaptor_Curve.hxx>
50 #include <IGESToBRep.hxx>
51 #include <V3d_Viewer.hxx>
52 #include <BRepAdaptor_CompCurve.hxx>
53 #include <GCPnts_AbscissaPoint.hxx>
54 #include <Standard_ErrorHandler.hxx>
55 #include <Standard_Overflow.hxx>
56 #include <Standard_Underflow.hxx>
57 #include <Standard_DivideByZero.hxx>
58 #include <OSD_SIGSEGV.hxx>
59 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
60 #include <OSD_Exception_STACK_OVERFLOW.hxx>
62 #include <STEPCAFControl_Writer.hxx>
63 #include <STEPControl_StepModelType.hxx>
64 #include <Interface_Static.hxx>
65 #include <IFSelect_ReturnStatus.hxx>
66 #include <Standard_Failure.hxx>
67 #include <TColgp_HArray1OfPnt2d.hxx>
68 #include <Geom2dAPI_Interpolate.hxx>
69 #include <Geom2d_BSplineCurve.hxx>
70 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
71 #include <Geom2d_BezierCurve.hxx>
72 #include <BRep_Tool.hxx>
73 #include <GeomProjLib.hxx>
74 #include <Geom2dAPI_InterCurveCurve.hxx>
75 #include <IntRes2d_IntersectionSegment.hxx>
76 #include <TDataStd_RealArray.hxx>
77 #include <TDF_CopyLabel.hxx>
78 #include <NCollection_Vector.hxx>
79 #include <TColStd_Array1OfInteger.hxx>
80 #include <Geom_BSplineCurve.hxx>
81 #include <TColgp_Array1OfPnt.hxx>
82 #include <AIS_ListOfInteractive.hxx>
83 #include <AIS_ListIteratorOfListOfInteractive.hxx>
84 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
85 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
86 #include <BRepBuilderAPI_MakePolygon.hxx>
87 #include <gp_GTrsf.hxx>
88 #include <Poly_Triangulation.hxx>
89 #include <IGESControl_Reader.hxx>
90 #include <IGESData_IGESModel.hxx>
91 #include <IGESData_IGESEntity.hxx>
92 #include <V3d_View.hxx>
93 #include <BRepFeat_SplitShape.hxx>
94 #include <BRepAlgoAPI_Section.hxx>
99 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
101 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
104 static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
106 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
107 if(myAISContext.IsNull()) {
108 di << "use 'vinit' command before " << argv[0] ;
112 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
115 trsf1.SetTranslation(gp_Vec(100, 100, 0));
116 aTrihedronAxis->Transform(trsf1);
117 Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
118 myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
119 myTrihedron->SetSize(100);
120 myAISContext->Display(myTrihedron, Standard_True);
122 // TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
123 TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
124 Handle(AIS_Shape) AS = new AIS_Shape(shape1);
125 AS->SetDisplayMode(1);
126 Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
127 AS->SetMaterial(mat);
128 AS->SetColor(Quantity_NOC_RED);
129 myAISContext->Display(AS);
132 TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
134 myAISContext->ResetLocation(AS);
135 myAISContext->SetLocation(AS , TouchTrsf) ;
136 myAISContext->Redisplay(AS, Standard_True);
141 // Remove as bad version of QAAddOrRemoveSelected from QADraw
142 //static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
145 // di<<"Usage : " << argv[0] << " shape islocal\n";
149 // Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
151 // // ViewerTest_DoubleMapOfInteractiveAndName& aMap =
152 // // ViewerTest::GetDataMapOfAIS ();
153 // ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
155 // TCollection_AsciiString aName(argv[1]);
156 // Handle(AIS_InteractiveObject) AISObj;
158 // if(aMap.IsBound2(aName)) {
159 // AISObj = aMap.Find2(aName);
160 // if(AISObj.IsNull()){
161 // di<<"No interactive object \n";
165 // Standard_Integer aNum = -1;
167 // if(atoi(argv[2])) {
168 // aNum = anAISCtx->OpenLocalContext();
171 // if(anAISCtx->HasOpenedContext()){
172 // anAISCtx->InitSelected();
173 // anAISCtx->AddOrRemoveSelected(AISObj);
176 // anAISCtx->InitCurrent();
177 // anAISCtx->AddOrRemoveCurrentObject(AISObj);
181 // // anAISCtx->CloseLocalContext(aNum);
186 // //select this shape:
188 // di<<"Use 'vdisplay' before";
193 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
196 di<<"Usage: OCC136\n";
200 //create some primitives:
202 Standard_Real Size=100;
203 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
205 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
207 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
209 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
210 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
212 anAx2.SetLocation(gp_Pnt(Size,0,0));
213 anAx2.SetDirection(gp_Dir(-1,-1,1));
214 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
216 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
217 if(anAISCtx.IsNull()){
218 di<<"Null interactive context. Use 'vinit' at first.\n";
222 if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
223 anAISCtx->EraseAll();
225 //load primitives to context
226 Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
227 anAISCtx->Display(aSh1);
229 Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
230 anAISCtx->Display(aSh2);
232 Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
233 anAISCtx->Display(aSh3);
235 Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
236 anAISCtx->Display(aSh4);
239 anAISCtx->InitCurrent();
240 anAISCtx->AddOrRemoveCurrentObject(aSh1);
241 anAISCtx->AddOrRemoveCurrentObject(aSh2);
242 anAISCtx->AddOrRemoveCurrentObject(aSh3);
243 anAISCtx->AddOrRemoveCurrentObject(aSh4);
245 //remove all this objects from context
246 anAISCtx->Clear(aSh1, Standard_False);
247 anAISCtx->Clear(aSh2, Standard_False);
248 anAISCtx->Clear(aSh3, Standard_False);
249 anAISCtx->Clear(aSh4, Standard_False);
253 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
255 printf("Usage: %s iges_input [name]\n",argv[0]);
258 Standard_Character *Ch;
261 Ch = new Standard_Character[strlen(argv[2])+3];
263 IGESToBRep_Reader IR;
264 IR.LoadFile (argv[1]);
267 TopoDS_Shape aTopShape = IR.OneShape();
268 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
269 Standard_Integer i=0;
270 for( ; ex.More(); ex.Next()){
271 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
272 BRepAdaptor_Curve aCurve(E);
273 GCPnts_UniformDeflection plin(aCurve, 0.1);
274 di << "Num points = " << plin.NbPoints() << "\n";
277 sprintf(Ch,"%s_%i",argv[2],1);
284 static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
288 di << "Usage : " << a[0] << " file.igs" << "\n";
292 Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
294 if(myContext.IsNull()) {
295 di << "use 'vinit' command before " << a[0] << "\n";
300 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
301 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
303 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
306 Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
307 sprintf(file1,"%s/%s",DD,a[1]);
309 IGESToBRep_Reader reader;
310 Standard_Integer status = reader.LoadFile(file1);
313 reader.TransferRoots();
314 TopoDS_Shape shape = reader.OneShape();
316 Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
318 Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
320 if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
321 importedShape->SetDisplayMode(AIS_WireFrame);
322 else importedShape->SetDisplayMode(AIS_Shaded);
323 myContext->Display(importedShape);
326 printf("\n End of my IGES to 3D-viewer *****************>\n");
331 //====================================================
333 // Following code is inserted from
334 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
335 // ( 75455 Apr 16 18:59)
337 //====================================================
340 #include <BRepTools_WireExplorer.hxx>
341 #include <BRep_Tool.hxx>
342 #include <GCPnts_UniformAbscissa.hxx>
343 #include <TopExp.hxx>
346 // usage : OCC105 shape
349 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
351 //Value Pnt = -338.556216693211 -394.465571897208 0
353 //Value Pnt = -307.47165394 -340.18073533 0
355 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
358 di<<"Usage : OCC105 shape\n";
361 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
362 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
363 Standard_Real l = 0.5; //atof(argv[2]);
364 // Find the first vertex of the wire
365 BRepTools_WireExplorer wire_exp(myTopoDSWire);
368 TopoDS_Vertex vw1, vw2;
369 TopExp::Vertices(myTopoDSWire,vw1,vw2);
370 TopoDS_Vertex ve1, ve2;
371 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
372 TopExp::Vertices(edge,ve1,ve2);
373 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
376 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
380 for ( ; wire_exp.More(); wire_exp.Next())
382 di << "\n\n New Edge \n" << "\n";
383 Standard_Real newufirst, newulast;
384 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
385 Standard_Real ufirst, ulast;
386 Handle(Geom_Curve) acurve;
387 TopoDS_Vertex ve1, ve2;
388 TopExp::Vertices(edge,ve1,ve2);
389 if (ve1.IsSame(vlast))
391 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
398 // assert(ve2.IsSame(vlast));
399 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
400 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
401 newufirst = acurve->ReversedParameter( ufirst );
402 newulast = acurve->ReversedParameter( ulast );
403 acurve = acurve->Reversed( );
407 GeomAdaptor_Curve curve;
408 GCPnts_UniformAbscissa algo;
410 algo.Initialize( curve, l, newufirst, newulast );
412 di << "Not Done!!!" << "\n";
413 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
414 Standard_Real t = algo.Parameter(Index);
415 gp_Pnt pt3 = curve.Value(t);
416 di << "Parameter t = " << t << "\n";
417 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
424 #include <TColStd_SequenceOfTransient.hxx>
425 #include <GeomFill_Pipe.hxx>
426 static int pipe_OCC9 (Draw_Interpretor& di,
427 Standard_Integer n, const char ** a)
430 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
434 TColStd_SequenceOfTransient aCurveSeq;
436 for (i=2 ; i<=4; i++) {
437 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
439 di << a[i] << " is not a curve" << "\n";
442 aCurveSeq.Append(aC);
445 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
446 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
447 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
451 aPipe.Perform(atof (a[6]), Standard_True);
453 aPipe.Perform(Standard_True/*, Standard_True*/);
456 Handle(Geom_Surface) aSurf = aPipe.Surface();
458 DrawTrSurf::Set(a[1], aSurf);
462 //======================================================================
464 // usage : OCC125 shell
465 //======================================================================
466 #include <ShapeFix_Shell.hxx>
468 Standard_Integer OCC125(Draw_Interpretor& di ,
473 di<<" Use OCC125 shell";
477 TopoDS_Shape S = DBRep::Get(a[1]);
480 di<<" Null shape is not allowed";
486 if (aT!=TopAbs_SHELL) {
487 di<<" Shape Type must be SHELL";
491 const TopoDS_Shell& aShell = TopoDS::Shell(S);
493 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
495 isAccountMultiConex=Standard_True;
496 bNonManifold=Standard_False;
498 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
499 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
501 di<<"bResult="<<(Standard_Integer)bResult;
504 aShape=aFix->Shape();
506 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
509 DBRep::Set (aRName.ToCString(), aShape);
510 di<<aRName.ToCString();
515 #include <BRepLib_FindSurface.hxx>
516 #include <BRepBuilderAPI_MakeFace.hxx>
517 Standard_Integer OCC157(Draw_Interpretor& di,
520 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
523 di << "bad number of arguments" <<"\n";
527 // try to read a shape:
528 TopoDS_Shape inputShape=DBRep::Get(a[2]);
529 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
530 di << "Invalid input shape"<< "\n";
533 Standard_Real toler = atof(a[3]);
534 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
535 BRepLib_FindSurface FS(aWire, toler, Standard_True);
537 di<<"OCC157: OK; Planar surface is found"<<"\n";
538 Handle(Geom_Surface) aSurf = FS.Surface();
539 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
540 if(aMakeFace.IsDone()) {
541 TopoDS_Face aFace = aMakeFace.Face();
542 DBRep::Set(a[1],aFace);
545 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
550 // #include <MyCommandsCMD.h>
551 #include <ShapeFix_Shape.hxx>
552 #include <BRepOffset_MakeOffset.hxx>
553 #include <BRepOffsetAPI_MakeOffset.hxx>
554 #include <BRepOffset_Mode.hxx>
555 #include <GeomAbs_JoinType.hxx>
556 #include <AIS_Shape.hxx>
558 #include <BRepTools.hxx>
560 Standard_Integer OCC165(Draw_Interpretor& di ,
565 //=======================================================================
567 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
569 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
571 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
574 //=======================================================================
576 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
580 di <<"Usage : " << a[0] << " [file]"<<"\n";
585 #define _OFFSET_TELCO_
586 #ifdef _OFFSET_TELCO_
588 Standard_CString file = a[1];
590 BRep_Builder aBuilder;
591 TopoDS_Shape theShape;
592 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
593 BRepTools::Read(theShape, file, aBuilder);
594 DBRep::Set("shape", theShape);
596 TopoDS_Wire theWire = TopoDS::Wire(theShape);
598 Standard_Real anOffset = 1.5;
602 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
603 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
604 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
606 BRepBuilderAPI_MakePolygon theSquare;
607 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
609 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
611 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
613 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
617 TopoDS_Wire theWire = theSquare.Wire();
619 Standard_Real anOffset = 10;
622 #endif /* _OFFSET_TELCO_ */
625 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
626 DBRep::Set("face", theFace);
629 Standard_Real anAlt = 0.;
630 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
631 //GeomAbs_Intersection; //GeomAbs_Arc;
632 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
633 aMakeOffset.AddWire(theWire);
635 aMakeOffset.Perform(anOffset, anAlt);
637 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
638 DBRep::Set("offset", theOffsetShapePos);
643 #include<BRepAlgoAPI_Cut.hxx>
644 #include<BRepAlgo_Cut.hxx>
646 #include<BRepPrimAPI_MakeHalfSpace.hxx>
647 #include<Handle_Geom_CartesianPoint.hxx>
648 #include<Geom_CartesianPoint.hxx>
649 #include<AIS_Point.hxx>
651 #include <BRepBuilderAPI_MakeEdge.hxx>
652 #include <BRepBuilderAPI_MakeWire.hxx>
653 #include <BRepBuilderAPI_MakeFace.hxx>
655 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
659 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
660 if(myAISContext.IsNull()) {
661 di << "use 'vinit' command before " << argv[0] << "\n";
666 gp_Pnt pt1_(250.,250.,0.);
667 gp_Pnt pt2_(-250.,250.,0.);
668 gp_Pnt pt3_(-250.,-250.,0.);
669 gp_Pnt pt4_(250.,-250.,0.);
670 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
671 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
672 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
673 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
675 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
676 BRepBuilderAPI_MakeFace face_(wire_);
677 TopoDS_Face sh_ = face_.Face();
683 g_pnt = gp_Pnt(0,0,-100);
685 g_pnt = gp_Pnt(0,0,100);
687 myAISContext->EraseAll(Standard_False);
688 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
689 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
690 myAISContext->Display(AISPoint);
692 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
693 TopoDS_Solid sol1_ = half_.Solid();
694 // Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
695 // AISHalf->SetColor(Quantity_NOC_GREEN);
696 // myAISContext->Display(AISHalf);
698 DBRep::Set("Face",sol1_);
700 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
702 Standard_Real x=0., y=0., z=-80.;
704 BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
705 // Handle(AIS_Shape) AISBox = new AIS_Shape(box);
706 // AISBox->SetColor(Quantity_NOC_BLUE1);
707 // myAISContext->Display(AISBox);
709 DBRep::Set("Box",box.Shape());
711 // BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
712 // //BRepAlgoAPI_Cut cut( box.Shape(), sol1_ );
713 // TopoDS_Shape sh1_ = cut.Shape();
714 // Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
715 // AISCut->SetColor(Quantity_NOC_RED);
716 // myAISContext->Display(AISCut);
718 // DBRep::Set("Cut",sh1_);
723 #include<GProp_GProps.hxx>
724 #include<BRepGProp.hxx>
726 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
731 di <<"Usage : " << argv[0] << " file"<<"\n";
734 Standard_CString file = argv[1];
736 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
737 if(myAISContext.IsNull()) {
738 di << "use 'vinit' command before " << argv[0] << "\n";
743 BRep_Builder builder;
744 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
745 BRepTools::Read(sh, file, builder);
748 builder.MakeWire(wire);
750 TopoDS_Vertex vt1, vt2;
751 TopExp_Explorer wex(sh, TopAbs_EDGE);
752 for(;wex.More();wex.Next())
754 ed = TopoDS::Edge(wex.Current());
755 TopExp::Vertices(ed, vt1, vt2);
756 builder.UpdateVertex(vt1, 0.01);
757 builder.UpdateVertex(vt2, 0.01);
758 builder.UpdateEdge(ed, 0.01);
759 builder.Add(wire, ed);
763 BRepGProp::LinearProperties(ed, lprop);
764 printf("\n length = %f", lprop.Mass());
766 DBRep::Set("Wire",wire);
767 // Handle(AIS_Shape) res = new AIS_Shape( wire );
768 // aContext->SetColor( res, Quantity_NOC_RED );
769 // aContext->Display( res );
771 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
772 // off.Perform(0.5, 0);
774 // printf("\n IsDone = %d", off.IsDone());
776 // res = new AIS_Shape( sh );
777 // aContext->SetColor( res, Quantity_NOC_GREEN );
778 // aContext->Display( res );
784 static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
787 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
788 if(myAISContext.IsNull()) {
789 di << "use 'vinit' command before " << argv[0];
793 BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
794 Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
795 myAISContext->Display(anAISBox, 1);
796 anAISBox->SetSelectionMode(-1);
797 Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
798 myAISContext->CloseLocalContext(myLocContInd);
799 Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
806 #include <TDocStd_Document.hxx>
807 #include <DDocStd.hxx>
808 #include <PCDM_StoreStatus.hxx>
809 #include <TDocStd_Application.hxx>
811 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
814 di << "Usage: " << a[0] << " Doc" << "\n";
818 Handle(TDocStd_Document) D;
819 if (!DDocStd::GetDocument(a[1],D)) return 1;
821 Handle(TDocStd_Application) A;
822 if (!DDocStd::Find(A)) return 1;
824 TCollection_ExtendedString theStatusMessage;
826 di << "this document has never been saved" << "\n";
829 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
830 if (theStatus != PCDM_SS_OK ) {
831 switch ( theStatus ) {
832 case PCDM_SS_DriverFailure: {
833 di << " Could not store , no driver found to make it " <<"\n" ;
836 case PCDM_SS_WriteFailure: {
837 di << " Write access failure " << "\n" ;
840 case PCDM_SS_Failure: {
841 di << " Write failure " << "\n" ;
849 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
852 di << "Usage: " << a[0] << " Doc Path" << "\n";
856 Handle(TDocStd_Document) D;
857 if (!DDocStd::GetDocument(a[1],D)) return 1;
859 TCollection_ExtendedString path (a[2]);
860 Handle(TDocStd_Application) A;
861 if (!DDocStd::Find(A)) return 1;
863 TCollection_ExtendedString theStatusMessage;
864 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
865 if (theStatus != PCDM_SS_OK ) {
866 switch ( theStatus ) {
867 case PCDM_SS_DriverFailure: {
868 di << " Could not store , no driver found to make it " <<"\n" ;
871 case PCDM_SS_WriteFailure: {
872 di << " Write access failure " << "\n" ;
875 case PCDM_SS_Failure: {
876 di << " Write failure " << "\n" ;
885 #include <BRepClass3d_SolidClassifier.hxx>
887 Standard_Integer OCC299bug (Draw_Interpretor& di,
894 di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
898 TopoDS_Shape aS = DBRep::Get(a[1]);
900 sprintf(sbf, " Null Shape is not allowed here\n");
905 if (aS.ShapeType()!=TopAbs_SOLID) {
906 sprintf(sbf, " Shape type must be SOLID\n");
911 Standard_Real aTol=1.e-7;
912 TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
913 TopAbs_State aState = TopAbs_UNKNOWN;
914 gp_Pnt aP(8., 9., 10.);
916 if (!DrawTrSurf::GetPoint(a[2], aP) ) {
917 sprintf(sbf, " Null Point is not allowed here\n");
927 BRepClass3d_SolidClassifier aSC(aS);
928 aSC.Perform(aP,aTol);
930 aState = aSC.State();
932 sprintf(sbf, "The point is "); di<<sbf;
936 sprintf(sbf, sIN.ToCString());
939 sprintf(sbf, sOUT.ToCString());
942 sprintf(sbf, sON.ToCString());
945 sprintf(sbf, sUNKNOWN.ToCString());
948 sprintf(sbf, sUNKNOWN.ToCString());
953 sprintf(sbf, " shape\n");
959 #include <OSD_Process.hxx>
960 #include <OSD_Path.hxx>
962 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
965 di << "Usage: " << a[0] << "\n";
969 OSD_Path d = p.CurrentDirectory();
970 TCollection_AsciiString s;
972 di << "*" << s.ToCString() << "*" << "\n";
975 di << "*" << s.ToCString() << "*" <<"\n";
979 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
982 di << "Usage: " << a[0] << "\n";
985 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
986 di << p.Trek().ToCString() << "\n";
988 di << p.Trek().ToCString() << "\n";
992 #include <BRepAlgoAPI_Fuse.hxx>
993 #include <BRepAlgoAPI_Common.hxx>
994 #include <BRepAlgo_Fuse.hxx>
995 #include <BRepAlgo_Common.hxx>
997 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
1000 // cout << "Usage: " << a[0] << endl;
1003 if(nb < 1 || nb > 2) {
1004 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1007 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1009 Standard_Integer IsB = atoi(a[1]);
1011 IsBRepAlgoAPI = Standard_False;
1015 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
1016 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
1018 TopoDS_Shape shape1 = box1.Shape();
1019 TopoDS_Shape shape2 = box2.Shape();
1021 //#if ! defined(BRepAlgoAPI_def01)
1022 // TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1023 // TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
1025 // TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
1026 // TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
1028 TopoDS_Shape fuse,comm;
1029 if (IsBRepAlgoAPI) {
1030 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
1031 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
1032 fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
1033 comm = BRepAlgoAPI_Common( shape1, shape2 );
1035 di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
1036 fuse = BRepAlgo_Fuse( shape1, shape2 );
1037 di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
1038 comm = BRepAlgo_Common( shape1, shape2 );
1044 #include <ShapeAnalysis_Edge.hxx>
1046 static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
1050 di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
1053 TopoDS_Shape Sh1 = DBRep::Get(a[1]);
1054 TopoDS_Shape Sh2 = DBRep::Get(a[2]);
1055 if(Sh1.IsNull() || Sh2.IsNull()) {
1057 di<<"Invalid arguments"<<"\n";
1060 TopoDS_Edge e1 = TopoDS::Edge(Sh1);
1061 TopoDS_Edge e2 = TopoDS::Edge(Sh2);
1062 if(e1.IsNull() || e2.IsNull()) {
1064 di<<"Invalid type of arguments"<<"\n";
1067 Standard_Real aTol = Precision::Confusion();
1068 Standard_Real aDistDomain = 0.0;
1069 Standard_Integer k = 3;
1071 aTol = atof(a[k++]);
1073 aDistDomain = atof(a[k++]);
1075 ShapeAnalysis_Edge sae;
1076 if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
1077 if(aDistDomain ==0.0) {
1079 di<<"Edges is overlaping comletly"<<"\n";
1082 di<<"Edges is overlaped"<<"\n";
1083 di<<"with tolerance = "<<aTol<<"\n";
1084 di<<"on segment length = "<<aDistDomain<<"\n";
1088 di<<"Edges is not overlaped"<<"\n";
1094 #include <DDocStd_DrawDocument.hxx>
1095 #include <TDataStd_Name.hxx>
1097 #include <XCAFDoc_ShapeTool.hxx>
1098 #include <XCAFDoc_DocumentTool.hxx>
1099 #include <TDF_LabelSequence.hxx>
1100 #include <TPrsStd_AISPresentation.hxx>
1101 #include <TDF_Data.hxx>
1102 #include <TDF_Label.hxx>
1103 #include <XCAFPrs_Driver.hxx>
1105 //------------------------------------------------------------------------------------------
1108 //------------------------------------------------------------------------------------------
1109 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1114 // 1. Verufy amount of arguments
1115 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
1117 // 2. Retrieve DDocStd application
1118 Handle(TDocStd_Application) App;
1119 if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
1122 TCollection_ExtendedString name(argv[2]);
1123 Handle(TDocStd_Document) Doc;
1124 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
1125 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
1126 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
1127 Draw::Set(argv[1],DD);
1129 // 4. Create prsentations
1130 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1131 TDF_LabelSequence seq;
1132 shapes->GetFreeShapes ( seq );
1133 Handle(TPrsStd_AISPresentation) prs;
1134 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
1135 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
1136 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
1138 catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
1140 di << "OCC363 OK\n";
1145 ////======================================================================================
1146 //// Function : OCC372
1148 ////======================================================================================
1149 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1153 // OCC_CATCH_SIGNALS
1154 // // 1. Verufy amount of arguments
1155 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
1159 // TopoDS_Shape Ref;
1160 // BRepTools::Read(Ref, argv[1], B);
1162 // // 3. Calculate location of aP3d in relation to the solid
1163 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
1164 // BRepClass3d_SolidClassifier SC(Ref);
1165 // SC.Perform(aP3d, 1e-7);
1167 // // 4. Check returned state. The point must be inside the solid.
1168 // TopAbs_State aState=SC.State();
1172 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
1175 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
1178 // di<<"OCC372 OK. aState = TopAbs_IN" ;
1181 // di<<"OCC372 FAULTY. aState = UNKNOWN";
1185 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
1190 #include <BRepTopAdaptor_FClass2d.hxx>
1192 //======================================================================================
1193 // Function : OCC377
1195 //======================================================================================
1196 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1201 // 1. Verify validity of arguments
1202 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
1204 // 2. Initialize parameters
1206 p2d.SetX ( atof(argv[2]) );
1207 p2d.SetY ( atof(argv[3]) );
1208 Standard_Real precuv = atof (argv[4] );
1213 BRepTools::Read ( Shape, argv[1], B );
1215 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1216 TopExp_Explorer exp;
1217 Standard_Integer i=1;
1218 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1220 // 4.1. Verify whether enrtry point is on wire
1221 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1222 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1224 TopAbs_Orientation orWire = wir.Orientation();
1225 newFace.Orientation(TopAbs_FORWARD);
1228 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1229 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1230 //di << "Wire " << i << ": Infinite point is " <<
1231 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1233 TCollection_AsciiString TmpString;
1234 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1235 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1237 stat1 = FClass2d1.Perform(p2d);
1238 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1239 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1242 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1243 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1245 // 4.2. Verify whether enrtry point is on reversed wire
1246 newFace = TopoDS::Face(Shape.EmptyCopied());
1247 newFace.Orientation(TopAbs_FORWARD);
1248 orWire = TopAbs::Reverse(orWire);
1249 B.Add(newFace,wir.Oriented(orWire));
1250 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1251 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1252 //di << "Reversed Wire " << i << ": Infinite point is " <<
1253 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1256 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1257 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1259 stat2 = FClass2d2.Perform(p2d);
1260 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1261 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1264 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1265 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1267 // 4.3. Compare results (they must be same)
1268 if(stat1 ==stat2) di << "OCC377 OK" << "\n";
1269 else {di << "OCC377 FAULTY" << "\n"; return 0;}
1272 catch(Standard_Failure)
1274 di << "OCC377 Exception";
1280 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1281 #include <ShapeBuild_ReShape.hxx>
1283 //=======================================================================
1286 //=======================================================================
1287 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1292 // 1. Verify arguments of the command
1293 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1295 Standard_Boolean aConsiderLocation;
1296 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1297 else aConsiderLocation = Standard_True;
1299 // 2. Iniitialize aShapeUpgrade
1300 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1302 aShapeUpgrade.SetPrecision (Precision::Confusion());
1304 aShapeUpgrade.SetMaxTolerance(0.1);
1305 // subshapes to be divided
1306 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1307 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1308 aShapeUpgrade.Init(aSubShapesToBeDivided);
1310 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1311 aShapeUpgrade.SetContext(aReshape);
1312 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1314 // 3. Perform splitting
1315 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1316 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1317 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1319 // 4. Perform rebuilding shape
1320 // 4.1. Retrieve Shape
1321 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1322 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1323 // 4.2 Rebuid retrieved shape
1324 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1325 // 4.3. Create result Draw shape
1326 DBRep::Set(argv[1], aResultShape);
1328 catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
1334 #include <ShapeProcess_OperLibrary.hxx>
1335 #include <ShapeProcess_ShapeContext.hxx>
1336 #include <ShapeProcess.hxx>
1338 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1339 #include <BRepMesh_IncrementalMesh.hxx>
1341 //=======================================================================
1344 //=======================================================================
1345 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1350 // 1. Verify amount of arguments of the command
1351 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1353 // 2. Retrieve parameters
1355 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1356 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1357 // compound of subshapes
1358 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1359 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1360 // name of resource file
1361 const char* aResourceFile = argv[4];
1362 // name of sequence from resource file to be executed
1363 const char* aSequenceName = argv[5];
1365 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1366 ShapeProcess_OperLibrary::Init();
1367 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1368 aShapeContext->SetDetalisation (TopAbs_EDGE);
1369 ShapeProcess::Perform (aShapeContext, aSequenceName);
1371 // 4. Rebuild initil shape in accordance with performed operation
1372 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1373 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1374 for (; anIter.More(); anIter.Next())
1375 aReshape->Replace(anIter.Key(), anIter.Value());
1376 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1378 // 5 Create resultant Draw shape
1379 DBRep::Set(argv[1], aResultShape);
1382 catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
1387 //=======================================================================
1389 //purpose : Verify whether exception occurs during building mesh
1390 //=======================================================================
1391 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1396 // 1. Verify amount of arguments of the command
1397 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1399 // 2. Retrieve shape
1400 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1401 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1404 BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
1407 catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
1409 di << "OCC369 OK \n";
1413 #include <math_Vector.hxx>
1414 #include <math_Matrix.hxx>
1415 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1418 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1421 Standard_Integer LowerVector = atoi(argv[1]);
1422 Standard_Integer UpperVector = atoi(argv[2]);
1423 Standard_Real InitialValueVector = atof(argv[3]);
1424 Standard_Integer LowerRowMatrix = atoi(argv[4]);
1425 Standard_Integer UpperRowMatrix = atoi(argv[5]);
1426 Standard_Integer LowerColMatrix = atoi(argv[6]);
1427 Standard_Integer UpperColMatrix = atoi(argv[7]);
1428 Standard_Real InitialValueMatrix = atof(argv[8]);
1430 math_Vector Vector1(LowerVector, UpperVector);
1431 math_Vector Vector2(LowerVector, UpperVector);
1433 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1434 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1436 //Vector.Dump(cout);
1439 //Matrix.Dump(cout);
1442 Vector1.Multiply(Vector, Matrix);
1444 //Vector1.Dump(cout);
1445 Standard_SStream aSStream1;
1446 Vector1.Dump(aSStream1);
1450 Vector2.TMultiply(Vector, Matrix);
1452 //Vector2.Dump(cout);
1453 Standard_SStream aSStream2;
1454 Vector2.Dump(aSStream2);
1461 #include <GeomPlate_BuildPlateSurface.hxx>
1462 //=======================================================================
1465 //=======================================================================
1466 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1471 GeomPlate_BuildPlateSurface aBuilder;
1474 catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
1475 //catch (...) { di << "OCC525 Exception \n" ;return 0; }
1477 di << "OCC525 OK \n";
1481 #include <Viewer2dTest.hxx>
1482 #include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx>
1484 #include <AIS2D_InteractiveContext.hxx>
1485 #include <V2d_View.hxx>
1486 #include <AIS2D_InteractiveObject.hxx>
1487 #include <TColStd_HSequenceOfInteger.hxx>
1490 extern Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
1492 Standard_EXPORT Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
1495 //=======================================================================
1498 //=======================================================================
1499 static Standard_Integer OCC543 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1501 Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
1502 if(aContext.IsNull()) {
1503 di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
1507 di<<"Usage : " << argv[0] << " name\n";
1510 Handle(V2d_View) V = Viewer2dTest::CurrentView();
1512 TCollection_AsciiString name = argv[1];
1514 if (!GetMapOfAIS2D().IsBound2(name)) {
1515 // di << "There is not an object with name " << name.ToCString() << "\n";
1519 Handle(AIS2D_InteractiveObject) aShape = GetMapOfAIS2D().Find2(name);
1520 Standard_Integer PickedIndex = aShape->PickedIndex();
1521 di << "PickedIndex = " << PickedIndex << "\n";
1525 #include <BRepPrimAPI_MakeWedge.hxx>
1526 #include <gce_MakeRotation.hxx>
1527 #include <gce_MakeTranslation.hxx>
1528 #include <BRepBuilderAPI_Transform.hxx>
1529 #include <BRepPrimAPI_MakeWedge.hxx>
1530 #include <BRepAlgoAPI_Fuse.hxx>
1531 #include <BRepAlgoAPI_Cut.hxx>
1532 #include <BRepAlgo_Fuse.hxx>
1533 #include <BRepAlgo_Cut.hxx>
1534 //=======================================================================
1537 //=======================================================================
1538 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1541 // di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
1544 if(argc < 4 || argc > 5) {
1545 di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1548 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1550 Standard_Integer IsB = atoi(argv[4]);
1552 IsBRepAlgoAPI = Standard_False;
1553 // di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1555 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
1561 double xperiod = 1.0;
1562 double yperiod = 1.0;
1563 double sub_thick = 0.5;
1566 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1567 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1569 // --------------------------------------------------------------------
1572 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1573 // 0.1, 0.1 , 0.4, 0.4 );
1574 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1575 0.1, 0.1 , 0.4, 0.4 ).Shape();
1577 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1578 gp_Dir(1.0,0.0,0.0),
1581 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1582 gp_Pnt( 0.25, 0.25, 0.5)
1585 rotate.PreMultiply( translate );
1587 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1589 if (wedge1a.IsNull()) {
1590 di<<" Null shape1 is not allowed\n";
1593 DBRep::Set(argv[1], wedge1a);
1595 // --------------------------------------------------------------------
1598 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1599 // 0.1, 0.1 , 0.4, 0.4 );
1600 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1601 0.1, 0.1 , 0.4, 0.4 ).Shape();
1603 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1604 gp_Dir(1.0,0.0,0.0),
1607 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1608 gp_Pnt( 0.25, 0.25, 0.5)
1611 rotate2.PreMultiply( translate2 );
1613 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1615 if (wedge2a.IsNull()) {
1616 di<<" Null shape2 is not allowed\n";
1619 DBRep::Set(argv[2], wedge2a);
1623 //#if ! defined(BRepAlgoAPI_def01)
1624 // TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1626 // TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1628 TopoDS_Shape wedge_common;
1629 if (IsBRepAlgoAPI) {
1630 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
1631 wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
1633 di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
1634 wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
1637 // remove wedge area from substrate
1638 //#if ! defined(BRepAlgoAPI_def01)
1639 // TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1641 // TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1643 TopoDS_Shape sub_etch1;
1644 if (IsBRepAlgoAPI) {
1645 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
1646 sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
1648 di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
1649 sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
1652 if (sub_etch1.IsNull()) {
1653 di<<" Null shape3 is not allowed\n";
1656 DBRep::Set(argv[3], sub_etch1);
1661 #include <Graphic2d_DisplayList.hxx>
1662 #include <Graphic2d_View.hxx>
1664 //=======================================================================
1667 //=======================================================================
1668 static Standard_Integer OCC627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1670 Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
1671 if(aContext.IsNull()) {
1672 di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
1676 di<<"Usage : " << argv[0] << "\n";
1680 Handle(V2d_View) V = Viewer2dTest::CurrentView();
1681 Handle(Graphic2d_View) View = V->View();
1682 Handle(Graphic2d_DisplayList) DisplayList = View->DisplayList();
1683 Standard_Integer Length = DisplayList->Length();
1684 di << "Length = " << Length << "\n";
1689 #include <Standard_GUID.hxx>
1690 //=======================================================================
1693 //=======================================================================
1694 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1697 di<<"Usage : " << argv[0] << " GUID\n";
1700 Standard_GUID guid(argv[1]);
1701 //guid.ShallowDump(cout);
1702 Standard_SStream aSStream;
1703 guid.ShallowDump(aSStream);
1709 #include <XCAFDoc.hxx>
1710 //=======================================================================
1711 //function : OCC738_ShapeRef
1713 //=======================================================================
1714 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1717 di<<"Usage : " << argv[0] << "\n";
1720 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1721 //guid.ShallowDump(cout);
1722 Standard_SStream aSStream;
1723 guid.ShallowDump(aSStream);
1728 //=======================================================================
1729 //function : OCC738_Assembly
1731 //=======================================================================
1732 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1735 di<<"Usage : " << argv[0] << "\n";
1738 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1739 //guid.ShallowDump(cout);
1740 Standard_SStream aSStream;
1741 guid.ShallowDump(aSStream);
1746 #if defined(DDataStd_def01)
1747 #include <DDataStd_DrawPresentation.hxx>
1748 //=======================================================================
1749 //function : OCC739_DrawPresentation
1751 //=======================================================================
1752 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1755 di<<"Usage : " << argv[0] << "\n";
1758 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1759 //guid.ShallowDump(cout);
1760 Standard_SStream aSStream;
1761 guid.ShallowDump(aSStream);
1767 //=======================================================================
1770 //=======================================================================
1771 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1773 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1774 if(aContext.IsNull()) {
1775 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
1780 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
1784 Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
1786 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1788 TCollection_AsciiString aName(argv[1]);
1789 Handle(AIS_InteractiveObject) AISObj;
1791 if(!aMap.IsBound2(aName)) {
1792 di << "Use 'vdisplay' before" << "\n";
1795 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
1796 if(AISObj.IsNull()){
1797 di << argv[1] << " : No interactive object" << "\n";
1800 AISObj->UnsetTransformation();
1801 if (!aContext->HasOpenedContext()) {
1802 aContext->OpenLocalContext();
1804 aContext->Erase(AISObj, updateviewer, PutInCollector);
1805 aContext->UpdateCurrentViewer();
1806 aContext->Display(AISObj, updateviewer);
1807 aContext->UpdateCurrentViewer();
1812 //=======================================================================
1815 //=======================================================================
1816 #include <TColStd_Array2OfInteger.hxx>
1817 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1820 di<<"Usage : " << argv[0] << "\n";
1823 TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
1824 Array2OfInteger.SetValue(5,5,55);
1828 #include <GeomAPI_ProjectPointOnSurf.hxx>
1829 //=======================================================================
1832 //=======================================================================
1833 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1837 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1842 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1843 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1844 Standard_Real Umin=atof(argv[3]);
1845 Standard_Real Usup=atof(argv[4]);
1846 Standard_Real Vmin=atof(argv[5]);
1847 Standard_Real Vsup=atof(argv[6]);
1849 if (aSurface.IsNull()) {
1850 di << argv[2] << " Null surface \n" ;
1854 GeomAPI_ProjectPointOnSurf PonSurf;
1855 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1856 PonSurf.Perform(aPoint3d);
1861 //=======================================================================
1864 //=======================================================================
1865 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1869 di<<"Usage : " << argv[0] << " wire face\n";
1873 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1874 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1875 if (awire.IsNull() || aface.IsNull()) {
1876 di << "Null object" << "\n";
1880 Standard_Integer count = 0;
1881 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1883 BRepTools_WireExplorer WE;
1884 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1885 TopoDS_Edge E = WE.Current();
1889 di << "Count = " << count << "\n";
1894 //=======================================================================
1897 //=======================================================================
1898 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1902 di <<"Usage : " << argv[0] << " face"<<"\n";
1905 Standard_Real u1, u2, v1, v2;
1906 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1909 BRepTools::UVBounds(F, u1, u2, v1, v2);
1910 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1914 #include <Expr_NamedUnknown.hxx>
1915 #include <Expr_GeneralExpression.hxx>
1916 #include <Expr_Exponential.hxx>
1917 //=======================================================================
1920 //=======================================================================
1921 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1925 di <<"Usage : " << argv[0] << " expression"<<"\n";
1929 TCollection_AsciiString myStr(argv[1]);
1931 Handle (Expr_NamedUnknown) myNamed = new Expr_NamedUnknown(myStr);
1932 Handle (Expr_Exponential) oldExpr = new Expr_Exponential(myNamed);
1933 Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
1936 TCollection_AsciiString res = newExpr->String();
1937 Standard_CString resStr = res.ToCString();
1938 TCollection_AsciiString res_old = oldExpr->String();
1939 Standard_CString res_oldStr = res_old.ToCString();
1942 di << "X = " << argv[1] << "\n";
1943 di << "Y = " << res_oldStr << "\n";
1944 di << "Y' = " << resStr << "\n";
1950 #include <TPrsStd_AISViewer.hxx>
1951 #include <TDF_Label.hxx>
1952 #include <TPrsStd_AISPresentation.hxx>
1953 //=======================================================================
1954 //function : OCC1029_AISTransparency
1955 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1956 //=======================================================================
1958 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1959 Standard_Integer nb,
1963 Handle(TDocStd_Document) D;
1964 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1966 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1968 Handle(TPrsStd_AISViewer) viewer;
1969 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1971 Handle(TPrsStd_AISPresentation) prs;
1972 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1974 prs->SetTransparency(atof(arg[3]));
1975 TPrsStd_AISViewer::Update(L);
1978 di << "Transparency = " << prs->Transparency() << "\n";
1983 di << arg[0] << " : Error" << "\n";
1987 //=======================================================================
1988 //function : OCC1030_AISColor
1989 //purpose : OCC1030_AISColor (DOC,entry,[color])
1990 //=======================================================================
1992 static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
1993 Standard_Integer nb,
1997 Handle(TDocStd_Document) D;
1998 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2000 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2002 Handle(TPrsStd_AISViewer) viewer;
2003 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2005 Handle(TPrsStd_AISPresentation) prs;
2006 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2008 prs->SetColor((Quantity_NameOfColor)atoi(arg[3]));
2009 TPrsStd_AISViewer::Update(L);
2012 di << "Color = " << prs->Color() << "\n";
2016 di << arg[0] << " : Error" << "\n";
2020 //=======================================================================
2021 //function : OCC1031_AISMaterial
2022 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
2023 //=======================================================================
2025 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
2026 Standard_Integer nb,
2030 Handle(TDocStd_Document) D;
2031 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2033 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2035 Handle(TPrsStd_AISViewer) viewer;
2036 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2038 Handle(TPrsStd_AISPresentation) prs;
2039 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2041 prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3]));
2042 TPrsStd_AISViewer::Update(L);
2045 di << "Material = " << prs->Material() << "\n";
2050 di << arg[0] << " : Error" << "\n";
2054 //=======================================================================
2055 //function : OCC1032_AISWidth
2056 //purpose : OCC1032_AISWidth (DOC,entry,[width])
2057 //=======================================================================
2059 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
2060 Standard_Integer nb,
2064 Handle(TDocStd_Document) D;
2065 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2067 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2069 Handle(TPrsStd_AISViewer) viewer;
2070 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2072 Handle(TPrsStd_AISPresentation) prs;
2073 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2075 prs->SetWidth(atof(arg[3]));
2076 TPrsStd_AISViewer::Update(L);
2079 di << "Width = " << prs->Width() << "\n";
2084 di << arg[0] << " : Error" << "\n";
2088 //=======================================================================
2089 //function : OCC1033_AISMode
2090 //purpose : OCC1033_AISMode (DOC,entry,[mode])
2091 //=======================================================================
2093 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
2094 Standard_Integer nb,
2098 Handle(TDocStd_Document) D;
2099 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2101 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2103 Handle(TPrsStd_AISViewer) viewer;
2104 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2106 Handle(TPrsStd_AISPresentation) prs;
2107 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2109 prs->SetMode(atoi(arg[3]));
2110 TPrsStd_AISViewer::Update(L);
2113 di << "Mode = " << prs->Mode() << "\n";
2118 di << arg[0] << " : Error" << "\n";
2122 //=======================================================================
2123 //function : OCC1034_AISSelectionMode
2124 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
2125 //=======================================================================
2127 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
2128 Standard_Integer nb,
2132 Handle(TDocStd_Document) D;
2133 if (!DDocStd::GetDocument(arg[1],D)) return 1;
2135 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
2137 Handle(TPrsStd_AISViewer) viewer;
2138 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
2140 Handle(TPrsStd_AISPresentation) prs;
2141 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2143 prs->SetSelectionMode(atoi(arg[3]));
2144 TPrsStd_AISViewer::Update(L);
2147 di << "SelectionMode = " << prs->SelectionMode() << "\n";
2152 di << arg[0] << " : Error" << "\n";
2156 #include<BRepAlgoAPI_Cut.hxx>
2157 #include<BRepAlgo_Cut.hxx>
2158 //=======================================================================
2159 //function : OCC1487
2161 //=======================================================================
2162 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2165 // cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
2168 if(argc < 5 || argc > 6) {
2169 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
2172 Standard_Boolean IsBRepAlgoAPI = Standard_True;
2174 Standard_Integer IsB = atoi(argv[5]);
2176 IsBRepAlgoAPI = Standard_False;
2177 // di << "Error: There is not BRepAlgo_Cut class" << "\n";
2182 Standard_Integer CaseNumber = atoi(argv[1]);
2184 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
2185 gp_Dir myDir(1,0,0);
2186 gp_Pnt myPnt(0,-50,140);
2187 gp_Ax2 myAx2(myPnt, myDir);
2188 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
2190 TopoDS_Shape cyl1 = o_mc1.Shape();
2193 TopoDS_Shape o_cut_shape;
2194 if (CaseNumber == 1) {
2195 //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);
2196 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
2197 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
2198 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2199 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2201 cyl2 = o_mc2.Shape();
2202 //#if ! defined(BRepAlgoAPI_def01)
2203 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2205 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2207 if (IsBRepAlgoAPI) {
2208 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2209 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2211 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2212 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2215 //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);
2216 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
2217 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
2218 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
2219 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
2221 cyl2 = o_mc2.Shape();
2222 //#if ! defined(BRepAlgoAPI_def01)
2223 // o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2225 // o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2227 if (IsBRepAlgoAPI) {
2228 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2229 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
2231 di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
2232 o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
2236 DBRep::Set(argv[2],cyl1);
2237 DBRep::Set(argv[3],cyl2);
2238 DBRep::Set(argv[4],o_cut_shape);
2243 #include<TopTools_ListIteratorOfListOfShape.hxx>
2244 #include<BRepFilletAPI_MakeFillet.hxx>
2245 //=======================================================================
2246 //function : OCC1077
2248 //=======================================================================
2249 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
2251 Standard_Real t3d = 1.e-4;
2252 Standard_Real t2d = 1.e-5;
2253 Standard_Real ta = 1.e-2;
2254 Standard_Real fl = 1.e-3;
2255 Standard_Real tapp_angle = 1.e-2;
2256 GeomAbs_Shape blend_cont = GeomAbs_C1;
2258 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
2261 // Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
2263 TopTools_ListIteratorOfListOfShape its;
2265 TopoDS_Compound result;
2267 B.MakeCompound(result);
2270 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
2272 const TopoDS_Shape& cutsol = ex.Current();
2274 BRepFilletAPI_MakeFillet fill(cutsol);
2275 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
2276 fill.SetContinuity(blend_cont, tapp_angle);
2278 // its = build->Section();
2280 its = aBoolenaOperation.SectionEdges();
2284 TopoDS_Edge E = TopoDS::Edge(its.Value());
2285 fill.Add(aRadius, E);
2292 B.Add(result, fill.Shape());
2296 B.Add(result, cutsol);
2302 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
2304 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
2305 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
2306 return OCC1077_boolbl(aCut,aRadius);
2309 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
2311 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
2314 TopoDS_Shape OCC1077_Bug()
2316 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
2317 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
2319 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
2320 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
2321 gp_Dir(0, 0, 1)), 3, 20).Shape();
2322 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
2323 gp_Dir(1, 0, 0)), 3, 20).Shape();
2324 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
2325 gp_Dir(0, 1, 0)), 3, 20).Shape();
2326 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
2327 Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
2329 theTmp1 = fixer->Shape();
2330 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
2331 fixer->Init(theTmp2);
2333 theTmp2 = fixer->Shape();
2334 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
2335 fixer->Init(theResult);
2337 theResult = fixer->Shape();
2341 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2343 if(argc < 1 || argc > 2) {
2344 di << "Usage : " << argv[0] << " result" << "\n";
2348 TopoDS_Shape S = OCC1077_Bug();
2349 DBRep::Set(argv[1],S);
2354 //////////////////////////////////////////////////////////////
2356 * Compute uniform distribution of points using GCPnts_UniformAbscissa
2358 //////////////////////////////////////////////////////////////
2359 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2363 di << "Usage : " << argv[0] << " name shape step" << "\n";
2366 const char *name = argv[1];
2367 Adaptor3d_Curve *adapCurve=NULL;
2368 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
2369 if (!curve.IsNull())
2370 adapCurve = new GeomAdaptor_Curve(curve);
2373 TopoDS_Shape wire = DBRep::Get(argv[2]);
2374 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2376 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
2379 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2381 double step = atof(argv[3]);
2382 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2386 di << argv[0] <<" : fail"<<"\n";
2391 int i, np = aUni.NbPoints();
2392 for (i=0; i < np; i++)
2394 double par = aUni.Parameter(i+1);
2395 gp_Pnt p = adapCurve->Value(par);
2396 char n[20], *pname=n;
2397 sprintf(n,"%s_%d",name,i+1);
2398 DrawTrSurf::Set(pname,p);
2407 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2411 di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
2415 Standard_Integer nb = atoi(argv[1]);
2416 Standard_Integer sz = atoi(argv[2]);
2417 Standard_Real val = 10;
2418 math_Vector **pv = new math_Vector *[nb];
2420 di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
2422 for (i=0; i < nb; i++) {
2423 pv[i] = new math_Vector (1, sz, val);
2424 if ((i % (nb/10)) == 0) {
2431 di<<"deleting them ..."<<"\n";
2432 for (i=0; i < nb; i++) {
2434 if ((i % (nb/10)) == 0) {
2447 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2451 di << "Usage : " << argv[0] << " wire" << "\n";
2454 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2457 TopoDS_Wire wire = TopoDS::Wire(shape);
2458 // create curve parameterised by curvilinear distance
2459 BRepAdaptor_CompCurve curve(wire,Standard_True);
2460 Standard_Real length = curve.LastParameter();
2461 Standard_Real need_length = length/2;
2463 curve.D0(need_length,pnt);
2464 // create check_curve parameterised in a general way
2465 BRepAdaptor_CompCurve check_curve(wire);
2466 Standard_Real check_par =
2467 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2469 check_curve.D0(check_par,check_pnt);
2470 // check that points are coinsiding
2471 Standard_Real error_dist = pnt.Distance(check_pnt);
2472 if (error_dist > Precision::Confusion()) {
2473 //cout.precision(3);
2474 di<<"error_dist = "<<error_dist<<
2475 " ( "<<error_dist/need_length*100<<" %)"<<"\n";
2482 static char sarr[2000];
2484 static int StackOverflow(int i = -1)
2489 memcpy(arr,sarr,2000);
2491 int n = strlen(arr), s=0;
2493 s += StackOverflow(i-1);
2494 return i + s + StackOverflow(i-1);
2497 return i + StackOverflow(i-1);
2504 // this code does not work with optimize mode on Windows
2505 #pragma optimize( "", off )
2507 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2511 di << "Usage : " << argv[0] << "\n";
2514 Standard_Boolean Succes;
2516 Succes = Standard_True;
2519 {//==== Test Divide ByZero (Integer) ========================================
2522 di << "(Integer) Divide By Zero...";
2525 Standard_Integer res, a =4, b = 0 ;
2527 di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n";
2528 Succes = Standard_False;
2530 #if defined(SOLARIS) || defined(WNT)
2531 catch(Standard_DivideByZero)
2533 catch(Standard_NumericError)
2538 catch(Standard_Failure) {
2539 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2541 di << Standard_Failure::Caught()->GetMessageString();
2542 di << ")... KO" << "\n";
2543 Succes = Standard_False;
2545 #ifndef NO_CXX_EXCEPTION
2546 // this case tests if (...) supersedes (Standard_*),
2547 // the normal behaviour is not
2549 di<<" unknown exception... (But) Ok"<<"\n";
2554 {//==== Test Divide ByZero (Real) ===========================================
2557 di << "(Real) Divide By Zero...";
2560 Standard_Real res, a= 4.0, b=0.0;
2562 di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n";
2563 Succes = Standard_False;
2565 #if defined(SOLARIS) || defined(WNT)
2566 catch(Standard_DivideByZero)
2568 catch(Standard_NumericError)
2573 catch(Standard_Failure) {
2574 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2576 di << Standard_Failure::Caught()->GetMessageString();
2577 di << ")... KO" << "\n";
2578 Succes = Standard_False;
2582 {//==== Test Overflow (Integer) =============================================
2585 di << "(Integer) Overflow...";
2588 Standard_Integer res, i=IntegerLast();
2590 //++++ cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< endl;
2591 //++++ Succes = Standard_False;
2592 di << " "<<res<<"="<<i<<"+1 Does not Caught... (But) Ok"<< "\n";
2594 catch(Standard_Overflow) {
2597 catch(Standard_Failure) {
2598 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2600 di << Standard_Failure::Caught()->GetMessageString();
2601 di << ")... KO" << "\n";
2602 Succes = Standard_False;
2606 {//==== Test Overflow (Real) ================================================
2609 di << "(Real) Overflow...";
2612 Standard_Real res, r=RealLast();
2615 sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2617 di << "-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<< "\n";
2618 Succes = Standard_False;
2620 #if defined(SOLARIS) || defined(WNT)
2621 catch(Standard_Overflow)
2623 catch(Standard_NumericError)
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;
2637 {//==== Test Underflow (Real) ===============================================
2640 di << "(Real) Underflow";
2643 Standard_Real res, r=1.0e-308;
2646 //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<endl;
2647 //++++ Succes = Standard_False;
2648 di<<" -- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... (But) Ok"<<"\n";
2650 #if defined(SOLARIS) || defined(WNT)
2651 catch(Standard_Underflow)
2653 catch(Standard_NumericError)
2658 catch(Standard_Failure) {
2659 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2661 di << Standard_Failure::Caught()->GetMessageString();
2662 di << ")... KO" << "\n";
2663 Succes = Standard_False;
2667 {//==== Test Invalid Operation (Real) ===============================================
2670 di << "(Real) Invalid Operation...";
2673 Standard_Real res, r=-1;
2675 di<<" "<<res<<"=sqrt("<<r<<") Does not Caught... KO"<<"\n";
2676 Succes = Standard_False;
2678 catch(Standard_NumericError) {
2681 catch(Standard_Failure) {
2682 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2684 di << Standard_Failure::Caught()->GetMessageString();
2685 di << ")... KO" << "\n";
2686 Succes = Standard_False;
2690 {//==== Test Access Violation ===============================================
2693 di << "Segmentation Fault...";
2698 di << " Does not Caught... KO"<<"\n";
2699 Succes = Standard_False;
2702 catch(OSD_Exception_ACCESS_VIOLATION)
2708 } catch(Standard_Failure) {
2709 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2711 di << Standard_Failure::Caught()->GetMessageString();
2712 di << ")... KO" << "\n";
2713 Succes = Standard_False;
2718 {//==== Test Stack Overflow ===============================================
2721 di << "Stack Overflow...";
2725 di << " Does not Caught... KO"<<"\n";
2726 Succes = Standard_False;
2728 catch(OSD_Exception_STACK_OVERFLOW) {
2731 catch(Standard_Failure) {
2732 //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
2734 di << Standard_Failure::Caught()->GetMessageString();
2735 di << ")... KO" << "\n";
2736 Succes = Standard_False;
2742 di << "TestExcept: Successfull completion" << "\n";
2744 di << "TestExcept: failure" << "\n";
2750 #pragma optimize( "", on )
2753 static TopoDS_Compound AddTestStructure(int nCount_)
2759 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2760 for (int i=0; i<nCount; i++) {
2761 for (int j=0; j<nCount; j++) {
2763 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2764 TopLoc_Location topLoc(trsf);
2765 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2766 B.Add(C, tempShape);
2772 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2778 di << "Usage : " << argv[0] << " [nCount]" << "\n";
2783 nCount = atoi(argv[1]);
2784 STEPCAFControl_Writer writer;
2785 Handle_TDocStd_Document document;
2786 document = new TDocStd_Document("Pace Test-StepExporter-");
2787 Handle_XCAFDoc_ShapeTool shapeTool;
2788 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2789 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2790 STEPControl_StepModelType mode = STEPControl_AsIs;
2791 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2792 di << "Failed to set assembly mode for step data\n" << "\n";
2797 if( writer.Transfer(document, mode)) {
2798 IFSelect_ReturnStatus stat =
2799 writer.Write("TestExportStructure.step");
2802 catch(OSD_Exception_STACK_OVERFLOW) {
2803 di << "Failed : STACK OVERFLOW\n" << "\n";
2805 catch (Standard_Failure) {
2806 di << "Failed :\n" << "\n";
2807 //cout << Standard_Failure::Caught() << endl;
2808 di << Standard_Failure::Caught()->GetMessageString();
2810 di << argv[0] << " : Finish" << "\n";
2815 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2819 di << "Usage : " << argv[0] << "\n";
2823 // 1. Create an array of points
2824 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2825 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2826 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2827 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2828 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2829 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2831 // 2. Create a periodic bspline through these 5 points
2832 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2834 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2836 // 3. Increase degree of curve from 3 to 8
2837 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2838 Standard_CString CString1 = "BSplineCurve";
2839 DrawTrSurf::Set(CString1,bspline1);
2841 // 4. Convers BSpline curve to Bezier segments
2842 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2844 // 5. Test the result of conversion
2845 TCollection_AsciiString aRName;
2846 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2847 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2849 aRName=aRName+TCollection_AsciiString(i);
2850 Standard_CString aRNameStr = aRName.ToCString();
2851 DrawTrSurf::Set(aRNameStr,arc);
2852 di << aRNameStr << " ";
2858 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2862 di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
2865 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2866 if (theEdge1.IsNull()) {
2867 di << "Invalid input shape " << argv[1] << "\n";
2870 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2871 if (theEdge2.IsNull()) {
2872 di << "Invalid input shape " << argv[2] << "\n";
2875 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2876 if (theFace.IsNull()) {
2877 di << "Invalid input shape " << argv[3] << "\n";
2881 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2883 Standard_Real aConfusion = Precision::Confusion();
2884 Standard_Real aP1first, aP1last, aP2first, aP2last;
2886 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2887 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2888 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2889 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2891 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2893 Standard_Integer NbPoints = anInter.NbPoints();
2895 di << "NbPoints = " << NbPoints << "\n" ;
2899 for (i=1; i<=NbPoints; i++) {
2900 gp_Pnt2d aPi = anInter.Point(i);
2901 di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2905 Standard_Integer NbSegments = anInter.NbSegments();
2907 di << "\nNbSegments = " << NbSegments << "\n" ;
2909 if (NbSegments > 0) {
2910 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2912 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2913 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2915 Standard_Real aDist = aP1.Distance(aP2);
2917 di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
2918 di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
2920 di << "Distance = " << aDist << "\n" ;
2922 di << "Confusion = " << aConfusion << "\n" ;
2924 if (aDist > aConfusion) {
2925 di << "\n" << argv[0] << " Faulty" << "\n" ;
2927 di << "\n" << argv[0] << " OK" << "\n" ;
2930 di << "\n" << argv[0] << " OK" << "\n" ;
2935 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2939 di << "Usage : " << argv[0] << " lower upper" << "\n";
2943 Standard_Integer LOWER = atoi(argv[1]);
2944 Standard_Integer UPPER = atoi(argv[2]);
2946 //! 0. Create an empty document with several test labels
2947 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2948 doc->SetUndoLimit(100);
2949 TDF_Label main_label = doc->Main();
2950 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2951 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2953 //! 1. Set/Get OCAF attribute
2955 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2956 Handle(TDataStd_RealArray) array;
2957 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2958 array->Lower() == LOWER && array->Upper() == UPPER)
2959 cout<<"1: OK"<<endl;
2962 cout<<"1: Failed.."<<endl;
2965 doc->CommitCommand();
2967 //! 2. Set/Get value
2970 for (i = LOWER; i <= UPPER; i++)
2971 array->SetValue(i, i);
2972 for (i = LOWER; i <= UPPER; i++)
2974 if (array->Value(i) != i)
2976 cout<<"2: Failed.."<<endl;
2980 cout<<"2: OK"<<endl;
2981 doc->CommitCommand();
2983 //! 3. Re-init the array
2985 array->Init(LOWER + 2, UPPER + 4);
2986 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2988 cout<<"3: Failed.."<<endl;
2991 for (i = LOWER + 2; i <= UPPER + 4; i++)
2992 array->SetValue(i, i);
2993 for (i = LOWER + 2; i <= UPPER + 4; i++)
2995 if (array->Value(i) != i)
2997 cout<<"3: Failed.."<<endl;
3001 cout<<"3: OK"<<endl;
3002 doc->CommitCommand();
3006 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
3007 for (i = LOWER + 5; i <= UPPER + 5; i++)
3008 arr->SetValue(i, i);
3009 array->ChangeArray(arr);
3010 for (i = LOWER + 5; i <= UPPER + 5; i++)
3012 if (array->Value(i) != i)
3014 cout<<"4: Failed.."<<endl;
3018 cout<<"4: OK"<<endl;
3019 doc->CommitCommand();
3021 //! 5. Copy the array
3023 TDF_CopyLabel copier(label1, label2);
3025 if (!copier.IsDone())
3027 cout<<"5: Failed.."<<endl;
3030 Handle(TDataStd_RealArray) array2;
3031 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
3033 cout<<"5: Failed.."<<endl;
3036 for (i = LOWER + 5; i <= UPPER + 5; i++)
3038 if (array->Value(i) != i)
3040 cout<<"5: Failed.."<<endl;
3044 cout<<"5: OK"<<endl;
3045 doc->CommitCommand();
3048 //! 6.a: undoes the 5th action: the copied array should disappear
3050 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3051 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
3053 cout<<"6.a: Failed.."<<endl;
3056 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
3058 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3059 array->Lower() != LOWER + 2 ||
3060 array->Upper() != UPPER + 4)
3062 cout<<"6.b: Failed.."<<endl;
3065 for (i = LOWER + 2; i <= UPPER + 4; i++)
3067 if (array->Value(i) != i)
3069 cout<<"6.b: Failed.."<<endl;
3073 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
3075 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3076 array->Lower() != LOWER ||
3077 array->Upper() != UPPER)
3079 cout<<"6.c: Failed.."<<endl;
3082 for (i = LOWER; i <= UPPER; i++)
3084 if (array->Value(i) != i)
3086 cout<<"6.c: Failed.."<<endl;
3090 //! 6.d: undoes and redoes the 2nd action: no change is expected.
3093 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
3094 array->Lower() != LOWER ||
3095 array->Upper() != UPPER)
3097 cout<<"6.d: Failed.."<<endl;
3100 for (i = LOWER; i <= UPPER; i++)
3102 if (array->Value(i) != i)
3104 cout<<"6.d: Failed.."<<endl;
3108 cout<<"6: OK"<<endl;
3110 //! 7. Re-set the array
3112 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
3113 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
3115 cout<<"7: Failed.."<<endl;
3118 for (i = LOWER + 1; i <= UPPER + 1; i++)
3119 array->SetValue(i, i);
3120 for (i = LOWER + 1; i <= UPPER + 1; i++)
3122 if (array->Value(i) != i)
3124 cout<<"7: Failed.."<<endl;
3128 cout<<"7: OK"<<endl;
3129 doc->CommitCommand();
3131 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
3132 //! measure the time spent by this test.
3138 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3140 Standard_Boolean IsEvenArgc = Standard_True;
3141 if (argc % 2 == 0) {
3142 IsEvenArgc = Standard_True;
3144 IsEvenArgc = Standard_False;
3147 if (argc < 3 || IsEvenArgc)
3149 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
3153 Standard_Integer i, aValue, aPosition;
3154 NCollection_Vector<int> vec;
3155 for (i = 0; i < argc - 1; i++) {
3157 aValue = atoi(argv[i]);
3158 aPosition = atoi(argv[i+1]);
3159 vec.SetValue(aValue, aPosition);
3161 NCollection_Vector<int>::Iterator it(vec);
3163 for (j = 0; it.More(); it.Next(), j++) {
3164 //di << it.Value() << "\n";
3165 di << j << " " << it.Value() << "\n";
3171 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3174 di << "Usage : " << argv[0] << "\n";
3178 gp_Pnt point(0.0,0.0,0.0);
3180 TColgp_Array1OfPnt poles(0,6);
3183 point.SetCoord(1.0,1.0,0.0);
3186 point.SetCoord(2.0,1.0,0.0);
3189 point.SetCoord(3.0,0.0,0.0);
3192 point.SetCoord(4.0,1.0,0.0);
3195 point.SetCoord(5.0,1.0,0.0);
3198 point.SetCoord(6.0,0.0,0.0);
3201 TColStd_Array1OfReal knots(0,2);
3206 TColStd_Array1OfInteger multi(0,2);
3211 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
3214 Standard_Real l_abcissa,l_gprop;
3215 GeomAdaptor_Curve adaptor_spline(spline);
3216 GCPnts_AbscissaPoint temp;
3217 l_abcissa=temp.Length(adaptor_spline);
3218 cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
3221 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
3223 BRepGProp::LinearProperties(edge,prop);
3224 l_gprop=prop.Mass();
3225 cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
3227 cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
3232 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3236 di << "Usage : " << argv[0] << "\n";
3240 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3241 if(AISContext.IsNull())
3243 di << "use 'vinit' command before " << argv[0] << "\n";
3248 AIS_ListOfInteractive ListOfIO_1;
3249 AISContext->ObjectsInside(ListOfIO_1);
3250 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3251 if (!ListOfIO_1.IsEmpty() ) {
3252 AIS_ListIteratorOfListOfInteractive iter;
3253 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3254 Handle(AIS_InteractiveObject) aIO=iter.Value();
3255 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3259 // ObjectsInCollector
3260 AIS_ListOfInteractive ListOfIO_2;
3261 AISContext->ObjectsInCollector(ListOfIO_2);
3262 di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
3263 if (!ListOfIO_2.IsEmpty() ) {
3264 AIS_ListIteratorOfListOfInteractive iter;
3265 for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
3266 Handle(AIS_InteractiveObject) aIO=iter.Value();
3267 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3274 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3276 if ((argc < 9) || (((argc-3) % 3) != 0))
3278 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3281 Standard_Integer i, j, np = (argc-3) / 3;
3282 BRepBuilderAPI_MakePolygon W;
3284 for (i = 1; i <= np; i ++) {
3285 W.Add(gp_Pnt(atof(argv[j]),atof(argv[j+1]),atof(argv[j+2])));
3289 DBRep::Set(argv[1],W.Wire());
3290 DBRep::Set(argv[2],W.Edge());
3294 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3297 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3300 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3301 gp_Dir(1., -1., 0.));
3303 aTrf.SetAffinity (aPln, atof(argv[4]));
3304 gp_XYZ aOrigin (atof(argv[1]),atof(argv[2]),atof(argv[3]));
3305 gp_XYZ aResult (aOrigin);
3306 aTrf.Transforms(aResult);
3308 sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3309 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3310 aResult.X(), aResult.Y(), aResult.Z());
3315 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3318 di << "Usage : " << argv[0] << " shape [deflection]\n";
3322 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3324 if (aShape.IsNull()) {
3325 di<<" Null shape is not allowed";
3329 Standard_Real aDeflection = 0.45110277533;
3331 aDeflection = atof(argv[2]);
3333 di<<"deflection="<< aDeflection << "\n";
3335 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
3336 TopLoc_Location aLocation;
3337 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3339 if(aTriang.IsNull()) {
3340 di << argv[0] << " : Faulty\n" ;
3342 di << argv[0] << " : OK\n" ;
3343 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3344 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3349 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3352 di << "Usage : " << argv[0] << " A B C\n";
3357 gp_Lin2d aLin2d (atof(argv[1]),atof(argv[2]),atof(argv[3]));
3358 gp_Pnt2d anOrigin = aLin2d.Location();
3359 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3361 catch(Standard_ConstructionError)
3363 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3368 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3371 di << "Usage : " << argv[0] << " file shape\n";
3375 IGESControl_Reader aReader;
3376 aReader.ReadFile(argv[1]);
3377 aReader.SetReadVisible(Standard_True);
3378 aReader.TransferRoots();
3380 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3381 if (model.IsNull()) {
3382 di << "model.IsNull()\n";
3385 Standard_Integer nb = model->NbEntities();
3386 for (Standard_Integer i = 1; i <= nb; i ++) {
3387 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3388 Handle(TCollection_HAsciiString) name;
3389 name = ent->NameValue();
3390 Standard_CString aStr = name->ToCString();
3391 di << "NameValue = " << aStr << "\n";
3394 TopoDS_Shape shape = aReader.OneShape();
3395 DBRep::Set(argv[2],shape);
3399 // For OCC16782 testing
3400 #include <AppStd_Application.hxx>
3401 #include <TDF_Tool.hxx>
3402 #include <TColStd_HArray1OfInteger.hxx>
3404 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3405 #include <TColStd_ListIteratorOfListOfReal.hxx>
3406 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3407 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3408 #include <TDF_ListIteratorOfLabelList.hxx>
3410 #include <TDataStd_Tick.hxx>
3411 #include <TDataStd_IntegerList.hxx>
3412 #include <TDataStd_RealList.hxx>
3413 #include <TDataStd_ExtStringList.hxx>
3414 #include <TDataStd_BooleanList.hxx>
3415 #include <TDataStd_ReferenceList.hxx>
3416 #include <TDataStd_BooleanArray.hxx>
3417 #include <TDataStd_ReferenceArray.hxx>
3418 #include <TDataStd_ByteArray.hxx>
3419 #include <TDataStd_NamedData.hxx>
3420 #include <TDF_Reference.hxx>
3422 Handle(AppStd_Application) app;
3423 int TestSetGet(const Handle(TDocStd_Document)& doc)
3427 TDataStd_Tick::Set(doc->Main());
3429 Handle(TDataStd_Tick) tick;
3430 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3433 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3434 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3436 doc->Main().ResumeAttribute(tick);
3437 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3440 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3441 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3444 // TDataStd_IntegerList:
3446 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3447 setintlist->Append(2);
3448 setintlist->Prepend(1);
3449 setintlist->InsertAfter(3, 2);
3450 setintlist->InsertBefore(0, 1);
3451 setintlist->Append(200);
3452 setintlist->Remove(0);
3453 setintlist->Remove(200);
3455 Handle(TDataStd_IntegerList) getintlist;
3456 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3458 if (getintlist->First() != 1)
3460 if (getintlist->Last() != 3)
3462 const TColStd_ListOfInteger& intlist = getintlist->List();
3463 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3464 for (; itr_intlist.More(); itr_intlist.Next())
3466 if (itr_intlist.Value() != 1 &&
3467 itr_intlist.Value() != 2 &&
3468 itr_intlist.Value() != 3)
3473 getintlist->Clear();
3475 // TDataStd_RealList:
3477 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3478 setdbllist->Append(2.5);
3479 setdbllist->Prepend(1.5);
3480 setdbllist->InsertAfter(3.5, 2.5);
3481 setdbllist->InsertBefore(0.5, 1.5);
3482 setdbllist->Append(200.5);
3483 setdbllist->Remove(0.5);
3484 setdbllist->Remove(200.5);
3486 Handle(TDataStd_RealList) getdbllist;
3487 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3489 if (getdbllist->First() != 1.5)
3491 if (getdbllist->Last() != 3.5)
3493 const TColStd_ListOfReal& dbllist = getdbllist->List();
3494 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3495 for (; itr_dbllist.More(); itr_dbllist.Next())
3497 if (itr_dbllist.Value() != 1.5 &&
3498 itr_dbllist.Value() != 2.5 &&
3499 itr_dbllist.Value() != 3.5)
3504 getdbllist->Clear();
3506 // TDataStd_ExtStringList:
3508 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3509 setstrlist->Append("Hello");
3510 setstrlist->Prepend("Guten Tag");
3511 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3512 setstrlist->InsertBefore("Bonsoir", "Hello");
3513 setstrlist->Append("Good bye");
3514 setstrlist->Remove("Bonsoir");
3515 setstrlist->Remove("Good bye");
3517 Handle(TDataStd_ExtStringList) getstrlist;
3518 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3520 if (getstrlist->First() != "Guten Tag")
3522 if (getstrlist->Last() != "Hello")
3524 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3525 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3526 for (; itr_strlist.More(); itr_strlist.Next())
3528 if (itr_strlist.Value() != "Guten Tag" &&
3529 itr_strlist.Value() != "Bonjour" &&
3530 itr_strlist.Value() != "Hello")
3535 getstrlist->Clear();
3537 // TDataStd_BooleanList:
3539 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3540 setboollist->Append(Standard_True);
3541 setboollist->Prepend(Standard_False);
3543 Handle(TDataStd_BooleanList) getboollist;
3544 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3546 if (getboollist->First() != Standard_False)
3548 if (getboollist->Last() != Standard_True)
3550 const TDataStd_ListOfByte& boollist = getboollist->List();
3551 TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
3552 for (; itr_boollist.More(); itr_boollist.Next())
3554 if (itr_boollist.Value() != Standard_True &&
3555 itr_boollist.Value() != Standard_False)
3560 getboollist->Clear();
3562 // TDataStd_ReferenceList:
3563 TDF_Label L1 = doc->Main().FindChild(100);
3564 TDF_Label L2 = doc->Main().FindChild(101);
3565 TDF_Label L3 = doc->Main().FindChild(102);
3566 TDF_Label L4 = doc->Main().FindChild(103);
3567 TDF_Label L5 = doc->Main().FindChild(104);
3569 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3570 setreflist->Append(L1);
3571 setreflist->Prepend(L2);
3572 setreflist->InsertAfter(L3, L2);
3573 setreflist->InsertBefore(L4, L1);
3574 setreflist->Append(L5);
3575 setreflist->Remove(L4);
3576 setreflist->Remove(L5);
3578 Handle(TDataStd_ReferenceList) getreflist;
3579 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3581 if (getreflist->First() != L2)
3583 if (getreflist->Last() != L1)
3585 const TDF_LabelList& reflist = getreflist->List();
3586 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3587 for (; itr_reflist.More(); itr_reflist.Next())
3589 if (itr_reflist.Value() != L1 &&
3590 itr_reflist.Value() != L2 &&
3591 itr_reflist.Value() != L3)
3596 getreflist->Clear();
3598 // TDataStd_BooleanArray:
3600 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3601 setboolarr->SetValue(12, Standard_True);
3602 setboolarr->SetValue(13, Standard_False);
3603 setboolarr->SetValue(14, Standard_False);
3604 setboolarr->SetValue(15, Standard_False);
3605 setboolarr->SetValue(16, Standard_True);
3606 setboolarr->SetValue(14, Standard_True);
3608 Handle(TDataStd_BooleanArray) getboolarr;
3609 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3611 if (getboolarr->Value(12) != Standard_True)
3613 if (getboolarr->Value(13) != Standard_False)
3615 if (getboolarr->Value(14) != Standard_True)
3617 if (getboolarr->Value(15) != Standard_False)
3619 if (getboolarr->Value(16) != Standard_True)
3622 // TDataStd_ReferenceArray:
3624 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3625 setrefarr->SetValue(0, L1);
3626 setrefarr->SetValue(1, L2);
3627 setrefarr->SetValue(2, L3);
3628 setrefarr->SetValue(3, L4);
3629 setrefarr->SetValue(4, L5);
3631 Handle(TDataStd_ReferenceArray) getrefarr;
3632 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3634 if (getrefarr->Value(0) != L1)
3636 if (getrefarr->Value(1) != L2)
3638 if (getrefarr->Value(2) != L3)
3640 if (getrefarr->Value(3) != L4)
3642 if (getrefarr->Value(4) != L5)
3645 // TDataStd_ByteArray:
3647 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3648 setbytearr->SetValue(12, 0);
3649 setbytearr->SetValue(13, 1);
3650 setbytearr->SetValue(14, 2);
3651 setbytearr->SetValue(15, 3);
3652 setbytearr->SetValue(16, 255);
3654 Handle(TDataStd_ByteArray) getbytearr;
3655 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3657 if (getbytearr->Value(12) != 0)
3659 if (getbytearr->Value(13) != 1)
3661 if (getbytearr->Value(14) != 2)
3663 if (getbytearr->Value(15) != 3)
3665 if (getbytearr->Value(16) != 255)
3668 // TDataStd_NamedData:
3670 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3671 setnd->SetInteger("Integer1", 1);
3672 setnd->SetInteger("Integer2", 2);
3673 setnd->SetInteger("Integer3", 8);
3674 setnd->SetInteger("Integer3", 3);
3676 Handle(TDataStd_NamedData) getnd;
3677 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3679 if (!getnd->HasIntegers())
3681 if (!getnd->HasInteger("Integer1"))
3683 if (getnd->GetInteger("Integer2") != 2)
3685 if (getnd->GetInteger("Integer3") != 3)
3691 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3695 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3696 doc->CommitCommand();
3697 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3700 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3703 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3706 // TDataStd_IntegerList:
3708 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3710 intlist->Prepend(1);
3711 intlist->InsertBefore(0, 1);
3712 intlist->InsertAfter(3, 2);
3713 doc->CommitCommand();
3714 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3717 if (!intlist->IsEmpty())
3720 if (!intlist->Extent())
3722 if (intlist->First() != 0)
3724 if (intlist->Last() != 3)
3728 // TDataStd_RealList:
3730 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3731 dbllist->Append(2.5);
3732 dbllist->Prepend(1.5);
3733 dbllist->InsertBefore(0.5, 1.5);
3734 dbllist->InsertAfter(3.5, 2.5);
3735 doc->CommitCommand();
3736 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3739 if (!dbllist->IsEmpty())
3742 if (!dbllist->Extent())
3744 if (dbllist->First() != 0.5)
3746 if (dbllist->Last() != 3.5)
3750 // TDataStd_ExtStringList:
3752 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3753 strlist->Append("Hello");
3754 strlist->Prepend("Guten Tag");
3755 strlist->InsertAfter("Bonjour", "Guten Tag");
3756 strlist->InsertBefore("Bonsoir", "Hello");
3757 doc->CommitCommand();
3758 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3761 if (!strlist->IsEmpty())
3764 if (!strlist->Extent())
3766 if (strlist->First() != "Guten Tag")
3768 if (strlist->Last() != "Hello")
3772 // TDataStd_BooleanList:
3774 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3775 boollist->Append(Standard_True);
3776 boollist->Prepend(Standard_False);
3777 doc->CommitCommand();
3778 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3781 if (!boollist->IsEmpty())
3784 if (!boollist->Extent())
3786 if (boollist->First() != Standard_False)
3788 if (boollist->Last() != Standard_True)
3792 // TDataStd_ReferenceList:
3793 TDF_Label L1 = doc->Main().FindChild(100);
3794 TDF_Label L2 = doc->Main().FindChild(101);
3795 TDF_Label L3 = doc->Main().FindChild(102);
3796 TDF_Label L4 = doc->Main().FindChild(103);
3798 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3799 reflist->Append(L1);
3800 reflist->Prepend(L2);
3801 reflist->InsertBefore(L3, L1);
3802 reflist->InsertAfter(L4, L2);
3803 doc->CommitCommand();
3804 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3807 if (!reflist->IsEmpty())
3810 if (!reflist->Extent())
3812 if (reflist->First() != L2)
3814 if (reflist->Last() != L1)
3818 // TDataStd_BooleanArray:
3820 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3821 boolarr->SetValue(23, Standard_True);
3822 boolarr->SetValue(25, Standard_True);
3823 doc->CommitCommand();
3825 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3826 boolarr->SetValue(230, Standard_True);
3827 boolarr->SetValue(250, Standard_True);
3828 doc->CommitCommand();
3830 if (boolarr->Value(23) != Standard_True)
3832 if (boolarr->Value(24) != Standard_False)
3834 if (boolarr->Value(25) != Standard_True)
3837 if (boolarr->Value(230) != Standard_True)
3839 if (boolarr->Value(240) != Standard_False)
3841 if (boolarr->Value(250) != Standard_True)
3844 // TDataStd_ReferenceArray:
3846 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3847 refarr->SetValue(5, L1);
3848 refarr->SetValue(6, L2);
3849 refarr->SetValue(7, L3);
3850 refarr->SetValue(8, L4);
3851 doc->CommitCommand();
3852 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3856 if (refarr->Value(5) != L1)
3858 if (refarr->Value(6) != L2)
3860 if (refarr->Value(7) != L3)
3862 if (refarr->Value(8) != L4)
3865 // TDataStd_ByteArray:
3867 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3868 bytearr->SetValue(23, 23);
3869 bytearr->SetValue(25, 25);
3870 doc->CommitCommand();
3872 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3873 bytearr->SetValue(230, 230);
3874 bytearr->SetValue(250, 250);
3875 doc->CommitCommand();
3877 if (bytearr->Value(23) != 23)
3879 if (bytearr->Value(25) != 25)
3882 if (bytearr->Value(230) != 230)
3884 if (bytearr->Value(250) != 250)
3887 // TDataStd_NamedData:
3889 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3890 nd->SetByte("b14", 12);
3891 nd->SetByte("b17", 18);
3892 nd->SetByte("b14", 14);
3893 nd->SetByte("b17", 17);
3894 doc->CommitCommand();
3896 nd = TDataStd_NamedData::Set(doc->Main());
3897 nd->SetReal("r14", 14);
3898 nd->SetReal("r17", 17);
3899 nd->SetReal("r14", 14.4);
3900 nd->SetReal("r17", 17.7);
3901 doc->CommitCommand();
3903 if (nd->HasStrings())
3907 if (nd->HasReal("r17"))
3909 if (!nd->HasBytes())
3911 if (nd->GetByte("b14") != 14)
3913 if (nd->GetByte("b17") != 17)
3915 if (nd->HasByte("b18"))
3918 if (!nd->HasBytes())
3920 if (!nd->HasReals())
3922 if (nd->GetByte("b14") != 14)
3924 if (nd->GetReal("r14") != 14.4)
3926 if (nd->GetReal("r17") != 17.7)
3932 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3934 TDF_Label L1 = doc->Main().FindChild(1);
3935 TDF_Label L2 = doc->Main().FindChild(2);
3936 TDF_CopyLabel copier(L1, L2);
3939 TDataStd_Tick::Set(L1);
3941 if (!copier.IsDone())
3943 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3946 // TDataStd_IntegerList:
3947 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3949 intlist->InsertAfter(2, 1);
3951 if (!copier.IsDone())
3955 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3957 if (intlist->First() != 1)
3959 if (intlist->Last() != 2)
3963 // TDataStd_RealList:
3964 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3965 dbllist->Append(1.5);
3966 dbllist->InsertAfter(2.5, 1.5);
3968 if (!copier.IsDone())
3972 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3974 if (dbllist->First() != 1.5)
3976 if (dbllist->Last() != 2.5)
3980 // TDataStd_ExtStringList:
3981 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3982 strlist->Append("Open CASCADE");
3983 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3985 if (!copier.IsDone())
3989 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3991 if (strlist->First() != "Open CASCADE")
3993 if (strlist->Last() != " - is the best set of libraries!")
3997 // TDataStd_BooleanList:
3998 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3999 boollist->Append(Standard_True);
4000 boollist->Prepend(Standard_False);
4002 if (!copier.IsDone())
4006 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4008 if (boollist->First() != Standard_False)
4010 if (boollist->Last() != Standard_True)
4014 // TDataStd_ReferenceList:
4015 TDF_Label L100 = doc->Main().FindChild(100);
4016 TDF_Label L101 = doc->Main().FindChild(101);
4017 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
4018 reflist->Append(L100);
4019 reflist->InsertAfter(L101, L100);
4021 if (!copier.IsDone())
4025 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4027 if (reflist->First() != L100)
4029 if (reflist->Last() != L101)
4033 // TDataStd_BooleanArray:
4034 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
4035 boolarr->SetValue(4, Standard_True);
4036 boolarr->SetValue(6, Standard_True);
4038 if (!copier.IsDone())
4041 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4043 if (boolarr->Value(4) != Standard_True)
4045 if (boolarr->Value(5) != Standard_False)
4047 if (boolarr->Value(6) != Standard_True)
4050 // TDataStd_ReferenceArray:
4051 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
4052 refarr->SetValue(3, L100);
4053 refarr->SetValue(4, L101);
4055 if (!copier.IsDone())
4058 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4060 if (refarr->Value(3) != L100)
4062 if (refarr->Value(4) != L101)
4065 // TDataStd_ByteArray:
4066 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
4067 bytearr->SetValue(4, 40);
4068 bytearr->SetValue(6, 60);
4070 if (!copier.IsDone())
4073 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4075 if (bytearr->Value(4) != 40)
4077 if (bytearr->Value(6) != 60)
4080 // TDataStd_NamedData:
4081 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
4082 nd->SetInteger("Integer1", 11);
4083 nd->SetReal("Real1", 11.1);
4084 nd->SetString("String1", "11.11111111");
4085 nd->SetByte("Byte1", 111);
4086 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
4087 ints_arr->SetValue(4, 4);
4088 ints_arr->SetValue(5, 5);
4089 nd->SetArrayOfIntegers("Integers1", ints_arr);
4091 if (!copier.IsDone())
4094 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
4096 if (!nd->HasIntegers())
4098 if (!nd->HasReals())
4100 if (!nd->HasStrings())
4102 if (!nd->HasBytes())
4104 if (!nd->HasArraysOfIntegers())
4106 if (nd->HasArraysOfReals())
4108 if (!nd->HasInteger("Integer1"))
4110 if (nd->GetInteger("Integer1") != 11)
4112 if (!nd->HasReal("Real1"))
4114 if (nd->GetReal("Real1") != 11.1)
4116 if (!nd->HasString("String1"))
4118 if (nd->GetString("String1") != "11.11111111")
4120 if (!nd->HasByte("Byte1"))
4122 if (nd->GetByte("Byte1") != 111)
4124 if (!nd->HasArrayOfIntegers("Integers1"))
4126 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
4127 if (ints_arr_out.IsNull())
4129 if (ints_arr_out->Value(5) != 5)
4135 int TestOpenSave(TCollection_ExtendedString aFile1,
4136 TCollection_ExtendedString aFile2,
4137 TCollection_ExtendedString aFile3)
4140 Handle(TDocStd_Document) doc_std, doc_std_open;
4141 app->NewDocument("MDTV-Standard", doc_std);
4143 TDataStd_Tick::Set(doc_std->Main());
4144 // TDataStd_IntegerList:
4145 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
4148 // TDataStd_RealList:
4149 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
4150 dbllist->Append(1.5);
4151 dbllist->Append(5.5);
4152 // TDataStd_ExtStringList:
4153 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
4154 strlist->Append("Auf");
4155 strlist->Append("Wiedersehen");
4156 // TDataStd_BooleanList:
4157 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
4158 boollist->Append(Standard_False);
4159 boollist->Append(Standard_True);
4160 // TDataStd_ReferenceList:
4161 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
4162 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
4163 TDF_Tool::Entry(Lstd1, entry1);
4164 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
4165 TDF_Tool::Entry(Lstd2, entry2);
4166 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
4167 reflist->Append(Lstd1);
4168 reflist->Append(Lstd2);
4169 // TDataStd_BooleanArray:
4170 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
4171 boolarr->SetValue(15, Standard_False);
4172 boolarr->SetValue(16, Standard_True);
4173 boolarr->SetValue(17, Standard_True);
4174 boolarr->SetValue(18, Standard_True);
4175 // TDataStd_ReferenceArray:
4176 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
4177 refarr->SetValue(45, Lstd1);
4178 refarr->SetValue(46, Lstd2);
4179 // TDataStd_ByteArray:
4180 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
4181 bytearr->SetValue(15, 150);
4182 bytearr->SetValue(16, 160);
4183 bytearr->SetValue(17, 170);
4184 bytearr->SetValue(18, 180);
4185 // TDataStd_NamedData:
4186 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
4188 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
4189 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
4192 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
4193 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
4202 app->Close(doc_std);
4204 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
4205 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
4207 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4209 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4211 if (intlist->First() != 1)
4213 if (intlist->Last() != 5)
4215 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4217 if (dbllist->First() != 1.5)
4219 if (dbllist->Last() != 5.5)
4221 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4223 if (strlist->First() != "Auf")
4225 if (strlist->Last() != "Wiedersehen")
4227 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4229 if (boollist->First() != Standard_False)
4231 if (boollist->Last() != Standard_True)
4233 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4235 TDF_Tool::Entry(reflist->First(), entry_first);
4236 if (entry1 != entry_first)
4238 TDF_Tool::Entry(reflist->Last(), entry_last);
4239 if (entry2 != entry_last)
4241 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4243 if (boolarr->Value(15) != Standard_False)
4245 if (boolarr->Value(16) != Standard_True)
4247 if (boolarr->Value(17) != Standard_True)
4249 if (boolarr->Value(18) != Standard_True)
4251 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4253 TDF_Tool::Entry(refarr->Value(45), entry_first);
4254 if (entry1 != entry_first)
4256 TDF_Tool::Entry(refarr->Value(46), entry_last);
4257 if (entry2 != entry_last)
4259 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4261 if (bytearr->Value(15) != 150)
4263 if (bytearr->Value(16) != 160)
4265 if (bytearr->Value(17) != 170)
4267 if (bytearr->Value(18) != 180)
4269 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4271 if (ref->Get().IsNull())
4273 if (ref->Get().Tag() != 103)
4277 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4278 app->NewDocument("XmlOcaf", doc_xml);
4280 TDataStd_Tick::Set(doc_xml->Main());
4281 // TDataStd_IntegerList:
4282 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4285 // TDataStd_RealList:
4286 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4287 dbllist->Append(1.5);
4288 dbllist->Append(5.5);
4289 // TDataStd_ExtStringList:
4290 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4291 strlist->Append("Guten ");
4292 strlist->Append("Tag");
4293 // TDataStd_BooleanList:
4294 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4295 boollist->Append(Standard_False);
4296 boollist->Append(Standard_True);
4297 // TDataStd_ReferenceList:
4298 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4299 TDF_Tool::Entry(Lxml1, entry1);
4300 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4301 TDF_Tool::Entry(Lxml2, entry2);
4302 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4303 reflist->Append(Lxml1);
4304 reflist->Append(Lxml2);
4305 // TDataStd_BooleanArray:
4306 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4307 boolarr->SetValue(15, Standard_False);
4308 boolarr->SetValue(16, Standard_True);
4309 boolarr->SetValue(17, Standard_True);
4310 boolarr->SetValue(18, Standard_True);
4311 boolarr->SetValue(19, Standard_True);
4312 boolarr->SetValue(20, Standard_True);
4313 boolarr->SetValue(21, Standard_False);
4314 boolarr->SetValue(22, Standard_True);
4315 boolarr->SetValue(23, Standard_True);
4316 boolarr->SetValue(24, Standard_True);
4317 // TDataStd_ReferenceArray:
4318 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4319 refarr->SetValue(444, Lxml1);
4320 refarr->SetValue(445, Lxml2);
4321 // TDataStd_ByteArray:
4322 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4323 bytearr->SetValue(15, 0);
4324 bytearr->SetValue(16, 10);
4325 bytearr->SetValue(17, 100);
4326 bytearr->SetValue(18, 200);
4327 bytearr->SetValue(19, 250);
4328 bytearr->SetValue(20, 251);
4329 bytearr->SetValue(21, 252);
4330 bytearr->SetValue(22, 253);
4331 bytearr->SetValue(23, 254);
4332 bytearr->SetValue(24, 255);
4334 Lstd3 = doc_xml->Main().FindChild(103);
4335 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4338 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4339 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4343 app->Close(doc_xml);
4345 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4346 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4348 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4350 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4352 if (intlist->First() != 1)
4354 if (intlist->Last() != 5)
4356 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4358 if (dbllist->First() != 1.5)
4360 if (dbllist->Last() != 5.5)
4362 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4364 if (strlist->First() != "Guten ")
4366 if (strlist->Last() != "Tag")
4368 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4370 if (boollist->First() != Standard_False)
4372 if (boollist->Last() != Standard_True)
4374 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4376 TDF_Tool::Entry(reflist->First(), entry_first);
4377 if (entry1 != entry_first)
4379 TDF_Tool::Entry(reflist->Last(), entry_last);
4380 if (entry2 != entry_last)
4382 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4384 if (boolarr->Value(15) != Standard_False)
4386 if (boolarr->Value(16) != Standard_True)
4388 if (boolarr->Value(17) != Standard_True)
4390 if (boolarr->Value(18) != Standard_True)
4392 if (boolarr->Value(19) != Standard_True)
4394 if (boolarr->Value(20) != Standard_True)
4396 if (boolarr->Value(21) != Standard_False)
4398 if (boolarr->Value(22) != Standard_True)
4400 if (boolarr->Value(23) != Standard_True)
4402 if (boolarr->Value(24) != Standard_True)
4404 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4406 TDF_Tool::Entry(refarr->Value(444), entry_first);
4407 if (entry1 != entry_first)
4409 TDF_Tool::Entry(refarr->Value(445), entry_last);
4410 if (entry2 != entry_last)
4412 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4414 if (bytearr->Value(15) != 0)
4416 if (bytearr->Value(16) != 10)
4418 if (bytearr->Value(17) != 100)
4420 if (bytearr->Value(18) != 200)
4422 if (bytearr->Value(19) != 250)
4424 if (bytearr->Value(20) != 251)
4426 if (bytearr->Value(21) != 252)
4428 if (bytearr->Value(22) != 253)
4430 if (bytearr->Value(23) != 254)
4432 if (bytearr->Value(24) != 255)
4434 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4436 if (ref->Get().IsNull())
4438 if (ref->Get().Tag() != 103)
4442 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4443 app->NewDocument("BinOcaf", doc_bin);
4445 TDataStd_Tick::Set(doc_bin->Main());
4446 // TDataStd_IntegerList:
4447 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4450 // TDataStd_RealList:
4451 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4452 dbllist->Append(1.5);
4453 dbllist->Append(5.5);
4454 // TDataStd_ExtStringList:
4455 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4456 strlist->Append("Bonjour");
4457 strlist->Append("Bonsoir");
4458 // TDataStd_BooleanList:
4459 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4460 boollist->Append(Standard_False);
4461 boollist->Append(Standard_True);
4462 // TDataStd_ReferenceList:
4463 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4464 TDF_Tool::Entry(Lbin1, entry1);
4465 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4466 TDF_Tool::Entry(Lbin2, entry2);
4467 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4468 reflist->Append(Lbin1);
4469 reflist->Append(Lbin2);
4470 // TDataStd_BooleanArray:
4471 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4472 boolarr->SetValue(15, Standard_False);
4473 boolarr->SetValue(16, Standard_True);
4474 boolarr->SetValue(17, Standard_True);
4475 boolarr->SetValue(18, Standard_True);
4476 boolarr->SetValue(19, Standard_True);
4477 boolarr->SetValue(20, Standard_True);
4478 boolarr->SetValue(21, Standard_False);
4479 boolarr->SetValue(22, Standard_True);
4480 boolarr->SetValue(23, Standard_True);
4481 boolarr->SetValue(24, Standard_True);
4482 // TDataStd_ReferenceArray:
4483 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4484 refarr->SetValue(0, Lbin1);
4485 refarr->SetValue(1, Lbin2);
4486 // TDataStd_ByteArray:
4487 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4488 bytearr->SetValue(15, 0);
4489 bytearr->SetValue(16, 255);
4490 // TDataStd_NamedData:
4491 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4492 nameddata->SetByte("A", 12);
4493 nameddata->SetByte("B", 234);
4495 Lstd3 = doc_bin->Main().FindChild(103);
4496 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4499 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4500 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4504 app->Close(doc_bin);
4506 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4507 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4509 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4511 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4513 if (intlist->First() != 1)
4515 if (intlist->Last() != 5)
4517 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4519 if (dbllist->First() != 1.5)
4521 if (dbllist->Last() != 5.5)
4523 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4525 if (strlist->First() != "Bonjour")
4527 if (strlist->Last() != "Bonsoir")
4529 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4531 if (boollist->First() != Standard_False)
4533 if (boollist->Last() != Standard_True)
4535 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4537 TDF_Tool::Entry(reflist->First(), entry_first);
4538 if (entry1 != entry_first)
4540 TDF_Tool::Entry(reflist->Last(), entry_last);
4541 if (entry2 != entry_last)
4543 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4545 if (boolarr->Value(15) != Standard_False)
4547 if (boolarr->Value(16) != Standard_True)
4549 if (boolarr->Value(17) != Standard_True)
4551 if (boolarr->Value(18) != Standard_True)
4553 if (boolarr->Value(19) != Standard_True)
4555 if (boolarr->Value(20) != Standard_True)
4557 if (boolarr->Value(21) != Standard_False)
4559 if (boolarr->Value(22) != Standard_True)
4561 if (boolarr->Value(23) != Standard_True)
4563 if (boolarr->Value(24) != Standard_True)
4565 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4567 TDF_Tool::Entry(refarr->Value(0), entry_first);
4568 if (entry1 != entry_first)
4570 TDF_Tool::Entry(refarr->Value(1), entry_last);
4571 if (entry2 != entry_last)
4573 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4575 if (bytearr->Value(15) != 0)
4577 if (bytearr->Value(16) != 255)
4579 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4581 if (nameddata->GetByte("A") != 12)
4583 if (nameddata->GetByte("B") != 234)
4585 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4587 if (ref->Get().IsNull())
4589 if (ref->Get().Tag() != 103)
4594 // For OCC16782 testing
4596 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4600 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4603 TCollection_ExtendedString aFile1(argv[1]);
4604 TCollection_ExtendedString aFile2(argv[2]);
4605 TCollection_ExtendedString aFile3(argv[3]);
4608 app = new AppStd_Application();
4612 Handle(TDocStd_Document) doc;
4613 app->NewDocument("MDTV-Standard", doc);
4614 doc->SetUndoLimit(10);
4616 di <<"\nTestSetGet start\n";
4617 good += TestSetGet(doc);
4618 di <<"TestSetGet finish\n";
4619 di <<"Status = " << good << "\n";
4621 di <<"\nTestUndoRedo start\n";
4622 good += TestUndoRedo(doc);
4623 di <<"TestUndoRedo finish\n";
4624 di <<"Status = " << good << "\n";
4626 di <<"\nTestCopyPaste start\n";
4627 good += TestCopyPaste(doc);
4628 di <<"TestCopyPaste finish\n";
4629 di <<"Status = " << good << "\n";
4631 di <<"\nTestOpenSave start\n";
4632 good += TestOpenSave(aFile1, aFile2, aFile3);
4633 di <<"TestOpenSave finish\n";
4634 di <<"Status = " << good << "\n";
4637 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4639 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4644 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4646 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4647 if(aContext.IsNull()) {
4648 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
4654 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4657 Standard_Integer mode = 0;
4660 mode = atoi(argv[1]);
4662 if (mode > 2 || mode < 0)
4664 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4667 Handle(V3d_View) V = ViewerTest::CurrentView();
4668 if ( !V.IsNull() ) {
4670 V->ColorScaleDisplay();
4673 V->ColorScaleErase();
4678 Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
4680 di <<"ColorScaleIsDisplayed = " << "1" << "\n";
4682 di <<"ColorScaleIsDisplayed = " << "0" << "\n";
4688 #include <Interface_Macros.hxx>
4689 #include <IGESControl_Controller.hxx>
4690 #include <XSDRAW.hxx>
4691 #include <Draw_ProgressIndicator.hxx>
4692 #include <XSControl_WorkSession.hxx>
4693 #include <Transfer_TransientProcess.hxx>
4694 #include <XSDRAW_Commands.hxx>
4695 #include <TColStd_HSequenceOfTransient.hxx>
4696 #include <Message_ProgressSentry.hxx>
4697 #include <XSControl_TransferReader.hxx>
4699 static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4701 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
4702 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
4704 // Progress indicator
4705 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
4706 progress->SetScale ( 0, 100, 1 );
4709 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
4711 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
4713 TCollection_AsciiString fnom,rnom;
4715 Standard_Boolean modfic = XSDRAW::FileAndVar
4716 (argv[1],argv[2],"IGESBREP",fnom,rnom);
4717 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
4718 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
4719 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
4720 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
4723 OSD_Timer Chr; Chr.Reset();
4729 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
4733 //In order to decrease number of produced edges during translation it is possible to set following parameter
4734 Interface_Static::SetIVal("read.iges.bspline.continuity",0);
4737 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
4738 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
4740 progress->EndScope();
4743 if (readstat != IFSelect_RetDone) {
4744 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
4745 else di<<"No model loaded"<<"\n";
4748 // Choice of treatment
4749 Standard_Boolean fromtcl = (argc > 3);
4750 Standard_Integer modepri = 1, nent, nbs;
4751 if (fromtcl) modepri = 4;
4754 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
4755 //mode OnlyVisible does not work.
4756 // nent = Reader.NbRootsForTransfer();
4758 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
4761 // amv 26.09.2003 : this is used to avoid error of enter's simbol
4764 modepri = atoi(str);
4767 if (modepri == 0) { //fin
4768 di << "Bye and good luck! " << "\n";
4772 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
4773 di << "All Geometry Transfer"<<"\n";
4774 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4775 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4776 Handle(XSControl_WorkSession) thesession = Reader.WS();
4777 thesession->ClearContext();
4778 XSDRAW::SetTransferProcess (thesession->MapReader());
4779 progress->NewScope ( 80, "Translation" );
4781 thesession->MapReader()->SetProgress ( progress );
4783 if (modepri == 1) Reader.SetReadVisible (Standard_True);
4784 Reader.TransferRoots();
4786 thesession->MapReader()->SetProgress ( 0 );
4787 progress->EndScope();
4789 // result in only one shape for all the roots
4790 // or in one shape for one root.
4791 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
4792 Standard_Integer answer = 1;
4793 if (Reader.NbShapes() > 1) {
4794 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;
4799 answer = atoi(str_a);
4801 if ( answer == 0) continue;
4802 if ( answer == 1 || answer == 3) {
4803 TopoDS_Shape shape = Reader.OneShape();
4805 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4807 sprintf(fname, "%s", rnom.ToCString());
4808 di << "Saving shape in variable Draw : " << fname << "\n";
4809 if (answer == 3) IGESToBRep::WriteShape (shape,1);
4812 DBRep::Set(fname,shape);
4814 catch(Standard_Failure) {
4815 di << "** Exception : ";
4816 di << Standard_Failure::Caught()->GetMessageString();
4817 di<<" ** Skip"<<"\n";
4818 di << "Saving shape in variable Draw : " << fname << "\n";
4819 IGESToBRep::WriteShape (shape,1);
4823 else if (answer == 2 || answer == 4) {
4824 Standard_Integer numshape = Reader.NbShapes();
4825 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
4826 // save all the shapes
4827 TopoDS_Shape shape = Reader.Shape(inum);
4828 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
4830 sprintf(fname, "%s_%d", rnom.ToCString(),inum);
4831 di << "Saving shape in variable Draw : " << fname << "\n";
4832 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
4835 DBRep::Set(fname,shape);
4837 catch(Standard_Failure) {
4838 di << "** Exception : ";
4839 di << Standard_Failure::Caught()->GetMessageString();
4840 di<<" ** Skip"<<"\n";
4847 else if (modepri == 3) { // One Entity
4848 cout << "Only One Entity"<<endl;
4849 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
4850 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
4851 cout << " give the number of the Entity : " << flush;
4852 nent = XSDRAW::GetEntityNumber();
4854 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4856 nbs = Reader.NbShapes();
4857 char shname[30]; sprintf (shname,"%s_%d",rnom.ToCString(),nent);
4858 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4859 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4860 TopoDS_Shape sh = Reader.Shape(nbs);
4861 DBRep::Set (shname,sh);
4865 else if (modepri == 4) { // Selection
4866 Standard_Integer answer = 1;
4867 Handle(TColStd_HSequenceOfTransient) list;
4869 // Selection, nommee ou via tcl. tcl : raccourcis admis
4870 // * donne iges-visible + xst-transferrable-roots
4871 // *r donne xst-model-roots (TOUTES racines)
4873 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
4874 di << "All Geometry Transfer"<<"\n";
4875 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
4876 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
4877 Handle(XSControl_WorkSession) thesession = Reader.WS();
4878 thesession->ClearContext();
4879 XSDRAW::SetTransferProcess (thesession->MapReader());
4880 progress->NewScope ( 80, "Translation" );
4882 thesession->MapReader()->SetProgress ( progress );
4884 Reader.SetReadVisible (Standard_True);
4885 Reader.TransferRoots();
4887 thesession->MapReader()->SetProgress ( 0 );
4888 progress->EndScope();
4891 // result in only one shape for all the roots
4892 TopoDS_Shape shape = Reader.OneShape();
4895 sprintf(fname, "%s", rnom.ToCString());
4896 di << "Saving shape in variable Draw : " << fname << "\n";
4899 DBRep::Set(fname,shape);
4901 catch(Standard_Failure) {
4902 di << "** Exception : ";
4903 di << Standard_Failure::Caught()->GetMessageString();
4904 di<<" ** Skip"<<"\n";
4905 di << "Saving shape in variable Draw : " << fname << "\n";
4906 IGESToBRep::WriteShape (shape,1);
4912 modepri = 0; // d office, une seule passe
4913 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
4915 list = XSDRAW::GetList ("xst-model-roots");
4918 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
4919 di<<"List given by "<<compart.ToCString()<<" : ";
4920 list = XSDRAW::GetList (compart.ToCString());
4922 if (list.IsNull()) {
4923 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
4928 cout<<"Name of Selection :"<<flush;
4929 list = XSDRAW::GetList();
4930 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
4933 Standard_Integer nbl = list->Length();
4934 di<<"Nb entities selected : "<<nbl<<"\n";
4935 if (nbl == 0) continue;
4938 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
4941 char str_answer[80];
4943 answer = atoi(str_answer);
4945 if (answer <= 0 || answer > 3) continue;
4947 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
4948 Handle(Standard_Transient) ent = list->Value(ill);
4949 di<<" ";// model->Print(ent,di);
4953 if (answer == 1 || answer == 2) {
4954 Standard_Integer nbt = 0;
4955 Handle(XSControl_WorkSession) thesession = Reader.WS();
4957 XSDRAW::SetTransferProcess (thesession->MapReader());
4958 progress->NewScope ( 80, "Translation" );
4960 thesession->MapReader()->SetProgress ( progress );
4962 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
4963 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
4965 nent = Reader.Model()->Number(list->Value(ill));
4966 if (nent == 0) continue;
4967 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
4969 nbs = Reader.NbShapes();
4970 char shname[30]; sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
4971 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
4972 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
4973 TopoDS_Shape sh = Reader.Shape(nbs);
4974 DBRep::Set (shname,sh);
4978 thesession->MapReader()->SetProgress ( 0 );
4979 progress->EndScope();
4981 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
4982 answer = 0; // on ne reboucle pas
4986 else di<<"Unknown mode n0 "<<modepri<<"\n";
4990 //In order to clear memory after IGES reading you could add the following code
4991 Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
4992 Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
4995 Reader.WS()->Model()->Clear();
4996 Standard_Integer i =1;
4998 Reader.WS()->ClearData(i);
5004 #include <Geom_Plane.hxx>
5005 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5009 di << "Usage : " << argv[0] << " plane a b c d\n";
5013 Standard_Real A = atof(argv[2]);
5014 Standard_Real B = atof(argv[3]);
5015 Standard_Real C = atof(argv[4]);
5016 Standard_Real D = atof(argv[5]);
5018 Handle(Geom_Geometry) result;
5020 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
5023 DrawTrSurf::Set(argv[1],result);
5027 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5031 di << "Usage : " << argv[0] << " MaxNbr" << "\n";
5034 Standard_Integer aMaxNbr = atoi(argv[1]);
5036 for (Standard_Integer i=0;i<aMaxNbr;i++)
5038 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
5040 TopoDS_Wire wireShape( w.Wire());
5041 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
5042 TopoDS_Face f( faceBuilder.Face());
5043 BRepMesh_IncrementalMesh im(f,1);
5044 BRepTools::Clean(f);
5049 #include <Graphic3d_Vector.hxx>
5050 Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5054 di << "Wrong number of arguments" << "\n";
5057 Standard_Real X1_Pnt = atof(argv[1]);
5058 Standard_Real Y1_Pnt = atof(argv[2]);
5059 Standard_Real Z1_Pnt = atof(argv[3]);
5060 Standard_Real X2_Pnt = atof(argv[4]);
5061 Standard_Real Y2_Pnt = atof(argv[5]);
5062 Standard_Real Z2_Pnt = atof(argv[6]);
5064 Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
5065 Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
5067 di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
5074 #include <IntCurvesFace_ShapeIntersector.hxx>
5075 #include <gp_Lin.hxx>
5076 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5080 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
5084 TopoDS_Shape shape = DBRep::Get(argv[1]);
5086 if (shape.IsNull()) {
5087 di<<" Null shape is not allowed";
5091 Standard_Real X_Pnt = atof(argv[2]);
5092 Standard_Real Y_Pnt = atof(argv[3]);
5093 Standard_Real Z_Pnt = atof(argv[4]);
5095 Standard_Real X_Dir = atof(argv[5]);
5096 Standard_Real Y_Dir = atof(argv[6]);
5097 Standard_Real Z_Dir = atof(argv[7]);
5099 Standard_Real PInf = atof(argv[8]);
5101 IntCurvesFace_ShapeIntersector intersector;
5102 intersector.Load(shape, Precision::Intersection());
5104 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
5105 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
5106 gp_Lin ray(origin, dir);
5108 Standard_Real PSup = RealLast();
5109 intersector.PerformNearest(ray, PInf, PSup);
5110 if (intersector.NbPnt() != 0)
5112 di << argv[0] << " status = 0 \n";
5113 Standard_Real w = intersector.WParameter(1);
5114 di << "w = " << w << "\n";
5116 di << argv[0] << " status = -1 \n";
5121 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5124 di << "Usage : " << argv[0] << "\n";
5128 // Create mask 1111: extent == 4
5129 TColStd_PackedMapOfInteger aFullMask;
5130 for (Standard_Integer i = 0; i < 4; i++)
5133 // Create mask 1100: extent == 2
5134 TColStd_PackedMapOfInteger aPartMask;
5135 for (Standard_Integer i = 0; i < 2; i++)
5138 di << "aFullMask = 1111" << "\n";
5139 di << "aPartMask = 1100" << "\n";
5141 Standard_Boolean isAffected;
5143 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
5144 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5145 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
5146 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5147 isAffected = aFullMask.Subtract(aPartMask); // false (?)
5148 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
5152 #include <ShapeFix_FixSmallFace.hxx>
5153 Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5157 di << "Usage : " << argv[0] << " shape resshape\n";
5161 // try to read a shape:
5162 TopoDS_Shape aShape=DBRep::Get(argv[1]);
5163 ShapeFix_FixSmallFace aFixSmallFaces;
5164 aFixSmallFaces.Init (aShape);
5165 aFixSmallFaces.Perform();
5166 TopoDS_Shape aResShape = aFixSmallFaces.Shape();
5167 DBRep::Set(argv[2],aResShape);
5173 #include <NCollection_DataMap.hxx>
5174 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5178 di << "Usage : " << argv[0] << "\n";
5182 TCollection_ExtendedString anExtString;
5184 Standard_ExtCharacter aNonAsciiChar = 0xff00;
5185 anExtString.Insert(1, aNonAsciiChar);
5187 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true" : "false" ) << "\n";
5188 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
5189 aMap.Bind(anExtString, 0);
5195 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5198 di << "Wrong number of arguments" << argv[0] << "\n";
5202 Standard_Real X_vec = atof(argv[1]);
5203 Standard_Real Y_vec = atof(argv[2]);
5204 Standard_Real Z_vec = atof(argv[3]);
5206 Standard_Real X_dir = atof(argv[4]);
5207 Standard_Real Y_dir = atof(argv[5]);
5208 Standard_Real Z_dir = atof(argv[6]);
5210 Standard_Real X_pnt = atof(argv[7]);
5211 Standard_Real Y_pnt = atof(argv[8]);
5212 Standard_Real Z_pnt = atof(argv[9]);
5214 gp_Dir toSym(X_vec, Y_vec, Z_vec);
5215 gp_Dir dir(X_dir, Y_dir, Z_dir);
5216 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
5217 gp_Ax2 symObj(loc,dir);
5218 toSym.Mirror(symObj);
5220 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
5225 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5229 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
5233 Standard_Real X_mirrorFirstPoint = atof(argv[1]);
5234 Standard_Real Y_mirrorFirstPoint = atof(argv[2]);
5235 Standard_Real X_mirrorSecondPoint = atof(argv[3]);
5236 Standard_Real Y_mirrorSecondPoint = atof(argv[4]);
5237 Standard_Real X_p1 = atof(argv[5]);
5238 Standard_Real Y_p1 = atof(argv[6]);
5239 Standard_Real X_p2 = atof(argv[7]);
5240 Standard_Real Y_p2 = atof(argv[8]);
5242 gp_Trsf2d identityTransformation;
5244 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
5245 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
5246 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
5248 gp_Pnt2d p1(X_p1,Y_p1);
5249 gp_Pnt2d p2(X_p2,Y_p2);
5252 M1.SetMirror(mirrorAxis);
5254 M2.SetMirror(mirrorAxis);
5256 Tcomp = M2.Multiplied(M1);
5258 Standard_Real aTol = Precision::Confusion();
5259 Standard_Integer aStatus = 0;
5261 //After applying two times the same mirror the point is located on the same location OK
5262 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
5263 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
5265 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
5268 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
5269 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
5271 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
5274 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
5275 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
5276 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
5278 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
5281 di << "Status = " << aStatus << "\n";
5285 Standard_Integer OCC23429(Draw_Interpretor& di,
5286 Standard_Integer narg, const char** a)
5288 if (narg < 4) return 1;
5290 TopoDS_Shape aShape = DBRep::Get(a[2]);
5291 if (aShape.IsNull()) return 1;
5293 BRepFeat_SplitShape Spls(aShape);
5294 Spls.SetCheckInterior(Standard_False);
5296 TopoDS_Shape aTool = DBRep::Get(a[3]);
5298 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
5299 Builder.ComputePCurveOn1(Standard_True);
5301 Builder.Approximation(Standard_True);
5303 TopoDS_Shape aSection = Builder.Shape();
5305 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
5306 for (; ExpSec.More(); ExpSec.Next())
5308 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
5309 Handle(Geom2d_Curve) thePCurve;
5310 Handle(Geom_Surface) theSurface;
5311 TopLoc_Location theLoc;
5312 Standard_Real fpar, lpar;
5313 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
5315 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
5316 for (; ExpShape.More(); ExpShape.Next())
5318 aFace = TopoDS::Face(ExpShape.Current());
5319 TopLoc_Location aLoc;
5320 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
5321 if (aSurface == theSurface && aLoc == theLoc)
5324 Spls.Add(anEdge, aFace);
5327 TopoDS_Shape Result = Spls.Shape();
5328 DBRep::Set(a[1], Result);
5333 #include <BOPTColStd_CArray1OfInteger.hxx>
5334 //=======================================================================
5335 //function : DumpArray
5337 //=======================================================================
5338 void DumpArray(const BOPTColStd_CArray1OfInteger& aC,
5339 Draw_Interpretor& aDI)
5341 Standard_Integer iLength, iFactLength, iBlockLength;
5343 iLength=aC.Length();
5344 iFactLength=aC.FactLength();
5345 iBlockLength=aC.BlockLength();
5347 aDI<< "Length: " <<iLength << "\n";
5348 aDI<< "FactLength: " <<iFactLength << "\n";
5349 aDI<< "BlockLength: " <<iBlockLength << "\n";
5351 //=======================================================================
5352 //function : bcarray
5354 //=======================================================================
5355 Standard_Integer bcarray (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5359 di << "Usage : " << argv[0] << "\n";
5363 Standard_Integer i, aBL;
5364 BOPTColStd_CArray1OfInteger aC;
5367 aC.SetBlockLength(aBL);
5369 for (i=1; i<=10; ++i) {
5372 di<< "\nstate before release the unused memory\n";
5377 di<< "\nstate after release the unused memory\n";
5383 #include <ExprIntrp_GenExp.hxx>
5384 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5388 di << "Usage : " << argv[0] << " string\n";
5392 Standard_CString aString = argv[1];
5393 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
5396 myExpr->Process( aString );
5398 catch(Standard_Failure) {
5399 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
5400 di << "Exception : " << aFail->GetMessageString() << "\n";
5406 #include <Quantity_NameOfColor.hxx>
5407 #include <TopAbs_ShapeEnum.hxx>
5408 Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
5410 // Check the command arguments
5413 di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
5414 di << "Usage : " << argv[0] << " mode(0/1)\n";
5415 return 1; //TCL_ERROR
5418 const Standard_Integer aMode = atoi(argv[1]);
5420 //===================================================================
5422 Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
5423 if (aisContext.IsNull())
5425 di <<"Error: call 'vinit' first"<< "\n";
5426 return 1; //TCL_ERROR
5429 if (aisContext->HasOpenedContext())
5431 aisContext->CloseAllContexts();
5432 aisContext->RemoveAll(false);
5433 aisContext->EraseSelected(false, false);
5435 aisContext->EraseAll(false,false);
5436 Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
5437 Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
5439 trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
5440 trihedron->SetSize(20);
5441 trihedron->SetColor(Quantity_NOC_GRAY30);
5442 trihedron->SetArrowColor(Quantity_NOC_GRAY30);
5443 trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
5445 //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5446 //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
5447 //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
5450 aisContext->Display(trihedron, true);
5451 aisContext->OpenLocalContext();
5452 //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
5453 aisContext->ActivateStandardMode(TopAbs_EDGE);
5454 aisContext->SetSensitivity(8);
5459 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
5460 const char *group = "QABugs";
5462 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
5464 // Remove as bad version of QAAddOrRemoveSelected from QADraw
5465 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
5467 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
5468 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
5469 theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
5471 //====================================================
5473 // Following commands are inserted from
5474 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
5475 // ( 75455 Apr 16 18:59)
5477 //====================================================
5479 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
5480 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
5482 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
5484 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
5485 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
5486 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
5487 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
5488 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
5489 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
5492 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
5493 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
5494 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
5496 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
5497 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
5498 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
5500 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
5501 theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
5503 theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
5505 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
5507 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
5508 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
5509 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
5510 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
5511 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
5512 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
5513 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
5514 theCommands.Add("OCC543", "OCC543 name", __FILE__, OCC543, group);
5515 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
5516 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
5517 theCommands.Add("OCC627", "OCC627", __FILE__, OCC627, group);
5518 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
5519 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
5520 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
5521 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
5522 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
5523 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5524 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5525 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5526 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5528 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5529 theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
5530 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5531 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5532 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5533 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5535 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5536 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
5538 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5539 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5540 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5541 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5542 theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
5543 theCommands.Add("OCC7141", "OCC7141 [nCount]", __FILE__, OCC7141, group);
5544 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5545 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5546 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5547 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5548 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5549 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5550 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5551 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5552 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5553 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5554 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5555 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5556 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5557 theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
5558 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5559 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5560 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5561 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5562 theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
5563 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5564 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5565 theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
5566 theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
5567 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);
5568 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5569 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5570 theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);