1 // Created on: 2002-03-20
2 // Created by: QA Admin
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
21 #include <Draw_Interpretor.hxx>
23 #include <DrawTrSurf.hxx>
24 #include <AIS_InteractiveContext.hxx>
25 #include <ViewerTest.hxx>
26 #include <AIS_Shape.hxx>
27 #include <TopoDS_Shape.hxx>
29 #include <Geom_Surface.hxx>
30 #include <Geom_Axis2Placement.hxx>
32 #include <gp_Trsf.hxx>
33 #include <AIS_Trihedron.hxx>
34 #include <BRepPrimAPI_MakeBox.hxx>
35 #include <Graphic3d_MaterialAspect.hxx>
36 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
37 #include <TopoDS_Solid.hxx>
38 #include <BRepPrimAPI_MakeSphere.hxx>
39 #include <BRepPrimAPI_MakeCone.hxx>
40 #include <BRepPrimAPI_MakeCylinder.hxx>
41 #include <IGESToBRep_Reader.hxx>
42 #include <TopExp_Explorer.hxx>
44 #include <GCPnts_UniformDeflection.hxx>
45 #include <BRepAdaptor_Curve.hxx>
46 #include <IGESToBRep.hxx>
47 #include <V3d_Viewer.hxx>
48 #include <BRepAdaptor_CompCurve.hxx>
49 #include <GCPnts_AbscissaPoint.hxx>
50 #include <Standard_ErrorHandler.hxx>
51 #include <Standard_Overflow.hxx>
52 #include <Standard_Underflow.hxx>
53 #include <Standard_DivideByZero.hxx>
54 #include <OSD_SIGSEGV.hxx>
55 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
56 #include <OSD_Exception_STACK_OVERFLOW.hxx>
58 #include <OSD_Timer.hxx>
59 #include <OSD_ThreadPool.hxx>
60 #include <OSD_Parallel.hxx>
61 #include <STEPCAFControl_Writer.hxx>
62 #include <STEPControl_StepModelType.hxx>
63 #include <Interface_Static.hxx>
64 #include <IFSelect_ReturnStatus.hxx>
65 #include <Standard_Failure.hxx>
66 #include <TColgp_HArray1OfPnt2d.hxx>
67 #include <Geom2dAPI_Interpolate.hxx>
68 #include <Geom2d_BSplineCurve.hxx>
69 #include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
70 #include <Geom2d_BezierCurve.hxx>
71 #include <BRep_Tool.hxx>
72 #include <GeomProjLib.hxx>
73 #include <Geom2dAPI_InterCurveCurve.hxx>
74 #include <IntRes2d_IntersectionSegment.hxx>
75 #include <TDataStd_RealArray.hxx>
76 #include <TDF_CopyLabel.hxx>
77 #include <NCollection_Vector.hxx>
78 #include <TColStd_Array1OfInteger.hxx>
79 #include <Geom_BSplineCurve.hxx>
80 #include <TColgp_Array1OfPnt.hxx>
81 #include <AIS_ColorScale.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>
95 #include <TColStd_PackedMapOfInteger.hxx>
96 #include <Message.hxx>
97 #include <Draw_Printer.hxx>
100 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
102 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
105 static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
107 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
108 if(myAISContext.IsNull()) {
109 di << "use 'vinit' command before " << argv[0] ;
113 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
116 trsf1.SetTranslation(gp_Vec(100, 100, 0));
117 aTrihedronAxis->Transform(trsf1);
118 Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
119 myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
120 myTrihedron->SetSize(100);
121 myAISContext->Display(myTrihedron, Standard_True);
123 // TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
124 TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
125 Handle(AIS_Shape) AS = new AIS_Shape(shape1);
126 AS->SetDisplayMode(1);
127 Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
128 AS->SetMaterial(mat);
129 AS->SetColor(Quantity_NOC_RED);
130 myAISContext->Display (AS, Standard_False);
133 TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
135 myAISContext->ResetLocation(AS);
136 myAISContext->SetLocation(AS , TouchTrsf) ;
137 myAISContext->Redisplay(AS, Standard_True);
142 // Remove as bad version of QAAddOrRemoveSelected from QADraw
143 //static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
146 // di<<"Usage : " << argv[0] << " shape islocal\n";
150 // Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
152 // // ViewerTest_DoubleMapOfInteractiveAndName& aMap =
153 // // ViewerTest::GetDataMapOfAIS ();
154 // ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
156 // TCollection_AsciiString aName(argv[1]);
157 // Handle(AIS_InteractiveObject) AISObj;
159 // if(aMap.IsBound2(aName)) {
160 // AISObj = aMap.Find2(aName);
161 // if(AISObj.IsNull()){
162 // di<<"No interactive object \n";
166 // Standard_Integer aNum = -1;
168 // if(Draw::Atoi(argv[2])) {
169 // aNum = anAISCtx->OpenLocalContext();
172 // if(anAISCtx->HasOpenedContext()){
173 // anAISCtx->InitSelected();
174 // anAISCtx->AddOrRemoveSelected(AISObj);
177 // anAISCtx->InitCurrent();
178 // anAISCtx->AddOrRemoveCurrentObject(AISObj);
182 // // anAISCtx->CloseLocalContext(aNum);
187 // //select this shape:
189 // di<<"Use 'vdisplay' before";
194 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
197 di<<"Usage: OCC136\n";
201 //create some primitives:
203 Standard_Real Size=100;
204 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
206 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
208 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
210 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
211 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
213 anAx2.SetLocation(gp_Pnt(Size,0,0));
214 anAx2.SetDirection(gp_Dir(-1,-1,1));
215 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
217 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
218 if(anAISCtx.IsNull()){
219 di<<"Null interactive context. Use 'vinit' at first.\n";
223 anAISCtx->EraseAll (Standard_False);
225 //load primitives to context
226 Handle(AIS_InteractiveObject) aSh1 = new AIS_Shape(aBox);
227 anAISCtx->Display (aSh1, Standard_False);
229 Handle(AIS_InteractiveObject) aSh2 = new AIS_Shape(aSphere);
230 anAISCtx->Display (aSh2, Standard_False);
232 Handle(AIS_InteractiveObject) aSh3 = new AIS_Shape(aCone);
233 anAISCtx->Display (aSh3, Standard_False);
235 Handle(AIS_InteractiveObject) aSh4 = new AIS_Shape(aCyl);
236 anAISCtx->Display (aSh4, Standard_False);
239 anAISCtx->InitSelected();
240 anAISCtx->AddOrRemoveSelected (aSh1, Standard_False);
241 anAISCtx->AddOrRemoveSelected (aSh2, Standard_False);
242 anAISCtx->AddOrRemoveSelected (aSh3, Standard_False);
243 anAISCtx->AddOrRemoveSelected (aSh4, Standard_False);
245 //remove all this objects from context
246 anAISCtx->Remove (aSh1, Standard_False);
247 anAISCtx->Remove (aSh2, Standard_False);
248 anAISCtx->Remove (aSh3, Standard_False);
249 anAISCtx->Remove (aSh4, Standard_False);
251 anAISCtx->UpdateCurrentViewer();
255 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
257 printf("Usage: %s iges_input [name]\n",argv[0]);
260 Standard_Character *Ch = NULL;
263 Ch = new Standard_Character[strlen(argv[2])+3];
265 IGESToBRep_Reader IR;
266 IR.LoadFile (argv[1]);
269 TopoDS_Shape aTopShape = IR.OneShape();
270 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
271 Standard_Integer i=0;
272 for( ; ex.More(); ex.Next()){
273 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
274 BRepAdaptor_Curve aCurve(E);
275 GCPnts_UniformDeflection plin(aCurve, 0.1);
276 di << "Num points = " << plin.NbPoints() << "\n";
279 Sprintf(Ch,"%s_%i",argv[2],1);
286 //====================================================
288 // Following code is inserted from
289 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
290 // ( 75455 Apr 16 18:59)
292 //====================================================
295 #include <BRepTools_WireExplorer.hxx>
296 #include <BRep_Tool.hxx>
297 #include <GCPnts_UniformAbscissa.hxx>
298 #include <TopExp.hxx>
301 // usage : OCC105 shape
304 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
306 //Value Pnt = -338.556216693211 -394.465571897208 0
308 //Value Pnt = -307.47165394 -340.18073533 0
310 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
313 di<<"Usage : OCC105 shape\n";
316 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
317 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
318 Standard_Real l = 0.5; //Draw::Atof(argv[2]);
319 // Find the first vertex of the wire
320 BRepTools_WireExplorer wire_exp(myTopoDSWire);
323 TopoDS_Vertex vw1, vw2;
324 TopExp::Vertices(myTopoDSWire,vw1,vw2);
325 TopoDS_Vertex ve1, ve2;
326 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
327 TopExp::Vertices(edge,ve1,ve2);
328 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
331 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
335 for ( ; wire_exp.More(); wire_exp.Next())
337 di << "\n\n New Edge \n" << "\n";
338 Standard_Real newufirst, newulast;
339 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
340 Standard_Real ufirst, ulast;
341 Handle(Geom_Curve) acurve;
342 TopoDS_Vertex ve1, ve2;
343 TopExp::Vertices(edge,ve1,ve2);
344 if (ve1.IsSame(vlast))
346 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
353 // assert(ve2.IsSame(vlast));
354 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
355 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
356 newufirst = acurve->ReversedParameter( ufirst );
357 newulast = acurve->ReversedParameter( ulast );
358 acurve = acurve->Reversed( );
362 GeomAdaptor_Curve curve;
363 GCPnts_UniformAbscissa algo;
365 algo.Initialize( curve, l, newufirst, newulast );
367 di << "Not Done!!!" << "\n";
368 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
369 Standard_Real t = algo.Parameter(Index);
370 gp_Pnt pt3 = curve.Value(t);
371 di << "Parameter t = " << t << "\n";
372 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
379 #include <TColStd_SequenceOfTransient.hxx>
380 #include <GeomFill_Pipe.hxx>
381 static int pipe_OCC9 (Draw_Interpretor& di,
382 Standard_Integer n, const char ** a)
385 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]\n";
389 TColStd_SequenceOfTransient aCurveSeq;
391 for (i=2 ; i<=4; i++) {
392 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
394 di << a[i] << " is not a curve\n";
397 aCurveSeq.Append(aC);
400 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
401 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
402 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
406 aPipe.Perform(Draw::Atof (a[6]), Standard_True);
408 aPipe.Perform(Standard_True/*, Standard_True*/);
411 if (!aPipe.IsDone()) {
412 di << "GeomFill_Pipe cannot make a surface\n";
416 Handle(Geom_Surface) aSurf = aPipe.Surface();
418 DrawTrSurf::Set(a[1], aSurf);
422 //======================================================================
424 // usage : OCC125 shell
425 //======================================================================
426 #include <ShapeFix_Shell.hxx>
428 Standard_Integer OCC125(Draw_Interpretor& di ,
433 di<<" Use OCC125 shell";
437 TopoDS_Shape S = DBRep::Get(a[1]);
440 di<<" Null shape is not allowed";
446 if (aT!=TopAbs_SHELL) {
447 di<<" Shape Type must be SHELL";
451 const TopoDS_Shell& aShell = TopoDS::Shell(S);
453 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
455 isAccountMultiConex=Standard_True;
456 bNonManifold=Standard_False;
458 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
459 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
461 di<<"bResult="<<(Standard_Integer)bResult;
464 aShape=aFix->Shape();
466 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
469 DBRep::Set (aRName.ToCString(), aShape);
470 di<<aRName.ToCString();
475 #include <BRepLib_FindSurface.hxx>
476 #include <BRepBuilderAPI_MakeFace.hxx>
477 Standard_Integer OCC157(Draw_Interpretor& di,
480 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
483 di << "bad number of arguments\n";
487 // try to read a shape:
488 TopoDS_Shape inputShape=DBRep::Get(a[2]);
489 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
490 di << "Invalid input shape\n";
493 Standard_Real toler = Draw::Atof(a[3]);
494 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
495 BRepLib_FindSurface FS(aWire, toler, Standard_True);
497 di<<"OCC157: OK; Planar surface is found\n";
498 Handle(Geom_Surface) aSurf = FS.Surface();
499 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
500 if(aMakeFace.IsDone()) {
501 TopoDS_Face aFace = aMakeFace.Face();
502 DBRep::Set(a[1],aFace);
505 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
510 // #include <MyCommandsCMD.h>
511 #include <ShapeFix_Shape.hxx>
512 #include <BRepOffset_MakeOffset.hxx>
513 #include <BRepOffsetAPI_MakeOffset.hxx>
514 #include <BRepOffset_Mode.hxx>
515 #include <GeomAbs_JoinType.hxx>
516 #include <AIS_Shape.hxx>
518 #include <BRepTools.hxx>
520 Standard_Integer OCC165(Draw_Interpretor& di ,
525 //=======================================================================
527 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
529 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
531 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
534 //=======================================================================
536 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
540 di <<"Usage : " << a[0] << " [file]\n";
545 #define _OFFSET_TELCO_
546 #ifdef _OFFSET_TELCO_
548 Standard_CString file = a[1];
550 BRep_Builder aBuilder;
551 TopoDS_Shape theShape;
552 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
553 BRepTools::Read(theShape, file, aBuilder);
554 DBRep::Set("shape", theShape);
556 TopoDS_Wire theWire = TopoDS::Wire(theShape);
558 Standard_Real anOffset = 1.5;
562 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
563 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
564 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
566 BRepBuilderAPI_MakePolygon theSquare;
567 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
569 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
571 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
573 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
577 TopoDS_Wire theWire = theSquare.Wire();
579 Standard_Real anOffset = 10;
582 #endif /* _OFFSET_TELCO_ */
585 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
586 DBRep::Set("face", theFace);
589 Standard_Real anAlt = 0.;
590 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
591 //GeomAbs_Intersection; //GeomAbs_Arc;
592 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
593 aMakeOffset.AddWire(theWire);
595 aMakeOffset.Perform(anOffset, anAlt);
597 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
598 DBRep::Set("offset", theOffsetShapePos);
603 #include<BRepAlgoAPI_Cut.hxx>
605 #include<BRepPrimAPI_MakeHalfSpace.hxx>
606 #include<Geom_CartesianPoint.hxx>
607 #include<AIS_Point.hxx>
609 #include <BRepBuilderAPI_MakeEdge.hxx>
610 #include <BRepBuilderAPI_MakeWire.hxx>
611 #include <BRepBuilderAPI_MakeFace.hxx>
613 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
616 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
617 if (myAISContext.IsNull()) {
618 di << "use 'vinit' command before " << argv[0] << "\n";
622 gp_Pnt pt1_(250., 250., 0.);
623 gp_Pnt pt2_(-250., 250., 0.);
624 gp_Pnt pt3_(-250., -250., 0.);
625 gp_Pnt pt4_(250., -250., 0.);
626 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
627 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
628 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
629 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
631 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
632 BRepBuilderAPI_MakeFace face_(wire_);
633 TopoDS_Face sh_ = face_.Face();
639 g_pnt = gp_Pnt(0, 0, -100);
641 g_pnt = gp_Pnt(0, 0, 100);
643 myAISContext->EraseAll(Standard_False);
644 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
645 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
646 myAISContext->Display(AISPoint, Standard_True);
648 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
649 TopoDS_Solid sol1_ = half_.Solid();
651 DBRep::Set("Face", sol1_);
653 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
655 Standard_Real x = 0., y = 0., z = -80.;
657 BRepPrimAPI_MakeBox box(gp_Pnt(x, y, z), gp_Pnt(x + 150, y + 200, z + 200));
659 DBRep::Set("Box", box.Shape());
665 #include<GProp_GProps.hxx>
666 #include<BRepGProp.hxx>
668 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
673 di <<"Usage : " << argv[0] << " file\n";
676 Standard_CString file = argv[1];
678 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
679 if(myAISContext.IsNull()) {
680 di << "use 'vinit' command before " << argv[0] << "\n";
685 BRep_Builder builder;
686 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
687 BRepTools::Read(sh, file, builder);
690 builder.MakeWire(wire);
692 TopoDS_Vertex vt1, vt2;
693 TopExp_Explorer wex(sh, TopAbs_EDGE);
694 for(;wex.More();wex.Next())
696 ed = TopoDS::Edge(wex.Current());
697 TopExp::Vertices(ed, vt1, vt2);
698 builder.UpdateVertex(vt1, 0.01);
699 builder.UpdateVertex(vt2, 0.01);
700 builder.UpdateEdge(ed, 0.01);
701 builder.Add(wire, ed);
705 BRepGProp::LinearProperties(ed, lprop);
706 printf("\n length = %f", lprop.Mass());
708 DBRep::Set("Wire",wire);
709 // Handle(AIS_Shape) res = new AIS_Shape( wire );
710 // aContext->SetColor( res, Quantity_NOC_RED );
711 // aContext->Display( res );
713 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
714 // off.Perform(0.5, 0);
716 // printf("\n IsDone = %d", off.IsDone());
718 // res = new AIS_Shape( sh );
719 // aContext->SetColor( res, Quantity_NOC_GREEN );
720 // aContext->Display( res );
726 static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
729 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
730 if(myAISContext.IsNull()) {
731 di << "use 'vinit' command before " << argv[0];
735 BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
736 Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
737 myAISContext->SetAutoActivateSelection (Standard_False);
738 myAISContext->Display(anAISBox, 1);
740 TColStd_ListOfInteger anActivatedModes;
741 myAISContext->ActivatedModes (anAISBox, anActivatedModes);
742 if(anActivatedModes.Extent() != 1 || anActivatedModes.First() != -1 )
748 #include <TDocStd_Document.hxx>
749 #include <DDocStd.hxx>
750 #include <PCDM_StoreStatus.hxx>
751 #include <TDocStd_Application.hxx>
753 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
756 di << "Usage: " << a[0] << " Doc\n";
760 Handle(TDocStd_Document) D;
761 if (!DDocStd::GetDocument(a[1],D)) return 1;
763 Handle(TDocStd_Application) A = DDocStd::GetApplication();
765 TCollection_ExtendedString theStatusMessage;
767 di << "this document has never been saved\n";
770 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
771 if (theStatus != PCDM_SS_OK ) {
772 switch ( theStatus ) {
773 case PCDM_SS_DriverFailure: {
774 di << "Error saving document: Could not store , no driver found to make it\n";
777 case PCDM_SS_WriteFailure: {
778 di << "Error saving document: Write access failure\n";
781 case PCDM_SS_Failure: {
782 di << "Error saving document: Write failure\n" ;
785 case PCDM_SS_Doc_IsNull: {
786 di << "Error saving document: No document to save\n";
789 case PCDM_SS_No_Obj: {
790 di << "Error saving document: No objects written\n";
793 case PCDM_SS_Info_Section_Error: {
794 di << "Error saving document: Write info section failure\n" ;
805 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
808 di << "Usage: " << a[0] << " Doc Path\n";
812 Handle(TDocStd_Document) D;
813 if (!DDocStd::GetDocument(a[1],D)) return 1;
815 TCollection_ExtendedString path (a[2]);
816 Handle(TDocStd_Application) A = DDocStd::GetApplication();
818 TCollection_ExtendedString theStatusMessage;
819 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
820 if (theStatus != PCDM_SS_OK ) {
821 switch ( theStatus ) {
822 case PCDM_SS_DriverFailure: {
823 di << "Error saving document: Could not store , no driver found to make it\n";
826 case PCDM_SS_WriteFailure: {
827 di << "Error saving document: Write access failure\n";
830 case PCDM_SS_Failure: {
831 di << "Error saving document: Write failure\n" ;
834 case PCDM_SS_Doc_IsNull: {
835 di << "Error saving document: No document to save\n";
838 case PCDM_SS_No_Obj: {
839 di << "Error saving document: No objects written\n";
842 case PCDM_SS_Info_Section_Error: {
843 di << "Error saving document: Write info section failure\n" ;
855 #include <BRepClass3d_SolidClassifier.hxx>
857 Standard_Integer OCC299bug (Draw_Interpretor& theDi,
858 Standard_Integer theArgNb,
859 const char** theArgVec)
863 theDi << "Usage : " << theArgVec[0] << " Solid Point [Tolerance=1.e-7]\n";
867 TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
870 theDi << " Null Shape is not allowed here\n";
873 else if (aS.ShapeType() != TopAbs_SOLID)
875 theDi << " Shape type must be SOLID\n";
879 gp_Pnt aP (8., 9., 10.);
880 if (!DrawTrSurf::GetPoint (theArgVec[2], aP))
882 theDi << " Null Point is not allowed here\n";
885 const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : 1.e-7;
887 BRepClass3d_SolidClassifier aSC (aS);
888 aSC.Perform (aP, aTol);
892 case TopAbs_IN: theDi << "The point is IN shape\n"; return 0;
893 case TopAbs_OUT: theDi << "The point is OUT of shape\n"; return 0;
894 case TopAbs_ON: theDi << "The point is ON shape\n"; return 0;
896 default: theDi << "The point is UNKNOWN shape\n"; return 0;
900 #include <OSD_Process.hxx>
901 #include <OSD_Path.hxx>
903 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
906 di << "Usage: " << a[0] << "\n";
910 OSD_Path d = p.CurrentDirectory();
911 TCollection_AsciiString s;
913 di << "*" << s.ToCString() << "*\n";
916 di << "*" << s.ToCString() << "*\n";
920 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
923 di << "Usage: " << a[0] << "\n";
926 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
927 di << p.Trek().ToCString() << "\n";
929 di << p.Trek().ToCString() << "\n";
933 #include <BRepAlgoAPI_Fuse.hxx>
934 #include <BRepAlgoAPI_Common.hxx>
936 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
939 di << "Usage : " << a[0] << "\n";
943 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
944 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
946 TopoDS_Shape shape1 = box1.Shape();
947 TopoDS_Shape shape2 = box2.Shape();
949 TopoDS_Shape fuse,comm;
950 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )\n";
951 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )\n";
952 fuse = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
953 comm = BRepAlgoAPI_Common(shape1, shape2).Shape();
958 #include <DDocStd_DrawDocument.hxx>
959 #include <TDataStd_Name.hxx>
961 #include <XCAFDoc_ShapeTool.hxx>
962 #include <XCAFDoc_DocumentTool.hxx>
963 #include <TDF_LabelSequence.hxx>
964 #include <TPrsStd_AISPresentation.hxx>
965 #include <TDF_Data.hxx>
966 #include <TDF_Label.hxx>
967 #include <XCAFPrs_Driver.hxx>
969 //------------------------------------------------------------------------------------------
972 //------------------------------------------------------------------------------------------
973 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
978 // 1. Verufy amount of arguments
979 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
981 // 2. Retrieve DDocStd application
982 Handle(TDocStd_Application) App = DDocStd::GetApplication();
985 TCollection_ExtendedString name(argv[2]);
986 Handle(TDocStd_Document) Doc;
987 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
988 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
989 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
990 Draw::Set(argv[1],DD);
992 // 4. Create prsentations
993 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
994 TDF_LabelSequence seq;
995 shapes->GetFreeShapes ( seq );
996 Handle(TPrsStd_AISPresentation) prs;
997 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
998 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
999 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
1001 catch(Standard_Failure const&) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
1003 di << "OCC363 OK\n";
1008 ////======================================================================================
1009 //// Function : OCC372
1011 ////======================================================================================
1012 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1016 // OCC_CATCH_SIGNALS
1017 // // 1. Verufy amount of arguments
1018 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
1022 // TopoDS_Shape Ref;
1023 // BRepTools::Read(Ref, argv[1], B);
1025 // // 3. Calculate location of aP3d in relation to the solid
1026 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
1027 // BRepClass3d_SolidClassifier SC(Ref);
1028 // SC.Perform(aP3d, 1e-7);
1030 // // 4. Check returned state. The point must be inside the solid.
1031 // TopAbs_State aState=SC.State();
1035 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
1038 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
1041 // di<<"OCC372 OK. aState = TopAbs_IN" ;
1044 // di<<"OCC372 FAULTY. aState = UNKNOWN";
1048 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
1053 #include <BRepTopAdaptor_FClass2d.hxx>
1055 //======================================================================================
1056 // Function : OCC377
1058 //======================================================================================
1059 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1064 // 1. Verify validity of arguments
1065 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
1067 // 2. Initialize parameters
1069 p2d.SetX ( Draw::Atof(argv[2]) );
1070 p2d.SetY ( Draw::Atof(argv[3]) );
1071 Standard_Real precuv = Draw::Atof (argv[4] );
1076 BRepTools::Read ( Shape, argv[1], B );
1078 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1079 TopExp_Explorer exp;
1080 Standard_Integer i=1;
1081 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1083 // 4.1. Verify whether enrtry point is on wire
1084 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1085 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1087 TopAbs_Orientation orWire = wir.Orientation();
1088 newFace.Orientation(TopAbs_FORWARD);
1091 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1092 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1093 //di << "Wire " << i << ": Infinite point is " <<
1094 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1096 TCollection_AsciiString TmpString;
1097 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1098 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1100 stat1 = FClass2d1.Perform(p2d);
1101 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1102 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1105 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1106 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1108 // 4.2. Verify whether enrtry point is on reversed wire
1109 newFace = TopoDS::Face(Shape.EmptyCopied());
1110 newFace.Orientation(TopAbs_FORWARD);
1111 orWire = TopAbs::Reverse(orWire);
1112 B.Add(newFace,wir.Oriented(orWire));
1113 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1114 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1115 //di << "Reversed Wire " << i << ": Infinite point is " <<
1116 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1119 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1120 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1122 stat2 = FClass2d2.Perform(p2d);
1123 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1124 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1127 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1128 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1130 // 4.3. Compare results (they must be same)
1131 if(stat1 ==stat2) di << "OCC377 OK\n";
1132 else {di << "OCC377 FAULTY\n"; return 0;}
1135 catch(Standard_Failure const&)
1137 di << "OCC377 Exception";
1143 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1144 #include <ShapeBuild_ReShape.hxx>
1146 //=======================================================================
1149 //=======================================================================
1150 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1155 // 1. Verify arguments of the command
1156 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1158 Standard_Boolean aConsiderLocation;
1159 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1160 else aConsiderLocation = Standard_True;
1162 // 2. Iniitialize aShapeUpgrade
1163 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1165 aShapeUpgrade.SetPrecision (Precision::Confusion());
1167 aShapeUpgrade.SetMaxTolerance(0.1);
1168 // subshapes to be divided
1169 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1170 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1171 aShapeUpgrade.Init(aSubShapesToBeDivided);
1173 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1174 aShapeUpgrade.SetContext(aReshape);
1175 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1177 // 3. Perform splitting
1178 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1179 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1180 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1182 // 4. Perform rebuilding shape
1183 // 4.1. Retrieve Shape
1184 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1185 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1186 // 4.2 Rebuid retrieved shape
1187 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1188 // 4.3. Create result Draw shape
1189 DBRep::Set(argv[1], aResultShape);
1191 catch (Standard_Failure const&) {di << "OCC22 Exception \n" ;return 0;}
1197 #include <ShapeProcess_OperLibrary.hxx>
1198 #include <ShapeProcess_ShapeContext.hxx>
1199 #include <ShapeProcess.hxx>
1201 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1202 #include <BRepMesh_IncrementalMesh.hxx>
1203 #include <IMeshTools_Parameters.hxx>
1205 //=======================================================================
1208 //=======================================================================
1209 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1214 // 1. Verify amount of arguments of the command
1215 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1217 // 2. Retrieve parameters
1219 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1220 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1221 // compound of subshapes
1222 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1223 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1224 // name of resource file
1225 const char* aResourceFile = argv[4];
1226 // name of sequence from resource file to be executed
1227 const char* aSequenceName = argv[5];
1229 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1230 ShapeProcess_OperLibrary::Init();
1231 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1232 aShapeContext->SetDetalisation (TopAbs_EDGE);
1233 ShapeProcess::Perform (aShapeContext, aSequenceName);
1235 // 4. Rebuild initil shape in accordance with performed operation
1236 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1237 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1238 for (; anIter.More(); anIter.Next())
1239 aReshape->Replace(anIter.Key(), anIter.Value());
1240 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1242 // 5 Create resultant Draw shape
1243 DBRep::Set(argv[1], aResultShape);
1246 catch (Standard_Failure const&) {di << "OCC24 Exception \n" ;return 0;}
1251 //=======================================================================
1253 //purpose : Verify whether exception occurs during building mesh
1254 //=======================================================================
1255 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1260 // 1. Verify amount of arguments of the command
1261 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1263 // 2. Retrieve shape
1264 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1265 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1268 IMeshTools_Parameters aMeshParams;
1269 aMeshParams.Relative = Standard_True;
1270 aMeshParams.Deflection = 0.2;
1271 aMeshParams.Angle = M_PI / 6.0;
1272 BRepMesh_IncrementalMesh aMesh(aShape, aMeshParams);
1275 catch (Standard_Failure const&) {di << "OCC369 Exception \n" ;return 0;}
1277 di << "OCC369 OK \n";
1281 #include <math_Vector.hxx>
1282 #include <math_Matrix.hxx>
1283 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1286 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1289 Standard_Integer LowerVector = Draw::Atoi(argv[1]);
1290 Standard_Integer UpperVector = Draw::Atoi(argv[2]);
1291 Standard_Real InitialValueVector = Draw::Atof(argv[3]);
1292 Standard_Integer LowerRowMatrix = Draw::Atoi(argv[4]);
1293 Standard_Integer UpperRowMatrix = Draw::Atoi(argv[5]);
1294 Standard_Integer LowerColMatrix = Draw::Atoi(argv[6]);
1295 Standard_Integer UpperColMatrix = Draw::Atoi(argv[7]);
1296 Standard_Real InitialValueMatrix = Draw::Atof(argv[8]);
1298 math_Vector Vector1(LowerVector, UpperVector);
1299 math_Vector Vector2(LowerVector, UpperVector);
1301 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1302 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1304 //Vector.Dump(std::cout);
1305 //std::cout<<std::endl;
1307 //Matrix.Dump(std::cout);
1308 //std::cout<<std::endl;
1310 Vector1.Multiply(Vector, Matrix);
1312 //Vector1.Dump(std::cout);
1313 Standard_SStream aSStream1;
1314 Vector1.Dump(aSStream1);
1318 if (Matrix.RowNumber() > 1) {
1319 Matrix(Matrix.LowerRow() + 1, Matrix.LowerCol()) += 1.;
1321 Vector2.TMultiply(Vector, Matrix);
1323 //Vector2.Dump(std::cout);
1324 Standard_SStream aSStream2;
1325 Vector2.Dump(aSStream2);
1332 #include <GeomPlate_BuildPlateSurface.hxx>
1333 //=======================================================================
1336 //=======================================================================
1337 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1339 GeomPlate_BuildPlateSurface aBuilder;
1342 if (aBuilder.IsDone())
1344 di << "Error in OCC525. Null result is expected.\n";
1348 di << "OCC525 OK \n";
1354 #include <BRepPrimAPI_MakeWedge.hxx>
1355 #include <gce_MakeRotation.hxx>
1356 #include <gce_MakeTranslation.hxx>
1357 #include <BRepBuilderAPI_Transform.hxx>
1358 #include <BRepPrimAPI_MakeWedge.hxx>
1359 //=======================================================================
1362 //=======================================================================
1363 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1366 di << "Usage : " << argv[0] << " shape1 shape2 shape3\n";
1371 double xperiod = 1.0;
1372 double yperiod = 1.0;
1373 double sub_thick = 0.5;
1376 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1377 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1379 // --------------------------------------------------------------------
1382 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1383 // 0.1, 0.1 , 0.4, 0.4 );
1384 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1385 0.1, 0.1 , 0.4, 0.4 ).Shape();
1387 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1388 gp_Dir(1.0,0.0,0.0),
1391 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1392 gp_Pnt( 0.25, 0.25, 0.5)
1395 rotate.PreMultiply( translate );
1397 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1399 if (wedge1a.IsNull()) {
1400 di<<" Null shape1 is not allowed\n";
1403 DBRep::Set(argv[1], wedge1a);
1405 // --------------------------------------------------------------------
1408 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1409 // 0.1, 0.1 , 0.4, 0.4 );
1410 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1411 0.1, 0.1 , 0.4, 0.4 ).Shape();
1413 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1414 gp_Dir(1.0,0.0,0.0),
1417 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1418 gp_Pnt( 0.25, 0.25, 0.5)
1421 rotate2.PreMultiply( translate2 );
1423 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1425 if (wedge2a.IsNull()) {
1426 di<<" Null shape2 is not allowed\n";
1429 DBRep::Set(argv[2], wedge2a);
1433 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)\n";
1434 TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a).Shape();
1436 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)\n";
1437 TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common).Shape();
1439 if (sub_etch1.IsNull()) {
1440 di<<" Null shape3 is not allowed\n";
1443 DBRep::Set(argv[3], sub_etch1);
1448 #include <Standard_GUID.hxx>
1449 //=======================================================================
1452 //=======================================================================
1453 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1456 di<<"Usage : " << argv[0] << " GUID\n";
1459 Standard_GUID guid(argv[1]);
1460 //guid.ShallowDump(std::cout);
1461 Standard_SStream aSStream;
1462 guid.ShallowDump(aSStream);
1468 #include <XCAFDoc.hxx>
1469 //=======================================================================
1470 //function : OCC738_ShapeRef
1472 //=======================================================================
1473 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1476 di<<"Usage : " << argv[0] << "\n";
1479 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1480 //guid.ShallowDump(std::cout);
1481 Standard_SStream aSStream;
1482 guid.ShallowDump(aSStream);
1487 //=======================================================================
1488 //function : OCC738_Assembly
1490 //=======================================================================
1491 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1494 di<<"Usage : " << argv[0] << "\n";
1497 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1498 //guid.ShallowDump(std::cout);
1499 Standard_SStream aSStream;
1500 guid.ShallowDump(aSStream);
1505 #if defined(DDataStd_def01)
1506 #include <DDataStd_DrawPresentation.hxx>
1507 //=======================================================================
1508 //function : OCC739_DrawPresentation
1510 //=======================================================================
1511 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1514 di<<"Usage : " << argv[0] << "\n";
1517 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1518 //guid.ShallowDump(std::cout);
1519 Standard_SStream aSStream;
1520 guid.ShallowDump(aSStream);
1526 //=======================================================================
1529 //=======================================================================
1530 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1532 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1533 if(aContext.IsNull()) {
1534 di << argv[0] << "ERROR : use 'vinit' command before \n";
1539 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation\n";
1543 Standard_Boolean updateviewer = Standard_True;
1545 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1547 TCollection_AsciiString aName(argv[1]);
1548 Handle(AIS_InteractiveObject) AISObj;
1550 if (!aMap.Find2 (aName, AISObj)
1553 di << "Use 'vdisplay' before\n";
1557 AISObj->ResetTransformation();
1559 aContext->Erase(AISObj, updateviewer);
1560 aContext->UpdateCurrentViewer();
1561 aContext->Display(AISObj, updateviewer);
1562 aContext->UpdateCurrentViewer();
1566 //=======================================================================
1569 //=======================================================================
1570 #include <TColStd_Array2OfInteger.hxx>
1571 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1574 di<<"Usage : " << argv[0] << "\n";
1578 // check that exception initialized without message string can be safely handled and printed
1580 throw Standard_OutOfRange();
1582 catch (Standard_Failure const& anException) {
1583 std::cout << "Caught successfully: ";
1584 std::cout << anException << std::endl;
1589 #include <GeomAPI_ProjectPointOnSurf.hxx>
1590 //=======================================================================
1593 //=======================================================================
1594 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1598 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1603 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1604 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1605 Standard_Real Umin=Draw::Atof(argv[3]);
1606 Standard_Real Usup=Draw::Atof(argv[4]);
1607 Standard_Real Vmin=Draw::Atof(argv[5]);
1608 Standard_Real Vsup=Draw::Atof(argv[6]);
1610 if (aSurface.IsNull()) {
1611 di << argv[2] << " Null surface \n" ;
1615 GeomAPI_ProjectPointOnSurf PonSurf;
1616 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1617 PonSurf.Perform(aPoint3d);
1622 //=======================================================================
1625 //=======================================================================
1626 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1630 di<<"Usage : " << argv[0] << " wire face\n";
1634 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1635 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1636 if (awire.IsNull() || aface.IsNull()) {
1637 di << "Null object\n";
1641 Standard_Integer count = 0;
1642 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1644 BRepTools_WireExplorer WE;
1645 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1646 TopoDS_Edge E = WE.Current();
1650 di << "Count = " << count << "\n";
1655 //=======================================================================
1658 //=======================================================================
1659 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1663 di <<"Usage : " << argv[0] << " face\n";
1666 Standard_Real u1, u2, v1, v2;
1667 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1670 BRepTools::UVBounds(F, u1, u2, v1, v2);
1671 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1675 #include <Expr_NamedUnknown.hxx>
1676 #include <Expr_GeneralExpression.hxx>
1677 #include <Expr_Exponential.hxx>
1678 #include <ExprIntrp_GenExp.hxx>
1679 //=======================================================================
1682 //=======================================================================
1683 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1687 di <<"Usage : " << argv[0] << " expression\n";
1691 TCollection_AsciiString anExpStr(argv[1]);
1692 anExpStr.AssignCat("*x");
1693 anExpStr.Prepend("Exp(");
1694 anExpStr.AssignCat(")");
1696 Handle(ExprIntrp_GenExp) exprIntrp = ExprIntrp_GenExp::Create();
1699 // Create the expression
1700 exprIntrp->Process(anExpStr);
1702 if (!exprIntrp->IsDone())
1704 di << "Interpretation of expression " << argv[1] << " failed\n";
1709 Handle(Expr_GeneralExpression) anExpr = exprIntrp->Expression();
1710 Handle(Expr_NamedUnknown) aVar = new Expr_NamedUnknown("x");
1711 Handle (Expr_GeneralExpression) newExpr = anExpr->Derivative(aVar);
1714 TCollection_AsciiString res = newExpr->String();
1715 Standard_CString resStr = res.ToCString();
1716 TCollection_AsciiString res_old = anExpr->String();
1717 Standard_CString res_oldStr = res_old.ToCString();
1720 di << "X = " << argv[1] << "\n";
1721 di << "Y = " << res_oldStr << "\n";
1722 di << "Y' = " << resStr << "\n";
1728 #include <TPrsStd_AISViewer.hxx>
1729 #include <TDF_Label.hxx>
1730 #include <TPrsStd_AISPresentation.hxx>
1731 //=======================================================================
1732 //function : OCC1029_AISTransparency
1733 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1734 //=======================================================================
1736 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1737 Standard_Integer nb,
1741 Handle(TDocStd_Document) D;
1742 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1744 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1746 Handle(TPrsStd_AISViewer) viewer;
1747 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1749 Handle(TPrsStd_AISPresentation) prs;
1750 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1752 prs->SetTransparency(Draw::Atof(arg[3]));
1753 TPrsStd_AISViewer::Update(L);
1756 di << "Transparency = " << prs->Transparency() << "\n";
1761 di << arg[0] << " : Error\n";
1765 //=======================================================================
1766 //function : OCC1031_AISMaterial
1767 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
1768 //=======================================================================
1770 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
1771 Standard_Integer nb,
1775 Handle(TDocStd_Document) D;
1776 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1778 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1780 Handle(TPrsStd_AISViewer) viewer;
1781 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1783 Handle(TPrsStd_AISPresentation) prs;
1784 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1786 prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3]));
1787 TPrsStd_AISViewer::Update(L);
1790 di << "Material = " << prs->Material() << "\n";
1795 di << arg[0] << " : Error\n";
1799 //=======================================================================
1800 //function : OCC1032_AISWidth
1801 //purpose : OCC1032_AISWidth (DOC,entry,[width])
1802 //=======================================================================
1804 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
1805 Standard_Integer nb,
1809 Handle(TDocStd_Document) D;
1810 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1812 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1814 Handle(TPrsStd_AISViewer) viewer;
1815 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1817 Handle(TPrsStd_AISPresentation) prs;
1818 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1820 prs->SetWidth(Draw::Atof(arg[3]));
1821 TPrsStd_AISViewer::Update(L);
1824 di << "Width = " << prs->Width() << "\n";
1829 di << arg[0] << " : Error\n";
1833 //=======================================================================
1834 //function : OCC1033_AISMode
1835 //purpose : OCC1033_AISMode (DOC,entry,[mode])
1836 //=======================================================================
1838 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
1839 Standard_Integer nb,
1843 Handle(TDocStd_Document) D;
1844 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1846 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1848 Handle(TPrsStd_AISViewer) viewer;
1849 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1851 Handle(TPrsStd_AISPresentation) prs;
1852 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1854 prs->SetMode(Draw::Atoi(arg[3]));
1855 TPrsStd_AISViewer::Update(L);
1858 di << "Mode = " << prs->Mode() << "\n";
1863 di << arg[0] << " : Error\n";
1867 //=======================================================================
1868 //function : OCC1034_AISSelectionMode
1869 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
1870 //=======================================================================
1872 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
1873 Standard_Integer nb,
1877 Handle(TDocStd_Document) D;
1878 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1880 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1882 Handle(TPrsStd_AISViewer) viewer;
1883 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1885 Handle(TPrsStd_AISPresentation) prs;
1886 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1888 prs->SetSelectionMode(Draw::Atoi(arg[3]));
1889 TPrsStd_AISViewer::Update(L);
1892 di << "SelectionMode = " << prs->SelectionMode() << "\n";
1897 di << arg[0] << " : Error\n";
1901 //=======================================================================
1902 //function : OCC1487
1904 //=======================================================================
1905 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1908 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape\n";
1912 Standard_Integer CaseNumber = Draw::Atoi(argv[1]);
1914 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
1915 gp_Dir myDir(1,0,0);
1916 gp_Pnt myPnt(0,-50,140);
1917 gp_Ax2 myAx2(myPnt, myDir);
1918 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
1920 TopoDS_Shape cyl1 = o_mc1.Shape();
1923 TopoDS_Shape o_cut_shape;
1924 if (CaseNumber == 1) {
1925 //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);
1926 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
1927 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
1928 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
1929 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
1931 cyl2 = o_mc2.Shape();
1932 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
1933 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
1935 //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);
1936 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
1937 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
1938 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
1939 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
1941 cyl2 = o_mc2.Shape();
1942 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
1943 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
1946 DBRep::Set(argv[2],cyl1);
1947 DBRep::Set(argv[3],cyl2);
1948 DBRep::Set(argv[4],o_cut_shape);
1953 #include<TopTools_ListIteratorOfListOfShape.hxx>
1954 #include<BRepFilletAPI_MakeFillet.hxx>
1955 //=======================================================================
1956 //function : OCC1077
1958 //=======================================================================
1959 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
1961 Standard_Real t3d = 1.e-4;
1962 Standard_Real t2d = 1.e-5;
1963 Standard_Real ta = 1.e-2;
1964 Standard_Real fl = 1.e-3;
1965 Standard_Real tapp_angle = 1.e-2;
1966 GeomAbs_Shape blend_cont = GeomAbs_C1;
1968 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
1970 TopTools_ListIteratorOfListOfShape its;
1972 TopoDS_Compound result;
1974 B.MakeCompound(result);
1977 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
1979 const TopoDS_Shape& cutsol = ex.Current();
1981 BRepFilletAPI_MakeFillet fill(cutsol);
1982 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
1983 fill.SetContinuity(blend_cont, tapp_angle);
1984 its = aBoolenaOperation.SectionEdges();
1987 TopoDS_Edge E = TopoDS::Edge(its.Value());
1988 fill.Add(aRadius, E);
1995 B.Add(result, fill.Shape());
1999 B.Add(result, cutsol);
2005 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
2007 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
2008 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
2009 return OCC1077_boolbl(aCut,aRadius);
2012 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
2014 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
2017 TopoDS_Shape OCC1077_Bug()
2019 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
2020 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
2022 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
2023 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
2024 gp_Dir(0, 0, 1)), 3, 20).Shape();
2025 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
2026 gp_Dir(1, 0, 0)), 3, 20).Shape();
2027 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
2028 gp_Dir(0, 1, 0)), 3, 20).Shape();
2029 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
2030 Handle(ShapeFix_Shape) fixer = new ShapeFix_Shape(theTmp1);
2032 theTmp1 = fixer->Shape();
2033 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
2034 fixer->Init(theTmp2);
2036 theTmp2 = fixer->Shape();
2037 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
2038 fixer->Init(theResult);
2040 theResult = fixer->Shape();
2044 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2046 if(argc < 1 || argc > 2) {
2047 di << "Usage : " << argv[0] << " result\n";
2051 TopoDS_Shape S = OCC1077_Bug();
2052 DBRep::Set(argv[1],S);
2057 //////////////////////////////////////////////////////////////
2059 * Compute uniform distribution of points using GCPnts_UniformAbscissa
2061 //////////////////////////////////////////////////////////////
2062 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2066 di << "Usage : " << argv[0] << " name shape step\n";
2069 const char *name = argv[1];
2070 Adaptor3d_Curve *adapCurve=NULL;
2071 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
2072 if (!curve.IsNull())
2073 adapCurve = new GeomAdaptor_Curve(curve);
2076 TopoDS_Shape wire = DBRep::Get(argv[2]);
2077 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2079 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected\n";
2082 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2084 double step = Draw::Atof(argv[3]);
2085 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2089 di << argv[0] <<" : fail\n";
2094 int i, np = aUni.NbPoints();
2095 for (i=0; i < np; i++)
2097 double par = aUni.Parameter(i+1);
2098 gp_Pnt p = adapCurve->Value(par);
2099 char n[20], *pname=n;
2100 Sprintf(n,"%s_%d",name,i+1);
2101 DrawTrSurf::Set(pname,p);
2110 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2114 di << "Usage : " << argv[0] << " nb_of_vectors size\n";
2118 Standard_Integer nb = Draw::Atoi(argv[1]);
2119 Standard_Integer sz = Draw::Atoi(argv[2]);
2120 Standard_Real val = 10;
2121 math_Vector **pv = new math_Vector *[nb];
2123 di<<"creating "<<nb<<" vectors "<<sz<<" elements each...\n";
2125 for (i=0; i < nb; i++) {
2126 pv[i] = new math_Vector (1, sz, val);
2127 if ((i % (nb/10)) == 0) {
2129 //std::cout.flush();
2134 di<<"deleting them ...\n";
2135 for (i=0; i < nb; i++) {
2137 if ((i % (nb/10)) == 0) {
2139 //std::cout.flush();
2150 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2154 di << "Usage : " << argv[0] << " wire\n";
2157 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2160 TopoDS_Wire wire = TopoDS::Wire(shape);
2161 // create curve parameterised by curvilinear distance
2162 BRepAdaptor_CompCurve curve(wire,Standard_True);
2163 Standard_Real length = curve.LastParameter();
2164 Standard_Real need_length = length/2;
2166 curve.D0(need_length,pnt);
2167 // create check_curve parameterised in a general way
2168 BRepAdaptor_CompCurve check_curve(wire);
2169 Standard_Real check_par =
2170 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2172 check_curve.D0(check_par,check_pnt);
2173 // check that points are coinsiding
2174 Standard_Real error_dist = pnt.Distance(check_pnt);
2175 if (error_dist > Precision::Confusion()) {
2176 //std::cout.precision(3);
2177 di<<"error_dist = "<<error_dist<<
2178 " ( "<<error_dist/need_length*100<<" %)\n";
2185 // stack overflow can be successfully handled only on 32-bit Windows
2186 #if defined(_WIN32) && !defined(_WIN64)
2187 static int StackOverflow (int i = -1)
2190 memset (arr, 0, sizeof(arr));
2197 // this code does not work with optimize mode on Windows
2198 #if defined(_MSC_VER) && !defined(__clang__)
2199 #pragma optimize( "", off )
2201 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2205 std::cout << "Usage : " << argv[0] << "\n";
2208 Standard_Boolean Succes;
2210 Succes = Standard_True;
2213 {//==== Test Divide ByZero (Integer) ========================================
2216 std::cout << "(Integer) Divide By Zero..." << std::endl;
2217 di << "(Integer) Divide By Zero...";
2218 //std::cout.flush();
2220 Standard_Integer res, a =4, b = 0 ;
2222 di << "Error: 4 / 0 = " << res << " - no exception is raised!\n";
2223 Succes = Standard_False;
2225 #if defined(SOLARIS) || defined(_WIN32)
2226 catch(Standard_DivideByZero const&)
2228 catch(Standard_NumericError const&)
2231 di << "Caught, OK\n";
2233 catch(Standard_Failure const& anException) {
2235 di << anException.GetMessageString();
2237 Succes = Standard_False;
2239 // this case tests if (...) supersedes (Standard_*),
2240 // the normal behaviour is not
2242 di<<" unknown exception... (But) Ok\n";
2246 {//==== Test Divide ByZero (Real) ===========================================
2249 std::cout << "(Real) Divide By Zero..." << std::endl;
2250 di << "(Real) Divide By Zero...";
2251 //std::cout.flush();
2253 Standard_Real res, a= 4.0, b=0.0;
2255 di << "Error: 4.0 / 0.0 = " << res << " - no exception is raised!\n";
2256 Succes = Standard_False;
2258 catch(Standard_DivideByZero const&) // Solaris, Windows w/o SSE2
2260 di << "Caught, OK\n";
2262 catch(Standard_NumericError const&) // Linux, Windows with SSE2
2264 di << "Caught, OK\n";
2266 catch(Standard_Failure const& anException) {
2267 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2269 di << anException.GetMessageString();
2271 Succes = Standard_False;
2275 {//==== Test Overflow (Integer) =============================================
2278 std::cout << "(Integer) Overflow..." << std::endl;
2279 di << "(Integer) Overflow...";
2280 //std::cout.flush();
2282 Standard_Integer res, i=IntegerLast();
2284 //++++ std::cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< std::endl;
2285 //++++ Succes = Standard_False;
2286 di << "Not caught: " << i << " + 1 = " << res << ", still OK\n";
2288 catch(Standard_Overflow const&) {
2289 di << "Caught, OK\n";
2291 catch(Standard_Failure const& anException) {
2292 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2294 di << anException.GetMessageString();
2296 Succes = Standard_False;
2300 {//==== Test Overflow (Real) ================================================
2303 std::cout << "(Real) Overflow..." << std::endl;
2304 di << "(Real) Overflow...";
2305 //std::cout.flush();
2307 Standard_Real res, r=RealLast();
2310 (void)sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2312 di << "Error: " << r << "*" << r << " = " << res << " - no exception is raised!\n";
2313 Succes = Standard_False;
2315 catch(Standard_Overflow const&) // Solaris, Windows w/o SSE2
2317 di << "Caught, OK\n";
2319 catch(Standard_NumericError const&) // Linux, Windows with SSE2
2321 di << "Caught, OK\n";
2323 catch(Standard_Failure const& anException) {
2324 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2326 di << anException.GetMessageString();
2328 Succes = Standard_False;
2332 {//==== Test Underflow (Real) ===============================================
2335 std::cout << "(Real) Underflow" << std::endl; // to have message in log even if process crashed
2336 di << "(Real) Underflow";
2337 //std::cout.flush();
2339 Standard_Real res, r = RealSmall();
2342 //++++ std::cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<std::endl;
2343 //++++ Succes = Standard_False;
2344 di << "Not caught: " << r << "*" << r << " = " << res << ", still OK\n";
2346 catch(Standard_Underflow const&) // could be on Solaris, Windows w/o SSE2
2348 di << "Exception caught, KO\n";
2349 Succes = Standard_False;
2351 catch(Standard_NumericError const&) // could be on Linux, Windows with SSE2
2353 di << "Exception caught, KO\n";
2354 Succes = Standard_False;
2356 catch(Standard_Failure const& anException) {
2357 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2359 di << anException.GetMessageString();
2361 Succes = Standard_False;
2365 {//==== Test Invalid Operation (Real) ===============================================
2368 std::cout << "(Real) Invalid Operation..." << std::endl;
2369 di << "(Real) Invalid Operation...";
2370 //std::cout.flush();
2372 Standard_Real res, r=-1;
2374 di << "Error: swrt(-1) = " << res << " - no exception is raised!\n";
2375 Succes = Standard_False;
2377 catch(Standard_NumericError const&) {
2378 di << "Caught, OK\n";
2380 catch(Standard_Failure const& anException) {
2381 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2383 di << anException.GetMessageString();
2385 Succes = Standard_False;
2389 {//==== Test Access Violation ===============================================
2392 std::cout << "Segmentation Fault..." << std::endl;
2393 di << "Segmentation Fault...";
2394 //std::cout.flush();
2398 di << "Error: writing by NULL address - no exception is raised!\n";
2399 Succes = Standard_False;
2402 catch(OSD_Exception_ACCESS_VIOLATION const&)
2404 catch(OSD_SIGSEGV const&)
2407 di << "Caught, OK\n";
2408 } catch(Standard_Failure const& anException) {
2409 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2411 di << anException.GetMessageString();
2413 Succes = Standard_False;
2417 #if defined(_WIN32) && !defined(_WIN64)
2418 {//==== Test Stack Overflow ===============================================
2421 std::cout << "Stack Overflow..." << std::endl;
2422 di << "Stack Overflow...";
2423 //std::cout.flush();
2426 di << "Error - no exception is raised!\n";
2427 Succes = Standard_False;
2429 catch(OSD_Exception_STACK_OVERFLOW const&) {
2430 di << "Caught, OK\n";
2432 catch(Standard_Failure const& anException) {
2433 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2435 di << anException.GetMessageString();
2437 Succes = Standard_False;
2443 di << "TestExcept: Successfull completion\n";
2445 di << "TestExcept: failure\n";
2451 //! Auxiliary functor.
2452 struct TestParallelFunctor
2454 TestParallelFunctor() : myNbNotRaised (0), myNbSigSegv (0), myNbUnknown (0) {}
2456 Standard_Integer NbNotRaised() const { return myNbNotRaised; }
2457 Standard_Integer NbSigSegv() const { return myNbSigSegv; }
2458 Standard_Integer NbUnknown() const { return myNbUnknown; }
2460 void operator() (int theThreadId, int theTaskId) const
2465 // Test Access Violation
2471 Standard_Atomic_Increment (&myNbNotRaised);
2474 catch (OSD_Exception_ACCESS_VIOLATION const&)
2476 catch (OSD_SIGSEGV const&)
2479 Standard_Atomic_Increment (&myNbSigSegv);
2481 catch (Standard_Failure const& )
2483 Standard_Atomic_Increment (&myNbUnknown);
2488 mutable volatile Standard_Integer myNbNotRaised;
2489 mutable volatile Standard_Integer myNbSigSegv;
2490 mutable volatile Standard_Integer myNbUnknown;
2493 static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** )
2497 std::cout << "Syntax error: wrong number of arguments\n";
2501 Handle(OSD_ThreadPool) aPool = new OSD_ThreadPool (4);
2502 OSD_ThreadPool::Launcher aLauncher (*aPool, 4);
2503 TestParallelFunctor aFunctor;
2504 aLauncher.Perform (0, 100, aFunctor);
2505 theDI << "NbRaised: " << (aFunctor.NbSigSegv() + aFunctor.NbUnknown()) << "\n"
2506 << "NbNotRaised: " << aFunctor.NbNotRaised() << "\n"
2507 << "NbSigSeg: " << aFunctor.NbSigSegv() << "\n"
2508 << "NbUnknown: " << aFunctor.NbUnknown() << "\n";
2512 #if defined(_MSC_VER) && !defined(__clang__)
2513 #pragma optimize( "", on )
2516 static TopoDS_Compound AddTestStructure(int nCount_)
2522 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2523 for (int i=0; i<nCount; i++) {
2524 for (int j=0; j<nCount; j++) {
2526 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2527 TopLoc_Location topLoc(trsf);
2528 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2529 B.Add(C, tempShape);
2535 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2537 if (argc != 2 && argc != 3)
2539 std::cout << "Usage : " << argv[0] << " [nCount] path\n";
2543 int nCount = (argc > 2 ? Draw::Atoi(argv[1]) : 10);
2544 TCollection_AsciiString aFilePath (argv[argc > 2 ? 2 : 1]);
2545 STEPCAFControl_Writer writer;
2546 Handle(TDocStd_Document) document;
2547 document = new TDocStd_Document("Pace Test-StepExporter-");
2548 Handle(XCAFDoc_ShapeTool) shapeTool;
2549 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2550 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2551 STEPControl_StepModelType mode = STEPControl_AsIs;
2552 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2553 di << "Failed to set assembly mode for step data\n\n";
2558 if( writer.Transfer(document, mode)) {
2559 writer.Write(aFilePath.ToCString());
2562 catch(OSD_Exception_STACK_OVERFLOW const&) {
2563 di << "Failed : STACK OVERFLOW\n\n";
2565 catch (Standard_Failure const& anException) {
2566 di << "Failed :\n\n";
2567 //std::cout << Standard_Failure::Caught() << std::endl;
2568 di << anException.GetMessageString();
2570 di << argv[0] << " : Finish\n";
2575 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2579 di << "Usage : " << argv[0] << "\n";
2583 // 1. Create an array of points
2584 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2585 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2586 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2587 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2588 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2589 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2591 // 2. Create a periodic bspline through these 5 points
2592 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2594 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2596 // 3. Increase degree of curve from 3 to 8
2597 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2598 Standard_CString CString1 = "BSplineCurve";
2599 DrawTrSurf::Set(CString1,bspline1);
2601 // 4. Convers BSpline curve to Bezier segments
2602 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2604 // 5. Test the result of conversion
2605 TCollection_AsciiString aRName;
2606 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2607 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2609 aRName=aRName+TCollection_AsciiString(i);
2610 Standard_CString aRNameStr = aRName.ToCString();
2611 DrawTrSurf::Set(aRNameStr,arc);
2612 di << aRNameStr << " ";
2618 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2622 di << "Usage : " << argv[0] << " edge1 edge2 plane\n";
2625 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2626 if (theEdge1.IsNull()) {
2627 di << "Invalid input shape " << argv[1] << "\n";
2630 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2631 if (theEdge2.IsNull()) {
2632 di << "Invalid input shape " << argv[2] << "\n";
2635 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2636 if (theFace.IsNull()) {
2637 di << "Invalid input shape " << argv[3] << "\n";
2641 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2643 Standard_Real aConfusion = Precision::Confusion();
2644 Standard_Real aP1first, aP1last, aP2first, aP2last;
2646 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2647 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2648 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2649 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2651 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2653 Standard_Integer NbPoints = anInter.NbPoints();
2655 di << "NbPoints = " << NbPoints << "\n" ;
2659 for (i=1; i<=NbPoints; i++) {
2660 gp_Pnt2d aPi = anInter.Point(i);
2661 di << "Point.X(" << i << ") = " << aPi.X() << " Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2665 Standard_Integer NbSegments = anInter.NbSegments();
2667 di << "\nNbSegments = " << NbSegments << "\n" ;
2669 if (NbSegments > 0) {
2670 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2672 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2673 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2675 Standard_Real aDist = aP1.Distance(aP2);
2677 di << "aP1.X() = " << aP1.X() << " aP1.Y() = " << aP1.Y() << "\n" ;
2678 di << "aP2.X() = " << aP2.X() << " aP2.Y() = " << aP2.Y() << "\n" ;
2680 di << "Distance = " << aDist << "\n" ;
2682 di << "Confusion = " << aConfusion << "\n" ;
2684 if (aDist > aConfusion) {
2685 di << "\n" << argv[0] << " Faulty\n" ;
2687 di << "\n" << argv[0] << " OK\n" ;
2690 di << "\n" << argv[0] << " OK\n" ;
2695 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2699 di << "Usage : " << argv[0] << " lower upper\n";
2703 Standard_Integer LOWER = Draw::Atoi(argv[1]);
2704 Standard_Integer UPPER = Draw::Atoi(argv[2]);
2706 //! 0. Create an empty document with several test labels
2707 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2708 doc->SetUndoLimit(100);
2709 TDF_Label main_label = doc->Main();
2710 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2711 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2713 //! 1. Set/Get OCAF attribute
2715 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2716 Handle(TDataStd_RealArray) array;
2717 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2718 array->Lower() == LOWER && array->Upper() == UPPER)
2719 std::cout<<"1: OK"<<std::endl;
2722 std::cout<<"1: Failed.."<<std::endl;
2725 doc->CommitCommand();
2727 //! 2. Set/Get value
2730 for (i = LOWER; i <= UPPER; i++)
2731 array->SetValue(i, i);
2732 for (i = LOWER; i <= UPPER; i++)
2734 if (array->Value(i) != i)
2736 std::cout<<"2: Failed.."<<std::endl;
2740 std::cout<<"2: OK"<<std::endl;
2741 doc->CommitCommand();
2743 //! 3. Re-init the array
2745 array->Init(LOWER + 2, UPPER + 4);
2746 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2748 std::cout<<"3: Failed.."<<std::endl;
2751 for (i = LOWER + 2; i <= UPPER + 4; i++)
2752 array->SetValue(i, i);
2753 for (i = LOWER + 2; i <= UPPER + 4; i++)
2755 if (array->Value(i) != i)
2757 std::cout<<"3: Failed.."<<std::endl;
2761 std::cout<<"3: OK"<<std::endl;
2762 doc->CommitCommand();
2766 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2767 for (i = LOWER + 5; i <= UPPER + 5; i++)
2768 arr->SetValue(i, i);
2769 array->ChangeArray(arr);
2770 for (i = LOWER + 5; i <= UPPER + 5; i++)
2772 if (array->Value(i) != i)
2774 std::cout<<"4: Failed.."<<std::endl;
2778 std::cout<<"4: OK"<<std::endl;
2779 doc->CommitCommand();
2781 //! 5. Copy the array
2783 TDF_CopyLabel copier(label1, label2);
2785 if (!copier.IsDone())
2787 std::cout<<"5: Failed.."<<std::endl;
2790 Handle(TDataStd_RealArray) array2;
2791 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2793 std::cout<<"5: Failed.."<<std::endl;
2796 for (i = LOWER + 5; i <= UPPER + 5; i++)
2798 if (array->Value(i) != i)
2800 std::cout<<"5: Failed.."<<std::endl;
2804 std::cout<<"5: OK"<<std::endl;
2805 doc->CommitCommand();
2808 //! 6.a: undoes the 5th action: the copied array should disappear
2810 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2811 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2813 std::cout<<"6.a: Failed.."<<std::endl;
2816 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2818 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2819 array->Lower() != LOWER + 2 ||
2820 array->Upper() != UPPER + 4)
2822 std::cout<<"6.b: Failed.."<<std::endl;
2825 for (i = LOWER + 2; i <= UPPER + 4; i++)
2827 if (array->Value(i) != i)
2829 std::cout<<"6.b: Failed.."<<std::endl;
2833 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
2835 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2836 array->Lower() != LOWER ||
2837 array->Upper() != UPPER)
2839 std::cout<<"6.c: Failed.."<<std::endl;
2842 for (i = LOWER; i <= UPPER; i++)
2844 if (array->Value(i) != i)
2846 std::cout<<"6.c: Failed.."<<std::endl;
2850 //! 6.d: undoes and redoes the 2nd action: no change is expected.
2853 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2854 array->Lower() != LOWER ||
2855 array->Upper() != UPPER)
2857 std::cout<<"6.d: Failed.."<<std::endl;
2860 for (i = LOWER; i <= UPPER; i++)
2862 if (array->Value(i) != i)
2864 std::cout<<"6.d: Failed.."<<std::endl;
2868 std::cout<<"6: OK"<<std::endl;
2870 //! 7. Re-set the array
2872 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
2873 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
2875 std::cout<<"7: Failed.."<<std::endl;
2878 for (i = LOWER + 1; i <= UPPER + 1; i++)
2879 array->SetValue(i, i);
2880 for (i = LOWER + 1; i <= UPPER + 1; i++)
2882 if (array->Value(i) != i)
2884 std::cout<<"7: Failed.."<<std::endl;
2888 std::cout<<"7: OK"<<std::endl;
2889 doc->CommitCommand();
2891 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
2892 //! measure the time spent by this test.
2898 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2900 Standard_Boolean IsEvenArgc = Standard_True;
2901 if (argc % 2 == 0) {
2902 IsEvenArgc = Standard_True;
2904 IsEvenArgc = Standard_False;
2907 if (argc < 3 || IsEvenArgc)
2909 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]\n";
2913 Standard_Integer i, aValue, aPosition;
2914 NCollection_Vector<int> vec;
2915 for (i = 0; i < argc - 1; i++) {
2917 aValue = Draw::Atoi(argv[i]);
2918 aPosition = Draw::Atoi(argv[i+1]);
2919 vec.SetValue(aValue, aPosition);
2921 NCollection_Vector<int>::Iterator it(vec);
2923 for (j = 0; it.More(); it.Next(), j++) {
2924 //di << it.Value() << "\n";
2925 di << j << " " << it.Value() << "\n";
2931 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2934 di << "Usage : " << argv[0] << "\n";
2938 gp_Pnt point(0.0,0.0,0.0);
2940 TColgp_Array1OfPnt poles(0,6);
2943 point.SetCoord(1.0,1.0,0.0);
2946 point.SetCoord(2.0,1.0,0.0);
2949 point.SetCoord(3.0,0.0,0.0);
2952 point.SetCoord(4.0,1.0,0.0);
2955 point.SetCoord(5.0,1.0,0.0);
2958 point.SetCoord(6.0,0.0,0.0);
2961 TColStd_Array1OfReal knots(0,2);
2966 TColStd_Array1OfInteger multi(0,2);
2971 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
2974 Standard_Real l_abcissa,l_gprop;
2975 GeomAdaptor_Curve adaptor_spline(spline);
2976 GCPnts_AbscissaPoint temp;
2977 l_abcissa=temp.Length(adaptor_spline);
2978 std::cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<std::endl;
2981 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
2983 BRepGProp::LinearProperties(edge,prop);
2984 l_gprop=prop.Mass();
2985 std::cout<<"Length Spline(GProp_GProps): "<<l_gprop<<std::endl;
2987 std::cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<std::endl;
2992 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2996 di << "Usage : " << argv[0] << "\n";
3000 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3001 if(AISContext.IsNull())
3003 di << "use 'vinit' command before " << argv[0] << "\n";
3008 AIS_ListOfInteractive ListOfIO_1;
3009 AISContext->ObjectsInside(ListOfIO_1);
3010 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3011 if (!ListOfIO_1.IsEmpty() ) {
3012 AIS_ListIteratorOfListOfInteractive iter;
3013 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3014 Handle(AIS_InteractiveObject) aIO=iter.Value();
3015 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3022 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3024 if ((argc < 9) || (((argc-3) % 3) != 0))
3026 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3029 Standard_Integer i, j, np = (argc-3) / 3;
3030 BRepBuilderAPI_MakePolygon W;
3032 for (i = 1; i <= np; i ++) {
3033 W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2])));
3037 DBRep::Set(argv[1],W.Wire());
3038 DBRep::Set(argv[2],W.Edge());
3042 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3045 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3048 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3049 gp_Dir(1., -1., 0.));
3051 aTrf.SetAffinity (aPln, Draw::Atof(argv[4]));
3052 gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3053 gp_XYZ aResult (aOrigin);
3054 aTrf.Transforms(aResult);
3056 Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3057 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3058 aResult.X(), aResult.Y(), aResult.Z());
3063 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3066 di << "Usage : " << argv[0] << " shape [deflection]\n";
3070 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3072 if (aShape.IsNull()) {
3073 di<<" Null shape is not allowed";
3077 Standard_Real aDeflection = 0.45110277533;
3079 aDeflection = Draw::Atof(argv[2]);
3081 di<<"deflection="<< aDeflection << "\n";
3083 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI / 9.);
3084 TopLoc_Location aLocation;
3085 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3087 if(aTriang.IsNull()) {
3088 di << argv[0] << " : Faulty\n" ;
3090 di << argv[0] << " : OK\n" ;
3091 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3092 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3097 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3100 di << "Usage : " << argv[0] << " A B C\n";
3105 gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3106 gp_Pnt2d anOrigin = aLin2d.Location();
3107 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3109 catch(Standard_ConstructionError const&)
3111 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3116 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3119 di << "Usage : " << argv[0] << " file shape\n";
3123 IGESControl_Reader aReader;
3124 aReader.ReadFile(argv[1]);
3125 aReader.SetReadVisible(Standard_True);
3126 aReader.TransferRoots();
3128 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3129 if (model.IsNull()) {
3130 di << "model.IsNull()\n";
3133 Standard_Integer nb = model->NbEntities();
3134 for (Standard_Integer i = 1; i <= nb; i ++) {
3135 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3136 Handle(TCollection_HAsciiString) name;
3137 name = ent->NameValue();
3138 Standard_CString aStr = name->ToCString();
3139 di << "NameValue = " << aStr << "\n";
3142 TopoDS_Shape shape = aReader.OneShape();
3143 DBRep::Set(argv[2],shape);
3147 // For OCC16782 testing
3148 #include <AppStd_Application.hxx>
3149 #include <TDF_Tool.hxx>
3150 #include <TColStd_HArray1OfInteger.hxx>
3152 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3153 #include <TColStd_ListIteratorOfListOfReal.hxx>
3154 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3155 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3156 #include <TDF_ListIteratorOfLabelList.hxx>
3158 #include <TDataStd_Tick.hxx>
3159 #include <TDataStd_IntegerList.hxx>
3160 #include <TDataStd_RealList.hxx>
3161 #include <TDataStd_ExtStringList.hxx>
3162 #include <TDataStd_BooleanList.hxx>
3163 #include <TDataStd_ReferenceList.hxx>
3164 #include <TDataStd_BooleanArray.hxx>
3165 #include <TDataStd_ReferenceArray.hxx>
3166 #include <TDataStd_ByteArray.hxx>
3167 #include <TDataStd_NamedData.hxx>
3168 #include <TDF_Reference.hxx>
3170 Handle(AppStd_Application) app;
3171 int TestSetGet(const Handle(TDocStd_Document)& doc)
3175 TDataStd_Tick::Set(doc->Main());
3177 Handle(TDataStd_Tick) tick;
3178 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3181 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3182 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3184 doc->Main().ResumeAttribute(tick);
3185 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3188 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3189 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3192 // TDataStd_IntegerList:
3194 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3195 setintlist->Append(2);
3196 setintlist->Prepend(1);
3197 setintlist->InsertAfter(3, 2);
3198 setintlist->InsertBefore(0, 1);
3199 setintlist->Append(200);
3200 setintlist->Remove(0);
3201 setintlist->Remove(200);
3203 Handle(TDataStd_IntegerList) getintlist;
3204 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3206 if (getintlist->First() != 1)
3208 if (getintlist->Last() != 3)
3210 const TColStd_ListOfInteger& intlist = getintlist->List();
3211 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3212 for (; itr_intlist.More(); itr_intlist.Next())
3214 if (itr_intlist.Value() != 1 &&
3215 itr_intlist.Value() != 2 &&
3216 itr_intlist.Value() != 3)
3221 getintlist->Clear();
3223 // TDataStd_RealList:
3225 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3226 setdbllist->Append(2.5);
3227 setdbllist->Prepend(1.5);
3228 setdbllist->InsertAfter(3.5, 2.5);
3229 setdbllist->InsertBefore(0.5, 1.5);
3230 setdbllist->Append(200.5);
3231 setdbllist->Remove(0.5);
3232 setdbllist->Remove(200.5);
3234 Handle(TDataStd_RealList) getdbllist;
3235 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3237 if (getdbllist->First() != 1.5)
3239 if (getdbllist->Last() != 3.5)
3241 const TColStd_ListOfReal& dbllist = getdbllist->List();
3242 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3243 for (; itr_dbllist.More(); itr_dbllist.Next())
3245 if (itr_dbllist.Value() != 1.5 &&
3246 itr_dbllist.Value() != 2.5 &&
3247 itr_dbllist.Value() != 3.5)
3252 getdbllist->Clear();
3254 // TDataStd_ExtStringList:
3256 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3257 setstrlist->Append("Hello");
3258 setstrlist->Prepend("Guten Tag");
3259 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3260 setstrlist->InsertBefore("Bonsoir", "Hello");
3261 setstrlist->Append("Good bye");
3262 setstrlist->Remove("Bonsoir");
3263 setstrlist->Remove("Good bye");
3265 Handle(TDataStd_ExtStringList) getstrlist;
3266 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3268 if (getstrlist->First() != "Guten Tag")
3270 if (getstrlist->Last() != "Hello")
3272 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3273 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3274 for (; itr_strlist.More(); itr_strlist.Next())
3276 if (itr_strlist.Value() != "Guten Tag" &&
3277 itr_strlist.Value() != "Bonjour" &&
3278 itr_strlist.Value() != "Hello")
3283 getstrlist->Clear();
3285 // TDataStd_BooleanList:
3287 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3288 setboollist->Append(Standard_True);
3289 setboollist->Prepend(Standard_False);
3291 Handle(TDataStd_BooleanList) getboollist;
3292 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3294 if (getboollist->First() != Standard_False)
3296 if (getboollist->Last() != Standard_True)
3298 const TDataStd_ListOfByte& boollist = getboollist->List();
3299 for (TDataStd_ListIteratorOfListOfByte itr_boollist(boollist); itr_boollist.More(); itr_boollist.Next())
3301 if (itr_boollist.Value() != 1
3302 && itr_boollist.Value() != 0)
3307 getboollist->Clear();
3309 // TDataStd_ReferenceList:
3310 TDF_Label L1 = doc->Main().FindChild(100);
3311 TDF_Label L2 = doc->Main().FindChild(101);
3312 TDF_Label L3 = doc->Main().FindChild(102);
3313 TDF_Label L4 = doc->Main().FindChild(103);
3314 TDF_Label L5 = doc->Main().FindChild(104);
3316 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3317 setreflist->Append(L1);
3318 setreflist->Prepend(L2);
3319 setreflist->InsertAfter(L3, L2);
3320 setreflist->InsertBefore(L4, L1);
3321 setreflist->Append(L5);
3322 setreflist->Remove(L4);
3323 setreflist->Remove(L5);
3325 Handle(TDataStd_ReferenceList) getreflist;
3326 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3328 if (getreflist->First() != L2)
3330 if (getreflist->Last() != L1)
3332 const TDF_LabelList& reflist = getreflist->List();
3333 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3334 for (; itr_reflist.More(); itr_reflist.Next())
3336 if (itr_reflist.Value() != L1 &&
3337 itr_reflist.Value() != L2 &&
3338 itr_reflist.Value() != L3)
3343 getreflist->Clear();
3345 // TDataStd_BooleanArray:
3347 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3348 setboolarr->SetValue(12, Standard_True);
3349 setboolarr->SetValue(13, Standard_False);
3350 setboolarr->SetValue(14, Standard_False);
3351 setboolarr->SetValue(15, Standard_False);
3352 setboolarr->SetValue(16, Standard_True);
3353 setboolarr->SetValue(14, Standard_True);
3355 Handle(TDataStd_BooleanArray) getboolarr;
3356 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3358 if (getboolarr->Value(12) != Standard_True)
3360 if (getboolarr->Value(13) != Standard_False)
3362 if (getboolarr->Value(14) != Standard_True)
3364 if (getboolarr->Value(15) != Standard_False)
3366 if (getboolarr->Value(16) != Standard_True)
3369 // TDataStd_ReferenceArray:
3371 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3372 setrefarr->SetValue(0, L1);
3373 setrefarr->SetValue(1, L2);
3374 setrefarr->SetValue(2, L3);
3375 setrefarr->SetValue(3, L4);
3376 setrefarr->SetValue(4, L5);
3378 Handle(TDataStd_ReferenceArray) getrefarr;
3379 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3381 if (getrefarr->Value(0) != L1)
3383 if (getrefarr->Value(1) != L2)
3385 if (getrefarr->Value(2) != L3)
3387 if (getrefarr->Value(3) != L4)
3389 if (getrefarr->Value(4) != L5)
3392 // TDataStd_ByteArray:
3394 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3395 setbytearr->SetValue(12, 0);
3396 setbytearr->SetValue(13, 1);
3397 setbytearr->SetValue(14, 2);
3398 setbytearr->SetValue(15, 3);
3399 setbytearr->SetValue(16, 255);
3401 Handle(TDataStd_ByteArray) getbytearr;
3402 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3404 if (getbytearr->Value(12) != 0)
3406 if (getbytearr->Value(13) != 1)
3408 if (getbytearr->Value(14) != 2)
3410 if (getbytearr->Value(15) != 3)
3412 if (getbytearr->Value(16) != 255)
3415 // TDataStd_NamedData:
3417 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3418 setnd->SetInteger("Integer1", 1);
3419 setnd->SetInteger("Integer2", 2);
3420 setnd->SetInteger("Integer3", 8);
3421 setnd->SetInteger("Integer3", 3);
3423 Handle(TDataStd_NamedData) getnd;
3424 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3426 if (!getnd->HasIntegers())
3428 if (!getnd->HasInteger("Integer1"))
3430 if (getnd->GetInteger("Integer2") != 2)
3432 if (getnd->GetInteger("Integer3") != 3)
3438 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3442 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3443 doc->CommitCommand();
3444 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3447 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3450 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3453 // TDataStd_IntegerList:
3455 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3457 intlist->Prepend(1);
3458 intlist->InsertBefore(0, 1);
3459 intlist->InsertAfter(3, 2);
3460 doc->CommitCommand();
3461 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3464 if (!intlist->IsEmpty())
3467 if (!intlist->Extent())
3469 if (intlist->First() != 0)
3471 if (intlist->Last() != 3)
3475 // TDataStd_RealList:
3477 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3478 dbllist->Append(2.5);
3479 dbllist->Prepend(1.5);
3480 dbllist->InsertBefore(0.5, 1.5);
3481 dbllist->InsertAfter(3.5, 2.5);
3482 doc->CommitCommand();
3483 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3486 if (!dbllist->IsEmpty())
3489 if (!dbllist->Extent())
3491 if (dbllist->First() != 0.5)
3493 if (dbllist->Last() != 3.5)
3497 // TDataStd_ExtStringList:
3499 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3500 strlist->Append("Hello");
3501 strlist->Prepend("Guten Tag");
3502 strlist->InsertAfter("Bonjour", "Guten Tag");
3503 strlist->InsertBefore("Bonsoir", "Hello");
3504 doc->CommitCommand();
3505 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3508 if (!strlist->IsEmpty())
3511 if (!strlist->Extent())
3513 if (strlist->First() != "Guten Tag")
3515 if (strlist->Last() != "Hello")
3519 // TDataStd_BooleanList:
3521 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3522 boollist->Append(Standard_True);
3523 boollist->Prepend(Standard_False);
3524 doc->CommitCommand();
3525 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3528 if (!boollist->IsEmpty())
3531 if (!boollist->Extent())
3533 if (boollist->First() != Standard_False)
3535 if (boollist->Last() != Standard_True)
3539 // TDataStd_ReferenceList:
3540 TDF_Label L1 = doc->Main().FindChild(100);
3541 TDF_Label L2 = doc->Main().FindChild(101);
3542 TDF_Label L3 = doc->Main().FindChild(102);
3543 TDF_Label L4 = doc->Main().FindChild(103);
3545 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3546 reflist->Append(L1);
3547 reflist->Prepend(L2);
3548 reflist->InsertBefore(L3, L1);
3549 reflist->InsertAfter(L4, L2);
3550 doc->CommitCommand();
3551 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3554 if (!reflist->IsEmpty())
3557 if (!reflist->Extent())
3559 if (reflist->First() != L2)
3561 if (reflist->Last() != L1)
3565 // TDataStd_BooleanArray:
3567 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3568 boolarr->SetValue(23, Standard_True);
3569 boolarr->SetValue(25, Standard_True);
3570 doc->CommitCommand();
3572 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3573 boolarr->SetValue(230, Standard_True);
3574 boolarr->SetValue(250, Standard_True);
3575 doc->CommitCommand();
3577 if (boolarr->Value(23) != Standard_True)
3579 if (boolarr->Value(24) != Standard_False)
3581 if (boolarr->Value(25) != Standard_True)
3584 if (boolarr->Value(230) != Standard_True)
3586 if (boolarr->Value(240) != Standard_False)
3588 if (boolarr->Value(250) != Standard_True)
3591 // TDataStd_ReferenceArray:
3593 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3594 refarr->SetValue(5, L1);
3595 refarr->SetValue(6, L2);
3596 refarr->SetValue(7, L3);
3597 refarr->SetValue(8, L4);
3598 doc->CommitCommand();
3599 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3603 if (refarr->Value(5) != L1)
3605 if (refarr->Value(6) != L2)
3607 if (refarr->Value(7) != L3)
3609 if (refarr->Value(8) != L4)
3612 // TDataStd_ByteArray:
3614 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3615 bytearr->SetValue(23, 23);
3616 bytearr->SetValue(25, 25);
3617 doc->CommitCommand();
3619 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3620 bytearr->SetValue(230, 230);
3621 bytearr->SetValue(250, 250);
3622 doc->CommitCommand();
3624 if (bytearr->Value(23) != 23)
3626 if (bytearr->Value(25) != 25)
3629 if (bytearr->Value(230) != 230)
3631 if (bytearr->Value(250) != 250)
3634 // TDataStd_NamedData:
3636 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3637 nd->SetByte("b14", 12);
3638 nd->SetByte("b17", 18);
3639 nd->SetByte("b14", 14);
3640 nd->SetByte("b17", 17);
3641 doc->CommitCommand();
3643 nd = TDataStd_NamedData::Set(doc->Main());
3644 nd->SetReal("r14", 14);
3645 nd->SetReal("r17", 17);
3646 nd->SetReal("r14", 14.4);
3647 nd->SetReal("r17", 17.7);
3648 doc->CommitCommand();
3650 if (nd->HasStrings())
3654 if (nd->HasReal("r17"))
3656 if (!nd->HasBytes())
3658 if (nd->GetByte("b14") != 14)
3660 if (nd->GetByte("b17") != 17)
3662 if (nd->HasByte("b18"))
3665 if (!nd->HasBytes())
3667 if (!nd->HasReals())
3669 if (nd->GetByte("b14") != 14)
3671 if (nd->GetReal("r14") != 14.4)
3673 if (nd->GetReal("r17") != 17.7)
3679 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3681 TDF_Label L1 = doc->Main().FindChild(1);
3682 TDF_Label L2 = doc->Main().FindChild(2);
3683 TDF_CopyLabel copier(L1, L2);
3686 TDataStd_Tick::Set(L1);
3688 if (!copier.IsDone())
3690 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3693 // TDataStd_IntegerList:
3694 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3696 intlist->InsertAfter(2, 1);
3698 if (!copier.IsDone())
3702 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3704 if (intlist->First() != 1)
3706 if (intlist->Last() != 2)
3710 // TDataStd_RealList:
3711 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3712 dbllist->Append(1.5);
3713 dbllist->InsertAfter(2.5, 1.5);
3715 if (!copier.IsDone())
3719 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3721 if (dbllist->First() != 1.5)
3723 if (dbllist->Last() != 2.5)
3727 // TDataStd_ExtStringList:
3728 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3729 strlist->Append("Open CASCADE");
3730 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3732 if (!copier.IsDone())
3736 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3738 if (strlist->First() != "Open CASCADE")
3740 if (strlist->Last() != " - is the best set of libraries!")
3744 // TDataStd_BooleanList:
3745 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3746 boollist->Append(Standard_True);
3747 boollist->Prepend(Standard_False);
3749 if (!copier.IsDone())
3753 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3755 if (boollist->First() != Standard_False)
3757 if (boollist->Last() != Standard_True)
3761 // TDataStd_ReferenceList:
3762 TDF_Label L100 = doc->Main().FindChild(100);
3763 TDF_Label L101 = doc->Main().FindChild(101);
3764 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3765 reflist->Append(L100);
3766 reflist->InsertAfter(L101, L100);
3768 if (!copier.IsDone())
3772 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3774 if (reflist->First() != L100)
3776 if (reflist->Last() != L101)
3780 // TDataStd_BooleanArray:
3781 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3782 boolarr->SetValue(4, Standard_True);
3783 boolarr->SetValue(6, Standard_True);
3785 if (!copier.IsDone())
3788 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3790 if (boolarr->Value(4) != Standard_True)
3792 if (boolarr->Value(5) != Standard_False)
3794 if (boolarr->Value(6) != Standard_True)
3797 // TDataStd_ReferenceArray:
3798 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3799 refarr->SetValue(3, L100);
3800 refarr->SetValue(4, L101);
3802 if (!copier.IsDone())
3805 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3807 if (refarr->Value(3) != L100)
3809 if (refarr->Value(4) != L101)
3812 // TDataStd_ByteArray:
3813 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
3814 bytearr->SetValue(4, 40);
3815 bytearr->SetValue(6, 60);
3817 if (!copier.IsDone())
3820 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
3822 if (bytearr->Value(4) != 40)
3824 if (bytearr->Value(6) != 60)
3827 // TDataStd_NamedData:
3828 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
3829 nd->SetInteger("Integer1", 11);
3830 nd->SetReal("Real1", 11.1);
3831 nd->SetString("String1", "11.11111111");
3832 nd->SetByte("Byte1", 111);
3833 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
3834 ints_arr->SetValue(4, 4);
3835 ints_arr->SetValue(5, 5);
3836 nd->SetArrayOfIntegers("Integers1", ints_arr);
3838 if (!copier.IsDone())
3841 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
3843 if (!nd->HasIntegers())
3845 if (!nd->HasReals())
3847 if (!nd->HasStrings())
3849 if (!nd->HasBytes())
3851 if (!nd->HasArraysOfIntegers())
3853 if (nd->HasArraysOfReals())
3855 if (!nd->HasInteger("Integer1"))
3857 if (nd->GetInteger("Integer1") != 11)
3859 if (!nd->HasReal("Real1"))
3861 if (nd->GetReal("Real1") != 11.1)
3863 if (!nd->HasString("String1"))
3865 if (nd->GetString("String1") != "11.11111111")
3867 if (!nd->HasByte("Byte1"))
3869 if (nd->GetByte("Byte1") != 111)
3871 if (!nd->HasArrayOfIntegers("Integers1"))
3873 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
3874 if (ints_arr_out.IsNull())
3876 if (ints_arr_out->Value(5) != 5)
3882 int TestOpenSave(TCollection_ExtendedString aFile1,
3883 TCollection_ExtendedString aFile2,
3884 TCollection_ExtendedString aFile3)
3887 Handle(TDocStd_Document) doc_std, doc_std_open;
3888 app->NewDocument("BinOcaf", doc_std);
3890 TDataStd_Tick::Set(doc_std->Main());
3891 // TDataStd_IntegerList:
3892 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
3895 // TDataStd_RealList:
3896 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
3897 dbllist->Append(1.5);
3898 dbllist->Append(5.5);
3899 // TDataStd_ExtStringList:
3900 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
3901 strlist->Append("Auf");
3902 strlist->Append("Wiedersehen");
3903 // TDataStd_BooleanList:
3904 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
3905 boollist->Append(Standard_False);
3906 boollist->Append(Standard_True);
3907 // TDataStd_ReferenceList:
3908 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
3909 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
3910 TDF_Tool::Entry(Lstd1, entry1);
3911 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
3912 TDF_Tool::Entry(Lstd2, entry2);
3913 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
3914 reflist->Append(Lstd1);
3915 reflist->Append(Lstd2);
3916 // TDataStd_BooleanArray:
3917 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
3918 boolarr->SetValue(15, Standard_False);
3919 boolarr->SetValue(16, Standard_True);
3920 boolarr->SetValue(17, Standard_True);
3921 boolarr->SetValue(18, Standard_True);
3922 // TDataStd_ReferenceArray:
3923 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
3924 refarr->SetValue(45, Lstd1);
3925 refarr->SetValue(46, Lstd2);
3926 // TDataStd_ByteArray:
3927 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
3928 bytearr->SetValue(15, 150);
3929 bytearr->SetValue(16, 160);
3930 bytearr->SetValue(17, 170);
3931 bytearr->SetValue(18, 180);
3932 // TDataStd_NamedData:
3933 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
3935 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
3936 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
3939 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
3940 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
3949 app->Close(doc_std);
3951 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
3952 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
3954 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
3956 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3958 if (intlist->First() != 1)
3960 if (intlist->Last() != 5)
3962 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
3964 if (dbllist->First() != 1.5)
3966 if (dbllist->Last() != 5.5)
3968 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3970 if (strlist->First() != "Auf")
3972 if (strlist->Last() != "Wiedersehen")
3974 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3976 if (boollist->First() != Standard_False)
3978 if (boollist->Last() != Standard_True)
3980 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3982 TDF_Tool::Entry(reflist->First(), entry_first);
3983 if (entry1 != entry_first)
3985 TDF_Tool::Entry(reflist->Last(), entry_last);
3986 if (entry2 != entry_last)
3988 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3990 if (boolarr->Value(15) != Standard_False)
3992 if (boolarr->Value(16) != Standard_True)
3994 if (boolarr->Value(17) != Standard_True)
3996 if (boolarr->Value(18) != Standard_True)
3998 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4000 TDF_Tool::Entry(refarr->Value(45), entry_first);
4001 if (entry1 != entry_first)
4003 TDF_Tool::Entry(refarr->Value(46), entry_last);
4004 if (entry2 != entry_last)
4006 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4008 if (bytearr->Value(15) != 150)
4010 if (bytearr->Value(16) != 160)
4012 if (bytearr->Value(17) != 170)
4014 if (bytearr->Value(18) != 180)
4016 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4018 if (ref->Get().IsNull())
4020 if (ref->Get().Tag() != 103)
4024 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4025 app->NewDocument("XmlOcaf", doc_xml);
4027 TDataStd_Tick::Set(doc_xml->Main());
4028 // TDataStd_IntegerList:
4029 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4032 // TDataStd_RealList:
4033 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4034 dbllist->Append(1.5);
4035 dbllist->Append(5.5);
4036 // TDataStd_ExtStringList:
4037 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4038 strlist->Append("Guten ");
4039 strlist->Append("Tag");
4040 // TDataStd_BooleanList:
4041 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4042 boollist->Append(Standard_False);
4043 boollist->Append(Standard_True);
4044 // TDataStd_ReferenceList:
4045 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4046 TDF_Tool::Entry(Lxml1, entry1);
4047 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4048 TDF_Tool::Entry(Lxml2, entry2);
4049 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4050 reflist->Append(Lxml1);
4051 reflist->Append(Lxml2);
4052 // TDataStd_BooleanArray:
4053 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4054 boolarr->SetValue(15, Standard_False);
4055 boolarr->SetValue(16, Standard_True);
4056 boolarr->SetValue(17, Standard_True);
4057 boolarr->SetValue(18, Standard_True);
4058 boolarr->SetValue(19, Standard_True);
4059 boolarr->SetValue(20, Standard_True);
4060 boolarr->SetValue(21, Standard_False);
4061 boolarr->SetValue(22, Standard_True);
4062 boolarr->SetValue(23, Standard_True);
4063 boolarr->SetValue(24, Standard_True);
4064 // TDataStd_ReferenceArray:
4065 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4066 refarr->SetValue(444, Lxml1);
4067 refarr->SetValue(445, Lxml2);
4068 // TDataStd_ByteArray:
4069 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4070 bytearr->SetValue(15, 0);
4071 bytearr->SetValue(16, 10);
4072 bytearr->SetValue(17, 100);
4073 bytearr->SetValue(18, 200);
4074 bytearr->SetValue(19, 250);
4075 bytearr->SetValue(20, 251);
4076 bytearr->SetValue(21, 252);
4077 bytearr->SetValue(22, 253);
4078 bytearr->SetValue(23, 254);
4079 bytearr->SetValue(24, 255);
4081 Lstd3 = doc_xml->Main().FindChild(103);
4082 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4085 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4086 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4090 app->Close(doc_xml);
4092 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4093 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4095 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4097 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4099 if (intlist->First() != 1)
4101 if (intlist->Last() != 5)
4103 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4105 if (dbllist->First() != 1.5)
4107 if (dbllist->Last() != 5.5)
4109 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4111 if (strlist->First() != "Guten ")
4113 if (strlist->Last() != "Tag")
4115 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4117 if (boollist->First() != Standard_False)
4119 if (boollist->Last() != Standard_True)
4121 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4123 TDF_Tool::Entry(reflist->First(), entry_first);
4124 if (entry1 != entry_first)
4126 TDF_Tool::Entry(reflist->Last(), entry_last);
4127 if (entry2 != entry_last)
4129 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4131 if (boolarr->Value(15) != Standard_False)
4133 if (boolarr->Value(16) != Standard_True)
4135 if (boolarr->Value(17) != Standard_True)
4137 if (boolarr->Value(18) != Standard_True)
4139 if (boolarr->Value(19) != Standard_True)
4141 if (boolarr->Value(20) != Standard_True)
4143 if (boolarr->Value(21) != Standard_False)
4145 if (boolarr->Value(22) != Standard_True)
4147 if (boolarr->Value(23) != Standard_True)
4149 if (boolarr->Value(24) != Standard_True)
4151 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4153 TDF_Tool::Entry(refarr->Value(444), entry_first);
4154 if (entry1 != entry_first)
4156 TDF_Tool::Entry(refarr->Value(445), entry_last);
4157 if (entry2 != entry_last)
4159 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4161 if (bytearr->Value(15) != 0)
4163 if (bytearr->Value(16) != 10)
4165 if (bytearr->Value(17) != 100)
4167 if (bytearr->Value(18) != 200)
4169 if (bytearr->Value(19) != 250)
4171 if (bytearr->Value(20) != 251)
4173 if (bytearr->Value(21) != 252)
4175 if (bytearr->Value(22) != 253)
4177 if (bytearr->Value(23) != 254)
4179 if (bytearr->Value(24) != 255)
4181 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4183 if (ref->Get().IsNull())
4185 if (ref->Get().Tag() != 103)
4189 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4190 app->NewDocument("BinOcaf", doc_bin);
4192 TDataStd_Tick::Set(doc_bin->Main());
4193 // TDataStd_IntegerList:
4194 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4197 // TDataStd_RealList:
4198 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4199 dbllist->Append(1.5);
4200 dbllist->Append(5.5);
4201 // TDataStd_ExtStringList:
4202 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4203 strlist->Append("Bonjour");
4204 strlist->Append("Bonsoir");
4205 // TDataStd_BooleanList:
4206 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4207 boollist->Append(Standard_False);
4208 boollist->Append(Standard_True);
4209 // TDataStd_ReferenceList:
4210 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4211 TDF_Tool::Entry(Lbin1, entry1);
4212 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4213 TDF_Tool::Entry(Lbin2, entry2);
4214 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4215 reflist->Append(Lbin1);
4216 reflist->Append(Lbin2);
4217 // TDataStd_BooleanArray:
4218 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4219 boolarr->SetValue(15, Standard_False);
4220 boolarr->SetValue(16, Standard_True);
4221 boolarr->SetValue(17, Standard_True);
4222 boolarr->SetValue(18, Standard_True);
4223 boolarr->SetValue(19, Standard_True);
4224 boolarr->SetValue(20, Standard_True);
4225 boolarr->SetValue(21, Standard_False);
4226 boolarr->SetValue(22, Standard_True);
4227 boolarr->SetValue(23, Standard_True);
4228 boolarr->SetValue(24, Standard_True);
4229 // TDataStd_ReferenceArray:
4230 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4231 refarr->SetValue(0, Lbin1);
4232 refarr->SetValue(1, Lbin2);
4233 // TDataStd_ByteArray:
4234 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4235 bytearr->SetValue(15, 0);
4236 bytearr->SetValue(16, 255);
4237 // TDataStd_NamedData:
4238 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4239 nameddata->SetByte("A", 12);
4240 nameddata->SetByte("B", 234);
4242 Lstd3 = doc_bin->Main().FindChild(103);
4243 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4246 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4247 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4251 app->Close(doc_bin);
4253 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4254 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4256 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4258 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4260 if (intlist->First() != 1)
4262 if (intlist->Last() != 5)
4264 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4266 if (dbllist->First() != 1.5)
4268 if (dbllist->Last() != 5.5)
4270 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4272 if (strlist->First() != "Bonjour")
4274 if (strlist->Last() != "Bonsoir")
4276 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4278 if (boollist->First() != Standard_False)
4280 if (boollist->Last() != Standard_True)
4282 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4284 TDF_Tool::Entry(reflist->First(), entry_first);
4285 if (entry1 != entry_first)
4287 TDF_Tool::Entry(reflist->Last(), entry_last);
4288 if (entry2 != entry_last)
4290 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4292 if (boolarr->Value(15) != Standard_False)
4294 if (boolarr->Value(16) != Standard_True)
4296 if (boolarr->Value(17) != Standard_True)
4298 if (boolarr->Value(18) != Standard_True)
4300 if (boolarr->Value(19) != Standard_True)
4302 if (boolarr->Value(20) != Standard_True)
4304 if (boolarr->Value(21) != Standard_False)
4306 if (boolarr->Value(22) != Standard_True)
4308 if (boolarr->Value(23) != Standard_True)
4310 if (boolarr->Value(24) != Standard_True)
4312 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4314 TDF_Tool::Entry(refarr->Value(0), entry_first);
4315 if (entry1 != entry_first)
4317 TDF_Tool::Entry(refarr->Value(1), entry_last);
4318 if (entry2 != entry_last)
4320 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4322 if (bytearr->Value(15) != 0)
4324 if (bytearr->Value(16) != 255)
4326 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4328 if (nameddata->GetByte("A") != 12)
4330 if (nameddata->GetByte("B") != 234)
4332 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4334 if (ref->Get().IsNull())
4336 if (ref->Get().Tag() != 103)
4341 // For OCC16782 testing
4343 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4347 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4350 TCollection_ExtendedString aFile1(argv[1]);
4351 TCollection_ExtendedString aFile2(argv[2]);
4352 TCollection_ExtendedString aFile3(argv[3]);
4355 app = new AppStd_Application();
4359 Handle(TDocStd_Document) doc;
4360 app->NewDocument("BinOcaf", doc);
4361 doc->SetUndoLimit(10);
4363 di <<"\nTestSetGet start\n";
4364 good += TestSetGet(doc);
4365 di <<"TestSetGet finish\n";
4366 di <<"Status = " << good << "\n";
4368 di <<"\nTestUndoRedo start\n";
4369 good += TestUndoRedo(doc);
4370 di <<"TestUndoRedo finish\n";
4371 di <<"Status = " << good << "\n";
4373 di <<"\nTestCopyPaste start\n";
4374 good += TestCopyPaste(doc);
4375 di <<"TestCopyPaste finish\n";
4376 di <<"Status = " << good << "\n";
4378 di <<"\nTestOpenSave start\n";
4379 good += TestOpenSave(aFile1, aFile2, aFile3);
4380 di <<"TestOpenSave finish\n";
4381 di <<"Status = " << good << "\n";
4384 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4386 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4391 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4393 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4394 if(aContext.IsNull()) {
4395 di << argv[0] << " ERROR : use 'vinit' command before \n";
4401 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4404 Standard_Integer mode = 0;
4407 mode = Draw::Atoi(argv[1]);
4409 if (mode > 2 || mode < 0)
4411 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4414 Handle(V3d_View) V = ViewerTest::CurrentView();
4415 static Handle(AIS_ColorScale) aCS;
4418 aCS = new AIS_ColorScale();
4420 if (aCS->ZLayer() != Graphic3d_ZLayerId_TopOSD)
4422 aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
4424 if (aCS->TransformPersistence().IsNull()
4425 || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
4427 aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
4429 Standard_Integer aWinWidth, aWinHeight;
4430 V->Window()->Size (aWinWidth, aWinHeight);
4431 aCS->SetSize (aWinWidth, aWinHeight);
4432 if ( !V.IsNull() ) {
4434 aContext->Display (aCS, Standard_True);
4437 aContext->Erase (aCS, Standard_False);
4442 Standard_Boolean IsDisplayed = aContext->IsDisplayed (aCS);
4444 di <<"ColorScaleIsDisplayed = 1\n";
4446 di <<"ColorScaleIsDisplayed = 0\n";
4452 #include <Interface_Macros.hxx>
4453 #include <IGESControl_Controller.hxx>
4454 #include <XSDRAW.hxx>
4455 #include <Draw_ProgressIndicator.hxx>
4456 #include <XSControl_WorkSession.hxx>
4457 #include <Transfer_TransientProcess.hxx>
4458 #include <TColStd_HSequenceOfTransient.hxx>
4459 #include <Message_ProgressScope.hxx>
4460 #include <XSControl_TransferReader.hxx>
4462 #include <Geom_Plane.hxx>
4463 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4467 di << "Usage : " << argv[0] << " plane a b c d\n";
4471 Standard_Real A = Draw::Atof(argv[2]);
4472 Standard_Real B = Draw::Atof(argv[3]);
4473 Standard_Real C = Draw::Atof(argv[4]);
4474 Standard_Real D = Draw::Atof(argv[5]);
4476 Handle(Geom_Geometry) result;
4478 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4481 DrawTrSurf::Set(argv[1],result);
4485 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4489 di << "Usage : " << argv[0] << " MaxNbr\n";
4492 Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
4494 for (Standard_Integer i=0;i<aMaxNbr;i++)
4496 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4498 TopoDS_Wire wireShape( w.Wire());
4499 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4500 TopoDS_Face f( faceBuilder.Face());
4501 BRepMesh_IncrementalMesh im(f,1);
4502 BRepTools::Clean(f);
4507 #include <IntCurvesFace_ShapeIntersector.hxx>
4508 #include <gp_Lin.hxx>
4509 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4513 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf\n";
4517 TopoDS_Shape shape = DBRep::Get(argv[1]);
4519 if (shape.IsNull()) {
4520 di<<" Null shape is not allowed";
4524 Standard_Real X_Pnt = Draw::Atof(argv[2]);
4525 Standard_Real Y_Pnt = Draw::Atof(argv[3]);
4526 Standard_Real Z_Pnt = Draw::Atof(argv[4]);
4528 Standard_Real X_Dir = Draw::Atof(argv[5]);
4529 Standard_Real Y_Dir = Draw::Atof(argv[6]);
4530 Standard_Real Z_Dir = Draw::Atof(argv[7]);
4532 Standard_Real PInf = Draw::Atof(argv[8]);
4534 IntCurvesFace_ShapeIntersector intersector;
4535 intersector.Load(shape, Precision::Intersection());
4537 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
4538 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
4539 gp_Lin ray(origin, dir);
4541 Standard_Real PSup = RealLast();
4542 intersector.PerformNearest(ray, PInf, PSup);
4543 if (intersector.NbPnt() != 0)
4545 di << argv[0] << " status = 0 \n";
4546 Standard_Real w = intersector.WParameter(1);
4547 di << "w = " << w << "\n";
4549 di << argv[0] << " status = -1 \n";
4554 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4557 di << "Usage : " << argv[0] << "\n";
4561 // Create mask 1111: extent == 4
4562 TColStd_PackedMapOfInteger aFullMask;
4563 for (Standard_Integer i = 0; i < 4; i++)
4566 // Create mask 1100: extent == 2
4567 TColStd_PackedMapOfInteger aPartMask;
4568 for (Standard_Integer i = 0; i < 2; i++)
4571 di << "aFullMask = 1111\n";
4572 di << "aPartMask = 1100\n";
4574 Standard_Boolean isAffected;
4576 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
4577 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4578 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
4579 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4580 isAffected = aFullMask.Subtract(aPartMask); // false (?)
4581 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4586 #include <NCollection_DataMap.hxx>
4587 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4591 di << "Usage : " << argv[0] << "\n";
4595 TCollection_ExtendedString anExtString;
4597 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
4598 anExtString.Insert(1, aNonAsciiChar);
4600 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
4601 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
4602 aMap.Bind(anExtString, 0);
4608 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4611 di << "Wrong number of arguments" << argv[0] << "\n";
4615 Standard_Real X_vec = Draw::Atof(argv[1]);
4616 Standard_Real Y_vec = Draw::Atof(argv[2]);
4617 Standard_Real Z_vec = Draw::Atof(argv[3]);
4619 Standard_Real X_dir = Draw::Atof(argv[4]);
4620 Standard_Real Y_dir = Draw::Atof(argv[5]);
4621 Standard_Real Z_dir = Draw::Atof(argv[6]);
4623 Standard_Real X_pnt = Draw::Atof(argv[7]);
4624 Standard_Real Y_pnt = Draw::Atof(argv[8]);
4625 Standard_Real Z_pnt = Draw::Atof(argv[9]);
4627 gp_Dir toSym(X_vec, Y_vec, Z_vec);
4628 gp_Dir dir(X_dir, Y_dir, Z_dir);
4629 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
4630 gp_Ax2 symObj(loc,dir);
4631 toSym.Mirror(symObj);
4633 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
4638 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4642 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
4646 Standard_Real X_mirrorFirstPoint = Draw::Atof(argv[1]);
4647 Standard_Real Y_mirrorFirstPoint = Draw::Atof(argv[2]);
4648 Standard_Real X_mirrorSecondPoint = Draw::Atof(argv[3]);
4649 Standard_Real Y_mirrorSecondPoint = Draw::Atof(argv[4]);
4650 Standard_Real X_p1 = Draw::Atof(argv[5]);
4651 Standard_Real Y_p1 = Draw::Atof(argv[6]);
4652 Standard_Real X_p2 = Draw::Atof(argv[7]);
4653 Standard_Real Y_p2 = Draw::Atof(argv[8]);
4655 gp_Trsf2d identityTransformation;
4657 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
4658 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
4659 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
4661 gp_Pnt2d p1(X_p1,Y_p1);
4662 gp_Pnt2d p2(X_p2,Y_p2);
4665 M1.SetMirror(mirrorAxis);
4667 M2.SetMirror(mirrorAxis);
4669 Tcomp = M2.Multiplied(M1);
4671 Standard_Real aTol = Precision::Confusion();
4672 Standard_Integer aStatus = 0;
4674 //After applying two times the same mirror the point is located on the same location OK
4675 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
4676 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
4678 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
4681 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
4682 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
4684 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
4687 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
4688 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
4689 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
4691 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
4694 di << "Status = " << aStatus << "\n";
4698 Standard_Integer OCC23429(Draw_Interpretor& /*di*/,
4699 Standard_Integer narg, const char** a)
4701 if (narg < 4) return 1;
4703 TopoDS_Shape aShape = DBRep::Get(a[2]);
4704 if (aShape.IsNull()) return 1;
4706 BRepFeat_SplitShape Spls(aShape);
4707 Spls.SetCheckInterior(Standard_False);
4709 TopoDS_Shape aTool = DBRep::Get(a[3]);
4711 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
4712 Builder.ComputePCurveOn1(Standard_True);
4714 Builder.Approximation(Standard_True);
4716 TopoDS_Shape aSection = Builder.Shape();
4718 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
4719 for (; ExpSec.More(); ExpSec.Next())
4721 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
4722 Handle(Geom2d_Curve) thePCurve;
4723 Handle(Geom_Surface) theSurface;
4724 TopLoc_Location theLoc;
4725 Standard_Real fpar, lpar;
4726 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
4728 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
4729 for (; ExpShape.More(); ExpShape.Next())
4731 aFace = TopoDS::Face(ExpShape.Current());
4732 TopLoc_Location aLoc;
4733 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
4734 if (aSurface == theSurface && aLoc == theLoc)
4737 Spls.Add(anEdge, aFace);
4740 TopoDS_Shape Result = Spls.Shape();
4741 DBRep::Set(a[1], Result);
4746 #include <ExprIntrp_GenExp.hxx>
4747 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4751 di << "Usage : " << argv[0] << " string\n";
4755 Standard_CString aString = argv[1];
4756 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
4759 myExpr->Process( aString );
4761 catch(Standard_Failure const& anException) {
4762 di << "Exception : " << anException.GetMessageString() << "\n";
4768 Standard_Integer OCC28478 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4770 Standard_Integer nbOuter = (argc > 1 ? Draw::Atoi(argv[1]) : 3);
4771 Standard_Integer nbInner = (argc > 2 ? Draw::Atoi(argv[2]) : 2);
4772 Standard_Boolean isInf = (argc > 3 && ! strcmp (argv[3], "-inf"));
4774 // test behavior of progress indicator when using nested scopes with names
4775 Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
4778 Message_ProgressScope anOuter (aProgress->Start(), "Outer", nbOuter);
4779 for (int i = 0; i < nbOuter && anOuter.More(); i++)
4782 Message_ProgressScope anInner (anOuter.Next(), "Inner", nbInner, isInf);
4783 for (int j = 0; j < (isInf ? 2 * nbInner : nbInner) && anInner.More(); j++, anInner.Next())
4792 Standard_Integer OCC31189 (Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char ** /*argv*/)
4794 // redirect output of default messenger to DRAW (temporarily)
4795 const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger();
4796 Message_SequenceOfPrinters aPrinters;
4797 aPrinters.Append (aMsgMgr->ChangePrinters());
4798 aMsgMgr->AddPrinter (new Draw_Printer (theDI));
4800 // scope block to test output of message on destruction of a stream buffer
4802 Message_Messenger::StreamBuffer aSender = Message::SendInfo();
4804 // check that messages output to sender and directly to messenger do not intermix
4805 aSender << "Sender message 1: start ...";
4806 aMsgMgr->Send ("Direct message 1");
4807 aSender << "... end" << std::endl; // endl should send the message
4809 // check that empty stream buffer does not produce output on destruction
4810 Message::SendInfo();
4812 // additional message to check that they go in expected order
4813 aMsgMgr->Send ("Direct message 2");
4815 // check that empty stream buffer does produce empty line if std::endl is passed
4816 Message::SendInfo() << std::endl;
4818 // last message should be sent on destruction of a sender
4819 aSender << "Sender message 2";
4822 // restore initial output queue
4823 aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer));
4824 aMsgMgr->ChangePrinters().Append (aPrinters);
4833 Message_ProgressRange Range;
4834 math_Matrix Mat1, Mat2, Mat3;
4836 Task(const Message_ProgressRange& thePR, int theSize)
4838 Mat1(1, theSize, 1, theSize, 0.12345), Mat2(1, theSize, 1, theSize, 12345),
4839 Mat3(1, theSize, 1, theSize)
4844 void operator()(Task& theTask) const
4846 Message_ProgressScope aPS(theTask.Range, NULL, 1);
4849 if (theTask.Mat1.RowNumber() > 1)
4850 theTask.Mat3 = theTask.Mat1 * theTask.Mat2;
4856 Standard_Integer OCC25748(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4858 // test behavior of progress indicator in multi-threaded execution
4859 Standard_Integer nIter = 1000;
4860 Standard_Integer aMatSize = 1;
4861 Standard_Boolean isProgress = false;
4862 Standard_Boolean isParallel = false;
4864 for (int i = 1; i < argc; i++)
4866 if (strcmp(argv[i], "-niter") == 0)
4867 nIter = Draw::Atoi(argv[++i]);
4868 else if (strcmp(argv[i], "-matsize") == 0)
4869 aMatSize = Draw::Atoi(argv[++i]);
4870 else if (strcmp(argv[i], "-progr") == 0)
4872 else if (strcmp(argv[i], "-parallel") == 0)
4876 di.PrintHelp("OCC25748");
4881 OSD_Timer aTimerWhole;
4882 aTimerWhole.Start();
4884 Handle(Draw_ProgressIndicator) aProgress;
4887 aProgress = new Draw_ProgressIndicator(di, 1);
4889 Message_ProgressScope aPS(Message_ProgressIndicator::Start(aProgress),
4890 "Parallel data processing", nIter);
4892 std::vector<Task> aTasks;
4893 aTasks.reserve (nIter);
4894 for (int i = 0; i < nIter; i++)
4896 aTasks.push_back (Task (aPS.Next(), aMatSize));
4901 OSD_Parallel::ForEach(aTasks.begin(), aTasks.end(), Functor(), !isParallel);
4906 TCollection_AsciiString aText(nIter);
4907 aText += (isParallel ? " parallel" : " sequential");
4909 aText = aText + " calculations on matrices " + aMatSize + "x" + aMatSize;
4911 aText += " empty tasks";
4913 aText += " with progress";
4914 di << "COUNTER " << aText << ": " << aTimer.ElapsedTime();
4915 di << "\nCOUNTER " << "including preparations" << ": " << aTimerWhole.ElapsedTime();
4919 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
4920 const char *group = "QABugs";
4922 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
4924 // Remove as bad version of QAAddOrRemoveSelected from QADraw
4925 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
4927 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
4928 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
4930 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
4931 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
4933 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
4935 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
4936 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
4937 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
4938 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
4939 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
4940 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
4943 theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
4944 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
4945 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
4947 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
4948 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
4949 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
4951 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
4952 theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
4954 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
4956 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
4957 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
4958 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
4959 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
4960 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
4961 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
4962 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
4963 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
4964 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
4965 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
4966 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
4967 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
4968 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
4969 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
4970 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
4971 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
4972 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
4973 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
4975 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
4976 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
4977 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
4978 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
4979 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
4981 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
4982 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
4984 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
4985 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
4986 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
4987 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
4988 theCommands.Add("OCC6143", "OCC6143 catching signals", __FILE__, OCC6143, group);
4989 theCommands.Add("OCC30775", "OCC30775 catching signals in threads", __FILE__, OCC30775, group);
4990 theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
4991 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
4992 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
4993 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
4994 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
4995 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
4996 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
4997 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
4998 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
4999 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5000 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5001 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5002 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5003 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5004 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5005 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5006 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5007 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5008 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5009 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5010 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);
5011 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5012 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5013 theCommands.Add("OCC28478", "OCC28478 [nb_outer=3 [nb_inner=2] [-inf]: test progress indicator on nested cycles", __FILE__, OCC28478, group);
5014 theCommands.Add("OCC31189", "OCC31189: check stream buffer interface of Message_Messenger", __FILE__, OCC31189, group);
5015 theCommands.Add("OCC25748", "OCC25748 [-niter val] [-matsize val] [-progr] [-parallel]\n"
5016 "\t\ttest progress indicator in parallel execution", __FILE__, OCC25748, group);