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_NameOfMaterial_Plastified);
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 static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
145 di<<"Usage: OCC136\n";
149 //create some primitives:
151 Standard_Real Size=100;
152 gp_Pnt P0(0,0,0), P1(Size,Size,Size);
154 TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
156 TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
158 gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
159 TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
161 anAx2.SetLocation(gp_Pnt(Size,0,0));
162 anAx2.SetDirection(gp_Dir(-1,-1,1));
163 TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
165 Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
166 if(anAISCtx.IsNull()){
167 di<<"Null interactive context. Use 'vinit' at first.\n";
171 anAISCtx->EraseAll (Standard_False);
173 //load primitives to context
174 Handle(AIS_InteractiveObject) aSh1 = new AIS_Shape(aBox);
175 anAISCtx->Display (aSh1, Standard_False);
177 Handle(AIS_InteractiveObject) aSh2 = new AIS_Shape(aSphere);
178 anAISCtx->Display (aSh2, Standard_False);
180 Handle(AIS_InteractiveObject) aSh3 = new AIS_Shape(aCone);
181 anAISCtx->Display (aSh3, Standard_False);
183 Handle(AIS_InteractiveObject) aSh4 = new AIS_Shape(aCyl);
184 anAISCtx->Display (aSh4, Standard_False);
187 anAISCtx->InitSelected();
188 anAISCtx->AddOrRemoveSelected (aSh1, Standard_False);
189 anAISCtx->AddOrRemoveSelected (aSh2, Standard_False);
190 anAISCtx->AddOrRemoveSelected (aSh3, Standard_False);
191 anAISCtx->AddOrRemoveSelected (aSh4, Standard_False);
193 //remove all this objects from context
194 anAISCtx->Remove (aSh1, Standard_False);
195 anAISCtx->Remove (aSh2, Standard_False);
196 anAISCtx->Remove (aSh3, Standard_False);
197 anAISCtx->Remove (aSh4, Standard_False);
199 anAISCtx->UpdateCurrentViewer();
203 static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
205 printf("Usage: %s iges_input [name]\n",argv[0]);
208 Standard_Character *Ch = NULL;
211 Ch = new Standard_Character[strlen(argv[2])+3];
213 IGESToBRep_Reader IR;
214 IR.LoadFile (argv[1]);
217 TopoDS_Shape aTopShape = IR.OneShape();
218 TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
219 Standard_Integer i=0;
220 for( ; ex.More(); ex.Next()){
221 const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
222 BRepAdaptor_Curve aCurve(E);
223 GCPnts_UniformDeflection plin(aCurve, 0.1);
224 di << "Num points = " << plin.NbPoints() << "\n";
227 Sprintf(Ch,"%s_%i",argv[2],1);
234 //====================================================
236 // Following code is inserted from
237 // /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
238 // ( 75455 Apr 16 18:59)
240 //====================================================
243 #include <BRepTools_WireExplorer.hxx>
244 #include <BRep_Tool.hxx>
245 #include <GCPnts_UniformAbscissa.hxx>
246 #include <TopExp.hxx>
249 // usage : OCC105 shape
252 //GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
254 //Value Pnt = -338.556216693211 -394.465571897208 0
256 //Value Pnt = -307.47165394 -340.18073533 0
258 static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
261 di<<"Usage : OCC105 shape\n";
264 // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
265 TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
266 Standard_Real l = 0.5; //Draw::Atof(argv[2]);
267 // Find the first vertex of the wire
268 BRepTools_WireExplorer wire_exp(myTopoDSWire);
271 TopoDS_Vertex vw1, vw2;
272 TopExp::Vertices(myTopoDSWire,vw1,vw2);
273 TopoDS_Vertex ve1, ve2;
274 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
275 TopExp::Vertices(edge,ve1,ve2);
276 if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
279 // assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
283 for ( ; wire_exp.More(); wire_exp.Next())
285 di << "\n\n New Edge \n" << "\n";
286 Standard_Real newufirst, newulast;
287 TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
288 Standard_Real ufirst, ulast;
289 Handle(Geom_Curve) acurve;
290 TopoDS_Vertex ve1, ve2;
291 TopExp::Vertices(edge,ve1,ve2);
292 if (ve1.IsSame(vlast))
294 acurve = BRep_Tool::Curve(edge, ufirst, ulast);
301 // assert(ve2.IsSame(vlast));
302 // assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
303 acurve = BRep_Tool::Curve( edge, ufirst, ulast );
304 newufirst = acurve->ReversedParameter( ufirst );
305 newulast = acurve->ReversedParameter( ulast );
306 acurve = acurve->Reversed( );
310 GeomAdaptor_Curve curve;
311 GCPnts_UniformAbscissa algo;
313 algo.Initialize( curve, l, newufirst, newulast );
315 di << "Not Done!!!" << "\n";
316 for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
317 Standard_Real t = algo.Parameter(Index);
318 gp_Pnt pt3 = curve.Value(t);
319 di << "Parameter t = " << t << "\n";
320 di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z() << "\n";
327 #include <TColStd_SequenceOfTransient.hxx>
328 #include <GeomFill_Pipe.hxx>
329 static int pipe_OCC9 (Draw_Interpretor& di,
330 Standard_Integer n, const char ** a)
333 di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]\n";
337 TColStd_SequenceOfTransient aCurveSeq;
339 for (i=2 ; i<=4; i++) {
340 Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
342 di << a[i] << " is not a curve\n";
345 aCurveSeq.Append(aC);
348 GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
349 Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
350 Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
354 aPipe.Perform(Draw::Atof (a[6]), Standard_True);
356 aPipe.Perform(Standard_True/*, Standard_True*/);
359 if (!aPipe.IsDone()) {
360 di << "GeomFill_Pipe cannot make a surface\n";
364 Handle(Geom_Surface) aSurf = aPipe.Surface();
366 DrawTrSurf::Set(a[1], aSurf);
370 //======================================================================
372 // usage : OCC125 shell
373 //======================================================================
374 #include <ShapeFix_Shell.hxx>
376 Standard_Integer OCC125(Draw_Interpretor& di ,
381 di<<" Use OCC125 shell";
385 TopoDS_Shape S = DBRep::Get(a[1]);
388 di<<" Null shape is not allowed";
394 if (aT!=TopAbs_SHELL) {
395 di<<" Shape Type must be SHELL";
399 const TopoDS_Shell& aShell = TopoDS::Shell(S);
401 Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
403 isAccountMultiConex=Standard_True;
404 bNonManifold=Standard_False;
406 Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
407 bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
409 di<<"bResult="<<(Standard_Integer)bResult;
412 aShape=aFix->Shape();
414 TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
417 DBRep::Set (aRName.ToCString(), aShape);
418 di<<aRName.ToCString();
423 #include <BRepLib_FindSurface.hxx>
424 #include <BRepBuilderAPI_MakeFace.hxx>
425 Standard_Integer OCC157(Draw_Interpretor& di,
428 //static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
431 di << "bad number of arguments\n";
435 // try to read a shape:
436 TopoDS_Shape inputShape=DBRep::Get(a[2]);
437 if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
438 di << "Invalid input shape\n";
441 Standard_Real toler = Draw::Atof(a[3]);
442 TopoDS_Wire aWire = TopoDS::Wire(inputShape);
443 BRepLib_FindSurface FS(aWire, toler, Standard_True);
445 di<<"OCC157: OK; Planar surface is found\n";
446 Handle(Geom_Surface) aSurf = FS.Surface();
447 BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
448 if(aMakeFace.IsDone()) {
449 TopoDS_Face aFace = aMakeFace.Face();
450 DBRep::Set(a[1],aFace);
453 else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
458 // #include <MyCommandsCMD.h>
459 #include <ShapeFix_Shape.hxx>
460 #include <BRepOffset_MakeOffset.hxx>
461 #include <BRepOffsetAPI_MakeOffset.hxx>
462 #include <BRepOffset_Mode.hxx>
463 #include <GeomAbs_JoinType.hxx>
464 #include <AIS_Shape.hxx>
466 #include <BRepTools.hxx>
468 Standard_Integer OCC165(Draw_Interpretor& di ,
473 //=======================================================================
475 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
477 // void MyOffsets_Commands(Draw_Interpretor& theCommands)
479 // theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
482 //=======================================================================
484 // static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
488 di <<"Usage : " << a[0] << " [file]\n";
493 #define _OFFSET_TELCO_
494 #ifdef _OFFSET_TELCO_
496 Standard_CString file = a[1];
498 BRep_Builder aBuilder;
499 TopoDS_Shape theShape;
500 //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
501 BRepTools::Read(theShape, file, aBuilder);
502 DBRep::Set("shape", theShape);
504 TopoDS_Wire theWire = TopoDS::Wire(theShape);
506 Standard_Real anOffset = 1.5;
510 Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
511 yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
512 zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
514 BRepBuilderAPI_MakePolygon theSquare;
515 TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
517 TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
519 TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
521 TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
525 TopoDS_Wire theWire = theSquare.Wire();
527 Standard_Real anOffset = 10;
530 #endif /* _OFFSET_TELCO_ */
533 TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
534 DBRep::Set("face", theFace);
537 Standard_Real anAlt = 0.;
538 GeomAbs_JoinType theJoin = GeomAbs_Intersection;
539 //GeomAbs_Intersection; //GeomAbs_Arc;
540 BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
541 aMakeOffset.AddWire(theWire);
543 aMakeOffset.Perform(anOffset, anAlt);
545 TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
546 DBRep::Set("offset", theOffsetShapePos);
551 #include<BRepAlgoAPI_Cut.hxx>
553 #include<BRepPrimAPI_MakeHalfSpace.hxx>
554 #include<Geom_CartesianPoint.hxx>
555 #include<AIS_Point.hxx>
557 #include <BRepBuilderAPI_MakeEdge.hxx>
558 #include <BRepBuilderAPI_MakeWire.hxx>
559 #include <BRepBuilderAPI_MakeFace.hxx>
561 static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
564 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
565 if (myAISContext.IsNull()) {
566 di << "use 'vinit' command before " << argv[0] << "\n";
570 gp_Pnt pt1_(250., 250., 0.);
571 gp_Pnt pt2_(-250., 250., 0.);
572 gp_Pnt pt3_(-250., -250., 0.);
573 gp_Pnt pt4_(250., -250., 0.);
574 BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
575 BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
576 BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
577 BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
579 BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
580 BRepBuilderAPI_MakeFace face_(wire_);
581 TopoDS_Face sh_ = face_.Face();
587 g_pnt = gp_Pnt(0, 0, -100);
589 g_pnt = gp_Pnt(0, 0, 100);
591 myAISContext->EraseAll(Standard_False);
592 Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
593 Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
594 myAISContext->Display(AISPoint, Standard_True);
596 BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
597 TopoDS_Solid sol1_ = half_.Solid();
599 DBRep::Set("Face", sol1_);
601 gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
603 Standard_Real x = 0., y = 0., z = -80.;
605 BRepPrimAPI_MakeBox box(gp_Pnt(x, y, z), gp_Pnt(x + 150, y + 200, z + 200));
607 DBRep::Set("Box", box.Shape());
613 #include<GProp_GProps.hxx>
614 #include<BRepGProp.hxx>
616 static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
621 di <<"Usage : " << argv[0] << " file\n";
624 Standard_CString file = argv[1];
626 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
627 if(myAISContext.IsNull()) {
628 di << "use 'vinit' command before " << argv[0] << "\n";
633 BRep_Builder builder;
634 //BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
635 BRepTools::Read(sh, file, builder);
638 builder.MakeWire(wire);
640 TopoDS_Vertex vt1, vt2;
641 TopExp_Explorer wex(sh, TopAbs_EDGE);
642 for(;wex.More();wex.Next())
644 ed = TopoDS::Edge(wex.Current());
645 TopExp::Vertices(ed, vt1, vt2);
646 builder.UpdateVertex(vt1, 0.01);
647 builder.UpdateVertex(vt2, 0.01);
648 builder.UpdateEdge(ed, 0.01);
649 builder.Add(wire, ed);
653 BRepGProp::LinearProperties(ed, lprop);
654 printf("\n length = %f", lprop.Mass());
656 DBRep::Set("Wire",wire);
657 // Handle(AIS_Shape) res = new AIS_Shape( wire );
658 // aContext->SetColor( res, Quantity_NOC_RED );
659 // aContext->Display( res );
661 // BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
662 // off.Perform(0.5, 0);
664 // printf("\n IsDone = %d", off.IsDone());
666 // res = new AIS_Shape( sh );
667 // aContext->SetColor( res, Quantity_NOC_GREEN );
668 // aContext->Display( res );
674 #include <TDocStd_Document.hxx>
675 #include <DDocStd.hxx>
676 #include <PCDM_StoreStatus.hxx>
677 #include <TDocStd_Application.hxx>
679 static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
682 di << "Usage: " << a[0] << " Doc\n";
686 Handle(TDocStd_Document) D;
687 if (!DDocStd::GetDocument(a[1],D)) return 1;
689 Handle(TDocStd_Application) A = DDocStd::GetApplication();
691 TCollection_ExtendedString theStatusMessage;
693 di << "this document has never been saved\n";
696 PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
697 if (theStatus != PCDM_SS_OK ) {
698 switch ( theStatus ) {
699 case PCDM_SS_DriverFailure: {
700 di << "Error saving document: Could not store , no driver found to make it\n";
703 case PCDM_SS_WriteFailure: {
704 di << "Error saving document: Write access failure\n";
707 case PCDM_SS_Failure: {
708 di << "Error saving document: Write failure\n" ;
711 case PCDM_SS_Doc_IsNull: {
712 di << "Error saving document: No document to save\n";
715 case PCDM_SS_No_Obj: {
716 di << "Error saving document: No objects written\n";
719 case PCDM_SS_Info_Section_Error: {
720 di << "Error saving document: Write info section failure\n" ;
731 static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
734 di << "Usage: " << a[0] << " Doc Path\n";
738 Handle(TDocStd_Document) D;
739 if (!DDocStd::GetDocument(a[1],D)) return 1;
741 TCollection_ExtendedString path (a[2]);
742 Handle(TDocStd_Application) A = DDocStd::GetApplication();
744 TCollection_ExtendedString theStatusMessage;
745 PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
746 if (theStatus != PCDM_SS_OK ) {
747 switch ( theStatus ) {
748 case PCDM_SS_DriverFailure: {
749 di << "Error saving document: Could not store , no driver found to make it\n";
752 case PCDM_SS_WriteFailure: {
753 di << "Error saving document: Write access failure\n";
756 case PCDM_SS_Failure: {
757 di << "Error saving document: Write failure\n" ;
760 case PCDM_SS_Doc_IsNull: {
761 di << "Error saving document: No document to save\n";
764 case PCDM_SS_No_Obj: {
765 di << "Error saving document: No objects written\n";
768 case PCDM_SS_Info_Section_Error: {
769 di << "Error saving document: Write info section failure\n" ;
781 #include <BRepClass3d_SolidClassifier.hxx>
783 Standard_Integer OCC299bug (Draw_Interpretor& theDi,
784 Standard_Integer theArgNb,
785 const char** theArgVec)
789 theDi << "Usage : " << theArgVec[0] << " Solid Point [Tolerance=1.e-7]\n";
793 TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
796 theDi << " Null Shape is not allowed here\n";
799 else if (aS.ShapeType() != TopAbs_SOLID)
801 theDi << " Shape type must be SOLID\n";
805 gp_Pnt aP (8., 9., 10.);
806 if (!DrawTrSurf::GetPoint (theArgVec[2], aP))
808 theDi << " Null Point is not allowed here\n";
811 const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : 1.e-7;
813 BRepClass3d_SolidClassifier aSC (aS);
814 aSC.Perform (aP, aTol);
818 case TopAbs_IN: theDi << "The point is IN shape\n"; return 0;
819 case TopAbs_OUT: theDi << "The point is OUT of shape\n"; return 0;
820 case TopAbs_ON: theDi << "The point is ON shape\n"; return 0;
822 default: theDi << "The point is UNKNOWN shape\n"; return 0;
826 #include <OSD_Process.hxx>
827 #include <OSD_Path.hxx>
829 static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
832 di << "Usage: " << a[0] << "\n";
836 OSD_Path d = p.CurrentDirectory();
837 TCollection_AsciiString s;
839 di << "*" << s.ToCString() << "*\n";
842 di << "*" << s.ToCString() << "*\n";
846 static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
849 di << "Usage: " << a[0] << "\n";
852 OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
853 di << p.Trek().ToCString() << "\n";
855 di << p.Trek().ToCString() << "\n";
859 #include <BRepAlgoAPI_Fuse.hxx>
860 #include <BRepAlgoAPI_Common.hxx>
862 static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
865 di << "Usage : " << a[0] << "\n";
869 BRepPrimAPI_MakeBox box1( 100, 100, 100 );
870 BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
872 TopoDS_Shape shape1 = box1.Shape();
873 TopoDS_Shape shape2 = box2.Shape();
875 TopoDS_Shape fuse,comm;
876 di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )\n";
877 di << "comm = BRepAlgoAPI_Common( shape1, shape2 )\n";
878 fuse = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
879 comm = BRepAlgoAPI_Common(shape1, shape2).Shape();
884 #include <DDocStd_DrawDocument.hxx>
885 #include <TDataStd_Name.hxx>
887 #include <XCAFDoc_ShapeTool.hxx>
888 #include <XCAFDoc_DocumentTool.hxx>
889 #include <TDF_LabelSequence.hxx>
890 #include <TPrsStd_AISPresentation.hxx>
891 #include <TDF_Data.hxx>
892 #include <TDF_Label.hxx>
893 #include <XCAFPrs_Driver.hxx>
895 //------------------------------------------------------------------------------------------
898 //------------------------------------------------------------------------------------------
899 static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
904 // 1. Verufy amount of arguments
905 if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
907 // 2. Retrieve DDocStd application
908 Handle(TDocStd_Application) App = DDocStd::GetApplication();
911 TCollection_ExtendedString name(argv[2]);
912 Handle(TDocStd_Document) Doc;
913 if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
914 Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
915 TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
916 Draw::Set(argv[1],DD);
918 // 4. Create prsentations
919 Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
920 TDF_LabelSequence seq;
921 shapes->GetFreeShapes ( seq );
922 Handle(TPrsStd_AISPresentation) prs;
923 for ( Standard_Integer i=1; i <= seq.Length(); i++ )
924 if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
925 prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
927 catch(Standard_Failure const&) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
934 ////======================================================================================
935 //// Function : OCC372
937 ////======================================================================================
938 //static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
943 // // 1. Verufy amount of arguments
944 // if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
949 // BRepTools::Read(Ref, argv[1], B);
951 // // 3. Calculate location of aP3d in relation to the solid
952 // gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
953 // BRepClass3d_SolidClassifier SC(Ref);
954 // SC.Perform(aP3d, 1e-7);
956 // // 4. Check returned state. The point must be inside the solid.
957 // TopAbs_State aState=SC.State();
961 // di<<"OCC372 FAULTY. aState = TopAbs_OUT";
964 // di<<"OCC372 FAULTY. aState = TopAbs_ON";
967 // di<<"OCC372 OK. aState = TopAbs_IN" ;
970 // di<<"OCC372 FAULTY. aState = UNKNOWN";
974 // catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
979 #include <BRepTopAdaptor_FClass2d.hxx>
981 //======================================================================================
984 //======================================================================================
985 static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
990 // 1. Verify validity of arguments
991 if ( argc < 1 ) {di << "Error OCC377. Use OCC377 file x y precuv \n";return 0;}
993 // 2. Initialize parameters
995 p2d.SetX ( Draw::Atof(argv[2]) );
996 p2d.SetY ( Draw::Atof(argv[3]) );
997 Standard_Real precuv = Draw::Atof (argv[4] );
1002 BRepTools::Read ( Shape, argv[1], B );
1004 // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
1005 TopExp_Explorer exp;
1006 Standard_Integer i=1;
1007 for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
1009 // 4.1. Verify whether enrtry point is on wire
1010 const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
1011 TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
1013 TopAbs_Orientation orWire = wir.Orientation();
1014 newFace.Orientation(TopAbs_FORWARD);
1017 BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
1018 TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
1019 //di << "Wire " << i << ": Infinite point is " <<
1020 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1022 TCollection_AsciiString TmpString;
1023 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1024 di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1026 stat1 = FClass2d1.Perform(p2d);
1027 //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1028 // ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1031 stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1032 di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1034 // 4.2. Verify whether enrtry point is on reversed wire
1035 newFace = TopoDS::Face(Shape.EmptyCopied());
1036 newFace.Orientation(TopAbs_FORWARD);
1037 orWire = TopAbs::Reverse(orWire);
1038 B.Add(newFace,wir.Oriented(orWire));
1039 BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
1040 TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
1041 //di << "Reversed Wire " << i << ": Infinite point is " <<
1042 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1045 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1046 di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
1048 stat2 = FClass2d2.Perform(p2d);
1049 //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
1050 // ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
1053 stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
1054 di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
1056 // 4.3. Compare results (they must be same)
1057 if(stat1 ==stat2) di << "OCC377 OK\n";
1058 else {di << "OCC377 FAULTY\n"; return 0;}
1061 catch(Standard_Failure const&)
1063 di << "OCC377 Exception";
1069 #include <ShapeUpgrade_ShapeDivideAngle.hxx>
1070 #include <ShapeBuild_ReShape.hxx>
1072 //=======================================================================
1075 //=======================================================================
1076 static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1081 // 1. Verify arguments of the command
1082 if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
1084 Standard_Boolean aConsiderLocation;
1085 if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
1086 else aConsiderLocation = Standard_True;
1088 // 2. Iniitialize aShapeUpgrade
1089 ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
1091 aShapeUpgrade.SetPrecision (Precision::Confusion());
1093 aShapeUpgrade.SetMaxTolerance(0.1);
1094 // subshapes to be divided
1095 TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
1096 if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
1097 aShapeUpgrade.Init(aSubShapesToBeDivided);
1099 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1100 aShapeUpgrade.SetContext(aReshape);
1101 if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
1103 // 3. Perform splitting
1104 if (aShapeUpgrade.Perform (Standard_False)) di << "Upgrade_SplitRevolution_Done \n";
1105 else if (aShapeUpgrade.Status (ShapeExtend_OK)) di << "Upgrade_SplitRevolution_OK \n";
1106 else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
1108 // 4. Perform rebuilding shape
1109 // 4.1. Retrieve Shape
1110 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1111 if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1112 // 4.2 Rebuid retrieved shape
1113 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1114 // 4.3. Create result Draw shape
1115 DBRep::Set(argv[1], aResultShape);
1117 catch (Standard_Failure const&) {di << "OCC22 Exception \n" ;return 0;}
1123 #include <ShapeProcess_OperLibrary.hxx>
1124 #include <ShapeProcess_ShapeContext.hxx>
1125 #include <ShapeProcess.hxx>
1127 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
1128 #include <BRepMesh_IncrementalMesh.hxx>
1129 #include <IMeshTools_Parameters.hxx>
1131 //=======================================================================
1134 //=======================================================================
1135 static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1140 // 1. Verify amount of arguments of the command
1141 if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
1143 // 2. Retrieve parameters
1145 TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
1146 if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
1147 // compound of subshapes
1148 TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
1149 if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
1150 // name of resource file
1151 const char* aResourceFile = argv[4];
1152 // name of sequence from resource file to be executed
1153 const char* aSequenceName = argv[5];
1155 // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
1156 ShapeProcess_OperLibrary::Init();
1157 Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
1158 aShapeContext->SetDetalisation (TopAbs_EDGE);
1159 ShapeProcess::Perform (aShapeContext, aSequenceName);
1161 // 4. Rebuild initil shape in accordance with performed operation
1162 Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
1163 TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
1164 for (; anIter.More(); anIter.Next())
1165 aReshape->Replace(anIter.Key(), anIter.Value());
1166 TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
1168 // 5 Create resultant Draw shape
1169 DBRep::Set(argv[1], aResultShape);
1172 catch (Standard_Failure const&) {di << "OCC24 Exception \n" ;return 0;}
1177 //=======================================================================
1179 //purpose : Verify whether exception occurs during building mesh
1180 //=======================================================================
1181 static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1186 // 1. Verify amount of arguments of the command
1187 if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
1189 // 2. Retrieve shape
1190 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1191 if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
1194 IMeshTools_Parameters aMeshParams;
1195 aMeshParams.Relative = Standard_True;
1196 aMeshParams.Deflection = 0.2;
1197 aMeshParams.Angle = M_PI / 6.0;
1198 BRepMesh_IncrementalMesh aMesh(aShape, aMeshParams);
1201 catch (Standard_Failure const&) {di << "OCC369 Exception \n" ;return 0;}
1203 di << "OCC369 OK \n";
1207 #include <math_Vector.hxx>
1208 #include <math_Matrix.hxx>
1209 static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1212 di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
1215 Standard_Integer LowerVector = Draw::Atoi(argv[1]);
1216 Standard_Integer UpperVector = Draw::Atoi(argv[2]);
1217 Standard_Real InitialValueVector = Draw::Atof(argv[3]);
1218 Standard_Integer LowerRowMatrix = Draw::Atoi(argv[4]);
1219 Standard_Integer UpperRowMatrix = Draw::Atoi(argv[5]);
1220 Standard_Integer LowerColMatrix = Draw::Atoi(argv[6]);
1221 Standard_Integer UpperColMatrix = Draw::Atoi(argv[7]);
1222 Standard_Real InitialValueMatrix = Draw::Atof(argv[8]);
1224 math_Vector Vector1(LowerVector, UpperVector);
1225 math_Vector Vector2(LowerVector, UpperVector);
1227 math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
1228 math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
1230 //Vector.Dump(std::cout);
1231 //std::cout<<std::endl;
1233 //Matrix.Dump(std::cout);
1234 //std::cout<<std::endl;
1236 Vector1.Multiply(Vector, Matrix);
1238 //Vector1.Dump(std::cout);
1239 Standard_SStream aSStream1;
1240 Vector1.Dump(aSStream1);
1244 if (Matrix.RowNumber() > 1) {
1245 Matrix(Matrix.LowerRow() + 1, Matrix.LowerCol()) += 1.;
1247 Vector2.TMultiply(Vector, Matrix);
1249 //Vector2.Dump(std::cout);
1250 Standard_SStream aSStream2;
1251 Vector2.Dump(aSStream2);
1258 #include <GeomPlate_BuildPlateSurface.hxx>
1259 //=======================================================================
1262 //=======================================================================
1263 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
1265 GeomPlate_BuildPlateSurface aBuilder;
1268 if (aBuilder.IsDone())
1270 di << "Error in OCC525. Null result is expected.\n";
1274 di << "OCC525 OK \n";
1280 #include <BRepPrimAPI_MakeWedge.hxx>
1281 #include <gce_MakeRotation.hxx>
1282 #include <gce_MakeTranslation.hxx>
1283 #include <BRepBuilderAPI_Transform.hxx>
1284 #include <BRepPrimAPI_MakeWedge.hxx>
1285 //=======================================================================
1288 //=======================================================================
1289 static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1292 di << "Usage : " << argv[0] << " shape1 shape2 shape3\n";
1297 double xperiod = 1.0;
1298 double yperiod = 1.0;
1299 double sub_thick = 0.5;
1302 //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
1303 TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
1305 // --------------------------------------------------------------------
1308 //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1309 // 0.1, 0.1 , 0.4, 0.4 );
1310 TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
1311 0.1, 0.1 , 0.4, 0.4 ).Shape();
1313 gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1314 gp_Dir(1.0,0.0,0.0),
1317 gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
1318 gp_Pnt( 0.25, 0.25, 0.5)
1321 rotate.PreMultiply( translate );
1323 TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
1325 if (wedge1a.IsNull()) {
1326 di<<" Null shape1 is not allowed\n";
1329 DBRep::Set(argv[1], wedge1a);
1331 // --------------------------------------------------------------------
1334 //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1335 // 0.1, 0.1 , 0.4, 0.4 );
1336 TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
1337 0.1, 0.1 , 0.4, 0.4 ).Shape();
1339 gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
1340 gp_Dir(1.0,0.0,0.0),
1343 gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
1344 gp_Pnt( 0.25, 0.25, 0.5)
1347 rotate2.PreMultiply( translate2 );
1349 TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
1351 if (wedge2a.IsNull()) {
1352 di<<" Null shape2 is not allowed\n";
1355 DBRep::Set(argv[2], wedge2a);
1359 di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)\n";
1360 TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a).Shape();
1362 di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)\n";
1363 TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common).Shape();
1365 if (sub_etch1.IsNull()) {
1366 di<<" Null shape3 is not allowed\n";
1369 DBRep::Set(argv[3], sub_etch1);
1374 #include <Standard_GUID.hxx>
1375 //=======================================================================
1378 //=======================================================================
1379 static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1382 di<<"Usage : " << argv[0] << " GUID\n";
1385 Standard_GUID guid(argv[1]);
1386 //guid.ShallowDump(std::cout);
1387 Standard_SStream aSStream;
1388 guid.ShallowDump(aSStream);
1394 #include <XCAFDoc.hxx>
1395 //=======================================================================
1396 //function : OCC738_ShapeRef
1398 //=======================================================================
1399 static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1402 di<<"Usage : " << argv[0] << "\n";
1405 const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
1406 //guid.ShallowDump(std::cout);
1407 Standard_SStream aSStream;
1408 guid.ShallowDump(aSStream);
1413 //=======================================================================
1414 //function : OCC738_Assembly
1416 //=======================================================================
1417 static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1420 di<<"Usage : " << argv[0] << "\n";
1423 const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
1424 //guid.ShallowDump(std::cout);
1425 Standard_SStream aSStream;
1426 guid.ShallowDump(aSStream);
1431 #if defined(DDataStd_def01)
1432 #include <DDataStd_DrawPresentation.hxx>
1433 //=======================================================================
1434 //function : OCC739_DrawPresentation
1436 //=======================================================================
1437 static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1440 di<<"Usage : " << argv[0] << "\n";
1443 const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
1444 //guid.ShallowDump(std::cout);
1445 Standard_SStream aSStream;
1446 guid.ShallowDump(aSStream);
1452 //=======================================================================
1455 //=======================================================================
1456 static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1458 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1459 if(aContext.IsNull()) {
1460 di << argv[0] << "ERROR : use 'vinit' command before \n";
1465 di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation\n";
1469 Standard_Boolean updateviewer = Standard_True;
1471 ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
1473 TCollection_AsciiString aName(argv[1]);
1474 Handle(AIS_InteractiveObject) AISObj;
1476 if (!aMap.Find2 (aName, AISObj)
1479 di << "Use 'vdisplay' before\n";
1483 AISObj->ResetTransformation();
1485 aContext->Erase(AISObj, updateviewer);
1486 aContext->UpdateCurrentViewer();
1487 aContext->Display(AISObj, updateviewer);
1488 aContext->UpdateCurrentViewer();
1492 //=======================================================================
1495 //=======================================================================
1496 #include <TColStd_Array2OfInteger.hxx>
1497 static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1500 di<<"Usage : " << argv[0] << "\n";
1504 // check that exception initialized without message string can be safely handled and printed
1506 throw Standard_OutOfRange();
1508 catch (Standard_Failure const& anException) {
1509 std::cout << "Caught successfully: ";
1510 std::cout << anException << std::endl;
1515 #include <GeomAPI_ProjectPointOnSurf.hxx>
1516 //=======================================================================
1519 //=======================================================================
1520 static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1524 di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
1529 DrawTrSurf::GetPoint(argv[1],aPoint3d);
1530 Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
1531 Standard_Real Umin=Draw::Atof(argv[3]);
1532 Standard_Real Usup=Draw::Atof(argv[4]);
1533 Standard_Real Vmin=Draw::Atof(argv[5]);
1534 Standard_Real Vsup=Draw::Atof(argv[6]);
1536 if (aSurface.IsNull()) {
1537 di << argv[2] << " Null surface \n" ;
1541 GeomAPI_ProjectPointOnSurf PonSurf;
1542 PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
1543 PonSurf.Perform(aPoint3d);
1548 //=======================================================================
1551 //=======================================================================
1552 static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1556 di<<"Usage : " << argv[0] << " wire face\n";
1560 TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
1561 TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
1562 if (awire.IsNull() || aface.IsNull()) {
1563 di << "Null object\n";
1567 Standard_Integer count = 0;
1568 TopExp_Explorer TE(awire, TopAbs_VERTEX);
1570 BRepTools_WireExplorer WE;
1571 for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
1572 TopoDS_Edge E = WE.Current();
1576 di << "Count = " << count << "\n";
1581 //=======================================================================
1584 //=======================================================================
1585 static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1589 di <<"Usage : " << argv[0] << " face\n";
1592 Standard_Real u1, u2, v1, v2;
1593 TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
1596 BRepTools::UVBounds(F, u1, u2, v1, v2);
1597 di << "Bounds: " << u1 << " " << u2 << " " << v1 << " " << v2 << "\n";
1601 #include <Expr_NamedUnknown.hxx>
1602 #include <Expr_GeneralExpression.hxx>
1603 #include <Expr_Exponential.hxx>
1604 #include <ExprIntrp_GenExp.hxx>
1605 //=======================================================================
1608 //=======================================================================
1609 static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1613 di <<"Usage : " << argv[0] << " expression\n";
1617 TCollection_AsciiString anExpStr(argv[1]);
1618 anExpStr.AssignCat("*x");
1619 anExpStr.Prepend("Exp(");
1620 anExpStr.AssignCat(")");
1622 Handle(ExprIntrp_GenExp) exprIntrp = ExprIntrp_GenExp::Create();
1625 // Create the expression
1626 exprIntrp->Process(anExpStr);
1628 if (!exprIntrp->IsDone())
1630 di << "Interpretation of expression " << argv[1] << " failed\n";
1635 Handle(Expr_GeneralExpression) anExpr = exprIntrp->Expression();
1636 Handle(Expr_NamedUnknown) aVar = new Expr_NamedUnknown("x");
1637 Handle (Expr_GeneralExpression) newExpr = anExpr->Derivative(aVar);
1640 TCollection_AsciiString res = newExpr->String();
1641 Standard_CString resStr = res.ToCString();
1642 TCollection_AsciiString res_old = anExpr->String();
1643 Standard_CString res_oldStr = res_old.ToCString();
1646 di << "X = " << argv[1] << "\n";
1647 di << "Y = " << res_oldStr << "\n";
1648 di << "Y' = " << resStr << "\n";
1654 #include <TPrsStd_AISViewer.hxx>
1655 #include <TDF_Label.hxx>
1656 #include <TPrsStd_AISPresentation.hxx>
1657 //=======================================================================
1658 //function : OCC1029_AISTransparency
1659 //purpose : OCC1029_AISTransparency (DOC,entry,[real])
1660 //=======================================================================
1662 static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
1663 Standard_Integer nb,
1667 Handle(TDocStd_Document) D;
1668 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1670 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1672 Handle(TPrsStd_AISViewer) viewer;
1673 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1675 Handle(TPrsStd_AISPresentation) prs;
1676 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1678 prs->SetTransparency(Draw::Atof(arg[3]));
1679 TPrsStd_AISViewer::Update(L);
1682 di << "Transparency = " << prs->Transparency() << "\n";
1687 di << arg[0] << " : Error\n";
1691 //=======================================================================
1692 //function : OCC1031_AISMaterial
1693 //purpose : OCC1031_AISMaterial (DOC,entry,[material])
1694 //=======================================================================
1696 static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
1697 Standard_Integer nb,
1701 Handle(TDocStd_Document) D;
1702 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1704 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1706 Handle(TPrsStd_AISViewer) viewer;
1707 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1709 Handle(TPrsStd_AISPresentation) prs;
1710 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1712 prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3]));
1713 TPrsStd_AISViewer::Update(L);
1716 di << "Material = " << prs->Material() << "\n";
1721 di << arg[0] << " : Error\n";
1725 //=======================================================================
1726 //function : OCC1032_AISWidth
1727 //purpose : OCC1032_AISWidth (DOC,entry,[width])
1728 //=======================================================================
1730 static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
1731 Standard_Integer nb,
1735 Handle(TDocStd_Document) D;
1736 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1738 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1740 Handle(TPrsStd_AISViewer) viewer;
1741 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1743 Handle(TPrsStd_AISPresentation) prs;
1744 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1746 prs->SetWidth(Draw::Atof(arg[3]));
1747 TPrsStd_AISViewer::Update(L);
1750 di << "Width = " << prs->Width() << "\n";
1755 di << arg[0] << " : Error\n";
1759 //=======================================================================
1760 //function : OCC1033_AISMode
1761 //purpose : OCC1033_AISMode (DOC,entry,[mode])
1762 //=======================================================================
1764 static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
1765 Standard_Integer nb,
1769 Handle(TDocStd_Document) D;
1770 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1772 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1774 Handle(TPrsStd_AISViewer) viewer;
1775 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1777 Handle(TPrsStd_AISPresentation) prs;
1778 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1780 prs->SetMode(Draw::Atoi(arg[3]));
1781 TPrsStd_AISViewer::Update(L);
1784 di << "Mode = " << prs->Mode() << "\n";
1789 di << arg[0] << " : Error\n";
1793 //=======================================================================
1794 //function : OCC1034_AISSelectionMode
1795 //purpose : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
1796 //=======================================================================
1798 static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
1799 Standard_Integer nb,
1803 Handle(TDocStd_Document) D;
1804 if (!DDocStd::GetDocument(arg[1],D)) return 1;
1806 if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
1808 Handle(TPrsStd_AISViewer) viewer;
1809 if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
1811 Handle(TPrsStd_AISPresentation) prs;
1812 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
1814 prs->SetSelectionMode(Draw::Atoi(arg[3]));
1815 TPrsStd_AISViewer::Update(L);
1818 di << "SelectionMode = " << prs->SelectionMode() << "\n";
1823 di << arg[0] << " : Error\n";
1827 //=======================================================================
1828 //function : OCC1487
1830 //=======================================================================
1831 static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1834 di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape\n";
1838 Standard_Integer CaseNumber = Draw::Atoi(argv[1]);
1840 //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
1841 gp_Dir myDir(1,0,0);
1842 gp_Pnt myPnt(0,-50,140);
1843 gp_Ax2 myAx2(myPnt, myDir);
1844 BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
1846 TopoDS_Shape cyl1 = o_mc1.Shape();
1849 TopoDS_Shape o_cut_shape;
1850 if (CaseNumber == 1) {
1851 //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);
1852 gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
1853 gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
1854 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
1855 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
1857 cyl2 = o_mc2.Shape();
1858 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
1859 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
1861 //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);
1862 gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
1863 gp_Pnt myPnt_mc2(978.34936, -50.0, 127.5);
1864 gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
1865 BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
1867 cyl2 = o_mc2.Shape();
1868 di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
1869 o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
1872 DBRep::Set(argv[2],cyl1);
1873 DBRep::Set(argv[3],cyl2);
1874 DBRep::Set(argv[4],o_cut_shape);
1879 #include<TopTools_ListIteratorOfListOfShape.hxx>
1880 #include<BRepFilletAPI_MakeFillet.hxx>
1881 //=======================================================================
1882 //function : OCC1077
1884 //=======================================================================
1885 TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
1887 Standard_Real t3d = 1.e-4;
1888 Standard_Real t2d = 1.e-5;
1889 Standard_Real ta = 1.e-2;
1890 Standard_Real fl = 1.e-3;
1891 Standard_Real tapp_angle = 1.e-2;
1892 GeomAbs_Shape blend_cont = GeomAbs_C1;
1894 TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
1896 TopTools_ListIteratorOfListOfShape its;
1898 TopoDS_Compound result;
1900 B.MakeCompound(result);
1903 for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
1905 const TopoDS_Shape& cutsol = ex.Current();
1907 BRepFilletAPI_MakeFillet fill(cutsol);
1908 fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
1909 fill.SetContinuity(blend_cont, tapp_angle);
1910 its = aBoolenaOperation.SectionEdges();
1913 TopoDS_Edge E = TopoDS::Edge(its.Value());
1914 fill.Add(aRadius, E);
1921 B.Add(result, fill.Shape());
1925 B.Add(result, cutsol);
1931 TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
1933 //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
1934 BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
1935 return OCC1077_boolbl(aCut,aRadius);
1938 //TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
1940 // return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
1943 TopoDS_Shape OCC1077_Bug()
1945 TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
1946 TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
1948 TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
1949 TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
1950 gp_Dir(0, 0, 1)), 3, 20).Shape();
1951 TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
1952 gp_Dir(1, 0, 0)), 3, 20).Shape();
1953 TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
1954 gp_Dir(0, 1, 0)), 3, 20).Shape();
1955 TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
1956 Handle(ShapeFix_Shape) fixer = new ShapeFix_Shape(theTmp1);
1958 theTmp1 = fixer->Shape();
1959 TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
1960 fixer->Init(theTmp2);
1962 theTmp2 = fixer->Shape();
1963 TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
1964 fixer->Init(theResult);
1966 theResult = fixer->Shape();
1970 static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1972 if(argc < 1 || argc > 2) {
1973 di << "Usage : " << argv[0] << " result\n";
1977 TopoDS_Shape S = OCC1077_Bug();
1978 DBRep::Set(argv[1],S);
1983 //////////////////////////////////////////////////////////////
1985 * Compute uniform distribution of points using GCPnts_UniformAbscissa
1987 //////////////////////////////////////////////////////////////
1988 static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1992 di << "Usage : " << argv[0] << " name shape step\n";
1995 const char *name = argv[1];
1996 Adaptor3d_Curve *adapCurve=NULL;
1997 Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
1998 if (!curve.IsNull())
1999 adapCurve = new GeomAdaptor_Curve(curve);
2002 TopoDS_Shape wire = DBRep::Get(argv[2]);
2003 if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
2005 di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected\n";
2008 adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
2010 double step = Draw::Atof(argv[3]);
2011 GCPnts_UniformAbscissa aUni(*adapCurve, step);
2015 di << argv[0] <<" : fail\n";
2020 int i, np = aUni.NbPoints();
2021 for (i=0; i < np; i++)
2023 double par = aUni.Parameter(i+1);
2024 gp_Pnt p = adapCurve->Value(par);
2025 char n[20], *pname=n;
2026 Sprintf(n,"%s_%d",name,i+1);
2027 DrawTrSurf::Set(pname,p);
2036 static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2040 di << "Usage : " << argv[0] << " nb_of_vectors size\n";
2044 Standard_Integer nb = Draw::Atoi(argv[1]);
2045 Standard_Integer sz = Draw::Atoi(argv[2]);
2046 Standard_Real val = 10;
2047 math_Vector **pv = new math_Vector *[nb];
2049 di<<"creating "<<nb<<" vectors "<<sz<<" elements each...\n";
2051 for (i=0; i < nb; i++) {
2052 pv[i] = new math_Vector (1, sz, val);
2053 if ((i % (nb/10)) == 0) {
2055 //std::cout.flush();
2060 di<<"deleting them ...\n";
2061 for (i=0; i < nb; i++) {
2063 if ((i % (nb/10)) == 0) {
2065 //std::cout.flush();
2076 static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2080 di << "Usage : " << argv[0] << " wire\n";
2083 TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
2086 TopoDS_Wire wire = TopoDS::Wire(shape);
2087 // create curve parameterised by curvilinear distance
2088 BRepAdaptor_CompCurve curve(wire,Standard_True);
2089 Standard_Real length = curve.LastParameter();
2090 Standard_Real need_length = length/2;
2092 curve.D0(need_length,pnt);
2093 // create check_curve parameterised in a general way
2094 BRepAdaptor_CompCurve check_curve(wire);
2095 Standard_Real check_par =
2096 GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
2098 check_curve.D0(check_par,check_pnt);
2099 // check that points are coinsiding
2100 Standard_Real error_dist = pnt.Distance(check_pnt);
2101 if (error_dist > Precision::Confusion()) {
2102 //std::cout.precision(3);
2103 di<<"error_dist = "<<error_dist<<
2104 " ( "<<error_dist/need_length*100<<" %)\n";
2111 // stack overflow can be successfully handled only on 32-bit Windows
2112 #if defined(_WIN32) && !defined(_WIN64)
2113 static int StackOverflow (int i = -1)
2116 memset (arr, 0, sizeof(arr));
2123 // this code does not work with optimize mode on Windows
2124 #if defined(_MSC_VER) && !defined(__clang__)
2125 #pragma optimize( "", off )
2127 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2131 std::cout << "Usage : " << argv[0] << "\n";
2134 Standard_Boolean Succes;
2136 Succes = Standard_True;
2139 {//==== Test Divide ByZero (Integer) ========================================
2142 std::cout << "(Integer) Divide By Zero..." << std::endl;
2143 di << "(Integer) Divide By Zero...";
2144 //std::cout.flush();
2146 Standard_Integer res, a =4, b = 0 ;
2148 di << "Error: 4 / 0 = " << res << " - no exception is raised!\n";
2149 Succes = Standard_False;
2151 #if defined(SOLARIS) || defined(_WIN32)
2152 catch(Standard_DivideByZero const&)
2154 catch(Standard_NumericError const&)
2157 di << "Caught, OK\n";
2159 catch(Standard_Failure const& anException) {
2161 di << anException.GetMessageString();
2163 Succes = Standard_False;
2165 // this case tests if (...) supersedes (Standard_*),
2166 // the normal behaviour is not
2168 di<<" unknown exception... (But) Ok\n";
2172 {//==== Test Divide ByZero (Real) ===========================================
2175 std::cout << "(Real) Divide By Zero..." << std::endl;
2176 di << "(Real) Divide By Zero...";
2177 //std::cout.flush();
2179 Standard_Real res, a= 4.0, b=0.0;
2181 di << "Error: 4.0 / 0.0 = " << res << " - no exception is raised!\n";
2182 Succes = Standard_False;
2184 catch(Standard_DivideByZero const&) // Solaris, Windows w/o SSE2
2186 di << "Caught, OK\n";
2188 catch(Standard_NumericError const&) // Linux, Windows with SSE2
2190 di << "Caught, OK\n";
2192 catch(Standard_Failure const& anException) {
2193 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2195 di << anException.GetMessageString();
2197 Succes = Standard_False;
2201 {//==== Test Overflow (Integer) =============================================
2204 std::cout << "(Integer) Overflow..." << std::endl;
2205 di << "(Integer) Overflow...";
2206 //std::cout.flush();
2208 Standard_Integer res, i=IntegerLast();
2210 //++++ std::cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< std::endl;
2211 //++++ Succes = Standard_False;
2212 di << "Not caught: " << i << " + 1 = " << res << ", still OK\n";
2214 catch(Standard_Overflow const&) {
2215 di << "Caught, OK\n";
2217 catch(Standard_Failure const& anException) {
2218 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2220 di << anException.GetMessageString();
2222 Succes = Standard_False;
2226 {//==== Test Overflow (Real) ================================================
2229 std::cout << "(Real) Overflow..." << std::endl;
2230 di << "(Real) Overflow...";
2231 //std::cout.flush();
2233 Standard_Real res, r=RealLast();
2236 (void)sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
2238 di << "Error: " << r << "*" << r << " = " << res << " - no exception is raised!\n";
2239 Succes = Standard_False;
2241 catch(Standard_Overflow const&) // Solaris, Windows w/o SSE2
2243 di << "Caught, OK\n";
2245 catch(Standard_NumericError const&) // Linux, Windows with SSE2
2247 di << "Caught, OK\n";
2249 catch(Standard_Failure const& anException) {
2250 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2252 di << anException.GetMessageString();
2254 Succes = Standard_False;
2258 {//==== Test Underflow (Real) ===============================================
2261 std::cout << "(Real) Underflow" << std::endl; // to have message in log even if process crashed
2262 di << "(Real) Underflow";
2263 //std::cout.flush();
2265 Standard_Real res, r = RealSmall();
2268 //++++ std::cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<std::endl;
2269 //++++ Succes = Standard_False;
2270 di << "Not caught: " << r << "*" << r << " = " << res << ", still OK\n";
2272 catch(Standard_Underflow const&) // could be on Solaris, Windows w/o SSE2
2274 di << "Exception caught, KO\n";
2275 Succes = Standard_False;
2277 catch(Standard_NumericError const&) // could be on Linux, Windows with SSE2
2279 di << "Exception caught, KO\n";
2280 Succes = Standard_False;
2282 catch(Standard_Failure const& anException) {
2283 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2285 di << anException.GetMessageString();
2287 Succes = Standard_False;
2291 {//==== Test Invalid Operation (Real) ===============================================
2294 std::cout << "(Real) Invalid Operation..." << std::endl;
2295 di << "(Real) Invalid Operation...";
2296 //std::cout.flush();
2298 Standard_Real res, r=-1;
2300 di << "Error: swrt(-1) = " << res << " - no exception is raised!\n";
2301 Succes = Standard_False;
2303 catch(Standard_NumericError const&) {
2304 di << "Caught, OK\n";
2306 catch(Standard_Failure const& anException) {
2307 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2309 di << anException.GetMessageString();
2311 Succes = Standard_False;
2315 {//==== Test Access Violation ===============================================
2318 std::cout << "Segmentation Fault..." << std::endl;
2319 di << "Segmentation Fault...";
2320 //std::cout.flush();
2324 di << "Error: writing by NULL address - no exception is raised!\n";
2325 Succes = Standard_False;
2328 catch(OSD_Exception_ACCESS_VIOLATION const&)
2330 catch(OSD_SIGSEGV const&)
2333 di << "Caught, OK\n";
2334 } catch(Standard_Failure const& anException) {
2335 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2337 di << anException.GetMessageString();
2339 Succes = Standard_False;
2343 #if defined(_WIN32) && !defined(_WIN64)
2344 {//==== Test Stack Overflow ===============================================
2347 std::cout << "Stack Overflow..." << std::endl;
2348 di << "Stack Overflow...";
2349 //std::cout.flush();
2352 di << "Error - no exception is raised!\n";
2353 Succes = Standard_False;
2355 catch(OSD_Exception_STACK_OVERFLOW const&) {
2356 di << "Caught, OK\n";
2358 catch(Standard_Failure const& anException) {
2359 //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
2361 di << anException.GetMessageString();
2363 Succes = Standard_False;
2369 di << "TestExcept: Successful completion\n";
2371 di << "TestExcept: failure\n";
2377 //! Auxiliary functor.
2378 struct TestParallelFunctor
2380 TestParallelFunctor() : myNbNotRaised (0), myNbSigSegv (0), myNbUnknown (0) {}
2382 Standard_Integer NbNotRaised() const { return myNbNotRaised; }
2383 Standard_Integer NbSigSegv() const { return myNbSigSegv; }
2384 Standard_Integer NbUnknown() const { return myNbUnknown; }
2386 void operator() (int theThreadId, int theTaskId) const
2391 // Test Access Violation
2397 Standard_Atomic_Increment (&myNbNotRaised);
2400 catch (OSD_Exception_ACCESS_VIOLATION const&)
2402 catch (OSD_SIGSEGV const&)
2405 Standard_Atomic_Increment (&myNbSigSegv);
2407 catch (Standard_Failure const& )
2409 Standard_Atomic_Increment (&myNbUnknown);
2414 mutable volatile Standard_Integer myNbNotRaised;
2415 mutable volatile Standard_Integer myNbSigSegv;
2416 mutable volatile Standard_Integer myNbUnknown;
2419 static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** )
2423 std::cout << "Syntax error: wrong number of arguments\n";
2427 Handle(OSD_ThreadPool) aPool = new OSD_ThreadPool (4);
2428 OSD_ThreadPool::Launcher aLauncher (*aPool, 4);
2429 TestParallelFunctor aFunctor;
2430 aLauncher.Perform (0, 100, aFunctor);
2431 theDI << "NbRaised: " << (aFunctor.NbSigSegv() + aFunctor.NbUnknown()) << "\n"
2432 << "NbNotRaised: " << aFunctor.NbNotRaised() << "\n"
2433 << "NbSigSeg: " << aFunctor.NbSigSegv() << "\n"
2434 << "NbUnknown: " << aFunctor.NbUnknown() << "\n";
2438 #if defined(_MSC_VER) && !defined(__clang__)
2439 #pragma optimize( "", on )
2442 // try disabling compiler optimizations and function inlining for proper stack
2443 // (VS2010 is skipped due to generation of extra compiler warnings)
2444 #if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(__clang__)
2445 #pragma optimize( "", off)
2447 //! Auxiliary functions for printing synthetic backtrace
2448 class MyTestInterface : public Standard_Transient
2451 virtual int Standard_NOINLINE testMethod3 (int* theIntPtr, bool theToPrintStack) = 0;
2454 class MyTestClass : public MyTestInterface
2458 virtual int Standard_NOINLINE testMethod3 (int* theIntPtr, bool theToPrintStack)
2460 if (theToPrintStack)
2462 char aMsg[4096] = {};
2463 Standard::StackTrace (aMsg, 4096, 10);
2464 std::cout << aMsg << "\n";
2472 static int Standard_NOINLINE myTestFunction2 (int* theIntPtr, bool theToPrintStack)
2474 Handle(MyTestInterface) aTest = new MyTestClass();
2475 return aTest->testMethod3 (theIntPtr, theToPrintStack);
2478 static void Standard_NOINLINE myTestFunction1 (bool theToPrintStack)
2480 int* anIntPtr = NULL;
2481 myTestFunction2 (anIntPtr, theToPrintStack);
2484 static Standard_NOINLINE Standard_Integer OCC30762 (Draw_Interpretor& theDI,
2485 Standard_Integer theNbArgs,
2490 theDI << "Syntax error: wrong number of arguments";
2495 std::cout << "Test normal backtrace...\n";
2496 myTestFunction1 (true);
2498 // test access violation
2503 std::cout << "Test segmentation Fault...\n";
2504 myTestFunction1 (false);
2505 std::cout << "Error: writing by NULL address - no exception is raised!\n";
2508 catch (OSD_Exception_ACCESS_VIOLATION const& aSegException)
2510 catch (OSD_SIGSEGV const& aSegException)
2513 theDI << " Caught (";
2514 theDI << aSegException.GetMessageString();
2515 theDI << aSegException.GetStackString();
2516 theDI << ")... OK\n";
2518 catch (Standard_Failure const& anException)
2520 theDI << " Caught (";
2521 theDI << anException.GetMessageString();
2522 theDI << anException.GetStackString();
2523 theDI << ")... KO\n";
2528 #if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(__clang__)
2529 #pragma optimize( "", on)
2532 static TopoDS_Compound AddTestStructure(int nCount_)
2538 BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
2539 for (int i=0; i<nCount; i++) {
2540 for (int j=0; j<nCount; j++) {
2542 trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
2543 TopLoc_Location topLoc(trsf);
2544 TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
2545 B.Add(C, tempShape);
2551 static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2553 if (argc != 2 && argc != 3)
2555 std::cout << "Usage : " << argv[0] << " [nCount] path\n";
2559 int nCount = (argc > 2 ? Draw::Atoi(argv[1]) : 10);
2560 TCollection_AsciiString aFilePath (argv[argc > 2 ? 2 : 1]);
2561 STEPCAFControl_Writer writer;
2562 Handle(TDocStd_Document) document;
2563 document = new TDocStd_Document("Pace Test-StepExporter-");
2564 Handle(XCAFDoc_ShapeTool) shapeTool;
2565 shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
2566 shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
2567 STEPControl_StepModelType mode = STEPControl_AsIs;
2568 if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
2569 di << "Failed to set assembly mode for step data\n\n";
2574 if( writer.Transfer(document, mode)) {
2575 writer.Write(aFilePath.ToCString());
2578 catch(OSD_Exception_STACK_OVERFLOW const&) {
2579 di << "Failed : STACK OVERFLOW\n\n";
2581 catch (Standard_Failure const& anException) {
2582 di << "Failed :\n\n";
2583 //std::cout << Standard_Failure::Caught() << std::endl;
2584 di << anException.GetMessageString();
2586 di << argv[0] << " : Finish\n";
2591 static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2595 di << "Usage : " << argv[0] << "\n";
2599 // 1. Create an array of points
2600 Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
2601 ap->SetValue(1,gp_Pnt2d(100.0,0.0));
2602 ap->SetValue(2,gp_Pnt2d(100.0,100.0));
2603 ap->SetValue(3,gp_Pnt2d(0.0,100.0));
2604 ap->SetValue(4,gp_Pnt2d(0.0,0.0));
2605 ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
2607 // 2. Create a periodic bspline through these 5 points
2608 Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
2610 Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
2612 // 3. Increase degree of curve from 3 to 8
2613 bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
2614 Standard_CString CString1 = "BSplineCurve";
2615 DrawTrSurf::Set(CString1,bspline1);
2617 // 4. Convers BSpline curve to Bezier segments
2618 Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
2620 // 5. Test the result of conversion
2621 TCollection_AsciiString aRName;
2622 for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
2623 Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
2625 aRName=aRName+TCollection_AsciiString(i);
2626 Standard_CString aRNameStr = aRName.ToCString();
2627 DrawTrSurf::Set(aRNameStr,arc);
2628 di << aRNameStr << " ";
2634 static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2638 di << "Usage : " << argv[0] << " edge1 edge2 plane\n";
2641 TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
2642 if (theEdge1.IsNull()) {
2643 di << "Invalid input shape " << argv[1] << "\n";
2646 TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
2647 if (theEdge2.IsNull()) {
2648 di << "Invalid input shape " << argv[2] << "\n";
2651 TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
2652 if (theFace.IsNull()) {
2653 di << "Invalid input shape " << argv[3] << "\n";
2657 Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
2659 Standard_Real aConfusion = Precision::Confusion();
2660 Standard_Real aP1first, aP1last, aP2first, aP2last;
2662 Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
2663 Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
2664 Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
2665 Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
2667 Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
2669 Standard_Integer NbPoints = anInter.NbPoints();
2671 di << "NbPoints = " << NbPoints << "\n" ;
2675 for (i=1; i<=NbPoints; i++) {
2676 gp_Pnt2d aPi = anInter.Point(i);
2677 di << "Point.X(" << i << ") = " << aPi.X() << " Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
2681 Standard_Integer NbSegments = anInter.NbSegments();
2683 di << "\nNbSegments = " << NbSegments << "\n" ;
2685 if (NbSegments > 0) {
2686 IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
2688 gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
2689 gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
2691 Standard_Real aDist = aP1.Distance(aP2);
2693 di << "aP1.X() = " << aP1.X() << " aP1.Y() = " << aP1.Y() << "\n" ;
2694 di << "aP2.X() = " << aP2.X() << " aP2.Y() = " << aP2.Y() << "\n" ;
2696 di << "Distance = " << aDist << "\n" ;
2698 di << "Confusion = " << aConfusion << "\n" ;
2700 if (aDist > aConfusion) {
2701 di << "\n" << argv[0] << " Faulty\n" ;
2703 di << "\n" << argv[0] << " OK\n" ;
2706 di << "\n" << argv[0] << " OK\n" ;
2711 static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2715 di << "Usage : " << argv[0] << " lower upper\n";
2719 Standard_Integer LOWER = Draw::Atoi(argv[1]);
2720 Standard_Integer UPPER = Draw::Atoi(argv[2]);
2722 //! 0. Create an empty document with several test labels
2723 Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
2724 doc->SetUndoLimit(100);
2725 TDF_Label main_label = doc->Main();
2726 TDF_Label label1 = main_label.FindChild(1, Standard_True);
2727 TDF_Label label2 = main_label.FindChild(2, Standard_True);
2729 //! 1. Set/Get OCAF attribute
2731 TDataStd_RealArray::Set(label1, LOWER, UPPER);
2732 Handle(TDataStd_RealArray) array;
2733 if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
2734 array->Lower() == LOWER && array->Upper() == UPPER)
2735 std::cout<<"1: OK"<<std::endl;
2738 std::cout<<"1: Failed.."<<std::endl;
2741 doc->CommitCommand();
2743 //! 2. Set/Get value
2746 for (i = LOWER; i <= UPPER; i++)
2747 array->SetValue(i, i);
2748 for (i = LOWER; i <= UPPER; i++)
2750 if (array->Value(i) != i)
2752 std::cout<<"2: Failed.."<<std::endl;
2756 std::cout<<"2: OK"<<std::endl;
2757 doc->CommitCommand();
2759 //! 3. Re-init the array
2761 array->Init(LOWER + 2, UPPER + 4);
2762 if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
2764 std::cout<<"3: Failed.."<<std::endl;
2767 for (i = LOWER + 2; i <= UPPER + 4; i++)
2768 array->SetValue(i, i);
2769 for (i = LOWER + 2; i <= UPPER + 4; i++)
2771 if (array->Value(i) != i)
2773 std::cout<<"3: Failed.."<<std::endl;
2777 std::cout<<"3: OK"<<std::endl;
2778 doc->CommitCommand();
2782 Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
2783 for (i = LOWER + 5; i <= UPPER + 5; i++)
2784 arr->SetValue(i, i);
2785 array->ChangeArray(arr);
2786 for (i = LOWER + 5; i <= UPPER + 5; i++)
2788 if (array->Value(i) != i)
2790 std::cout<<"4: Failed.."<<std::endl;
2794 std::cout<<"4: OK"<<std::endl;
2795 doc->CommitCommand();
2797 //! 5. Copy the array
2799 TDF_CopyLabel copier(label1, label2);
2801 if (!copier.IsDone())
2803 std::cout<<"5: Failed.."<<std::endl;
2806 Handle(TDataStd_RealArray) array2;
2807 if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2809 std::cout<<"5: Failed.."<<std::endl;
2812 for (i = LOWER + 5; i <= UPPER + 5; i++)
2814 if (array->Value(i) != i)
2816 std::cout<<"5: Failed.."<<std::endl;
2820 std::cout<<"5: OK"<<std::endl;
2821 doc->CommitCommand();
2824 //! 6.a: undoes the 5th action: the copied array should disappear
2826 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2827 label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
2829 std::cout<<"6.a: Failed.."<<std::endl;
2832 //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
2834 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2835 array->Lower() != LOWER + 2 ||
2836 array->Upper() != UPPER + 4)
2838 std::cout<<"6.b: Failed.."<<std::endl;
2841 for (i = LOWER + 2; i <= UPPER + 4; i++)
2843 if (array->Value(i) != i)
2845 std::cout<<"6.b: Failed.."<<std::endl;
2849 //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
2851 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2852 array->Lower() != LOWER ||
2853 array->Upper() != UPPER)
2855 std::cout<<"6.c: Failed.."<<std::endl;
2858 for (i = LOWER; i <= UPPER; i++)
2860 if (array->Value(i) != i)
2862 std::cout<<"6.c: Failed.."<<std::endl;
2866 //! 6.d: undoes and redoes the 2nd action: no change is expected.
2869 if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
2870 array->Lower() != LOWER ||
2871 array->Upper() != UPPER)
2873 std::cout<<"6.d: Failed.."<<std::endl;
2876 for (i = LOWER; i <= UPPER; i++)
2878 if (array->Value(i) != i)
2880 std::cout<<"6.d: Failed.."<<std::endl;
2884 std::cout<<"6: OK"<<std::endl;
2886 //! 7. Re-set the array
2888 array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
2889 if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
2891 std::cout<<"7: Failed.."<<std::endl;
2894 for (i = LOWER + 1; i <= UPPER + 1; i++)
2895 array->SetValue(i, i);
2896 for (i = LOWER + 1; i <= UPPER + 1; i++)
2898 if (array->Value(i) != i)
2900 std::cout<<"7: Failed.."<<std::endl;
2904 std::cout<<"7: OK"<<std::endl;
2905 doc->CommitCommand();
2907 //! 8.Test of speed: set LOWER and UPPER equal to great integer number and
2908 //! measure the time spent by this test.
2914 static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2916 Standard_Boolean IsEvenArgc = Standard_True;
2917 if (argc % 2 == 0) {
2918 IsEvenArgc = Standard_True;
2920 IsEvenArgc = Standard_False;
2923 if (argc < 3 || IsEvenArgc)
2925 di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]\n";
2929 Standard_Integer i, aValue, aPosition;
2930 NCollection_Vector<int> vec;
2931 for (i = 0; i < argc - 1; i++) {
2933 aValue = Draw::Atoi(argv[i]);
2934 aPosition = Draw::Atoi(argv[i+1]);
2935 vec.SetValue(aValue, aPosition);
2937 NCollection_Vector<int>::Iterator it(vec);
2939 for (j = 0; it.More(); it.Next(), j++) {
2940 //di << it.Value() << "\n";
2941 di << j << " " << it.Value() << "\n";
2947 static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2950 di << "Usage : " << argv[0] << "\n";
2954 gp_Pnt point(0.0,0.0,0.0);
2956 TColgp_Array1OfPnt poles(0,6);
2959 point.SetCoord(1.0,1.0,0.0);
2962 point.SetCoord(2.0,1.0,0.0);
2965 point.SetCoord(3.0,0.0,0.0);
2968 point.SetCoord(4.0,1.0,0.0);
2971 point.SetCoord(5.0,1.0,0.0);
2974 point.SetCoord(6.0,0.0,0.0);
2977 TColStd_Array1OfReal knots(0,2);
2982 TColStd_Array1OfInteger multi(0,2);
2987 Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
2990 Standard_Real l_abcissa,l_gprop;
2991 GeomAdaptor_Curve adaptor_spline(spline);
2992 GCPnts_AbscissaPoint temp;
2993 l_abcissa=temp.Length(adaptor_spline);
2994 std::cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<std::endl;
2997 TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
2999 BRepGProp::LinearProperties(edge,prop);
3000 l_gprop=prop.Mass();
3001 std::cout<<"Length Spline(GProp_GProps): "<<l_gprop<<std::endl;
3003 std::cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<std::endl;
3008 static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3012 di << "Usage : " << argv[0] << "\n";
3016 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
3017 if(AISContext.IsNull())
3019 di << "use 'vinit' command before " << argv[0] << "\n";
3024 AIS_ListOfInteractive ListOfIO_1;
3025 AISContext->ObjectsInside(ListOfIO_1);
3026 di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
3027 if (!ListOfIO_1.IsEmpty() ) {
3028 AIS_ListIteratorOfListOfInteractive iter;
3029 for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
3030 Handle(AIS_InteractiveObject) aIO=iter.Value();
3031 di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
3038 // Test AIS_InteractiveContext::Hilight() call.
3039 static Standard_Integer OCC31965 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
3043 theDI << "Syntax error: wrong number of arguments";
3047 Handle(AIS_InteractiveObject) aPrs = GetMapOfAIS().Find2 (theArgVec[1]);
3048 ViewerTest::GetAISContext()->HilightWithColor (aPrs, ViewerTest::GetAISContext()->HighlightStyle (Prs3d_TypeOfHighlight_Dynamic), true);
3052 static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3054 if ((argc < 9) || (((argc-3) % 3) != 0))
3056 di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
3059 Standard_Integer i, j, np = (argc-3) / 3;
3060 BRepBuilderAPI_MakePolygon W;
3062 for (i = 1; i <= np; i ++) {
3063 W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2])));
3067 DBRep::Set(argv[1],W.Wire());
3068 DBRep::Set(argv[2],W.Edge());
3072 static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3075 di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
3078 gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
3079 gp_Dir(1., -1., 0.));
3081 aTrf.SetAffinity (aPln, Draw::Atof(argv[4]));
3082 gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3083 gp_XYZ aResult (aOrigin);
3084 aTrf.Transforms(aResult);
3086 Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
3087 aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
3088 aResult.X(), aResult.Y(), aResult.Z());
3093 Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3096 di << "Usage : " << argv[0] << " shape [deflection]\n";
3100 TopoDS_Shape aShape = DBRep::Get(argv[1]);
3102 if (aShape.IsNull()) {
3103 di<<" Null shape is not allowed";
3107 Standard_Real aDeflection = 0.45110277533;
3109 aDeflection = Draw::Atof(argv[2]);
3111 di<<"deflection="<< aDeflection << "\n";
3113 BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI / 9.);
3114 TopLoc_Location aLocation;
3115 Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
3117 if(aTriang.IsNull()) {
3118 di << argv[0] << " : Faulty\n" ;
3120 di << argv[0] << " : OK\n" ;
3121 di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
3122 di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
3127 static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3130 di << "Usage : " << argv[0] << " A B C\n";
3135 gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3]));
3136 gp_Pnt2d anOrigin = aLin2d.Location();
3137 di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
3139 catch(Standard_ConstructionError const&)
3141 di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
3146 static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3149 di << "Usage : " << argv[0] << " file shape\n";
3153 IGESControl_Reader aReader;
3154 aReader.ReadFile(argv[1]);
3155 aReader.SetReadVisible(Standard_True);
3156 aReader.TransferRoots();
3158 Handle(IGESData_IGESModel) model = aReader.IGESModel();
3159 if (model.IsNull()) {
3160 di << "model.IsNull()\n";
3163 Standard_Integer nb = model->NbEntities();
3164 for (Standard_Integer i = 1; i <= nb; i ++) {
3165 Handle(IGESData_IGESEntity) ent = model->Entity(i);
3166 Handle(TCollection_HAsciiString) name;
3167 name = ent->NameValue();
3168 Standard_CString aStr = name->ToCString();
3169 di << "NameValue = " << aStr << "\n";
3172 TopoDS_Shape shape = aReader.OneShape();
3173 DBRep::Set(argv[2],shape);
3177 // For OCC16782 testing
3178 #include <AppStd_Application.hxx>
3179 #include <TDF_Tool.hxx>
3180 #include <TColStd_HArray1OfInteger.hxx>
3182 #include <TColStd_ListIteratorOfListOfInteger.hxx>
3183 #include <TColStd_ListIteratorOfListOfReal.hxx>
3184 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
3185 #include <TDataStd_ListIteratorOfListOfByte.hxx>
3186 #include <TDF_ListIteratorOfLabelList.hxx>
3188 #include <TDataStd_Tick.hxx>
3189 #include <TDataStd_IntegerList.hxx>
3190 #include <TDataStd_RealList.hxx>
3191 #include <TDataStd_ExtStringList.hxx>
3192 #include <TDataStd_BooleanList.hxx>
3193 #include <TDataStd_ReferenceList.hxx>
3194 #include <TDataStd_BooleanArray.hxx>
3195 #include <TDataStd_ReferenceArray.hxx>
3196 #include <TDataStd_ByteArray.hxx>
3197 #include <TDataStd_NamedData.hxx>
3198 #include <TDF_Reference.hxx>
3200 Handle(AppStd_Application) app;
3201 int TestSetGet(const Handle(TDocStd_Document)& doc)
3205 TDataStd_Tick::Set(doc->Main());
3207 Handle(TDataStd_Tick) tick;
3208 if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
3211 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3212 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3214 doc->Main().ResumeAttribute(tick);
3215 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3218 doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
3219 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3222 // TDataStd_IntegerList:
3224 Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
3225 setintlist->Append(2);
3226 setintlist->Prepend(1);
3227 setintlist->InsertAfter(3, 2);
3228 setintlist->InsertBefore(0, 1);
3229 setintlist->Append(200);
3230 setintlist->Remove(0);
3231 setintlist->Remove(200);
3233 Handle(TDataStd_IntegerList) getintlist;
3234 if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
3236 if (getintlist->First() != 1)
3238 if (getintlist->Last() != 3)
3240 const TColStd_ListOfInteger& intlist = getintlist->List();
3241 TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
3242 for (; itr_intlist.More(); itr_intlist.Next())
3244 if (itr_intlist.Value() != 1 &&
3245 itr_intlist.Value() != 2 &&
3246 itr_intlist.Value() != 3)
3251 getintlist->Clear();
3253 // TDataStd_RealList:
3255 Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
3256 setdbllist->Append(2.5);
3257 setdbllist->Prepend(1.5);
3258 setdbllist->InsertAfter(3.5, 2.5);
3259 setdbllist->InsertBefore(0.5, 1.5);
3260 setdbllist->Append(200.5);
3261 setdbllist->Remove(0.5);
3262 setdbllist->Remove(200.5);
3264 Handle(TDataStd_RealList) getdbllist;
3265 if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
3267 if (getdbllist->First() != 1.5)
3269 if (getdbllist->Last() != 3.5)
3271 const TColStd_ListOfReal& dbllist = getdbllist->List();
3272 TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
3273 for (; itr_dbllist.More(); itr_dbllist.Next())
3275 if (itr_dbllist.Value() != 1.5 &&
3276 itr_dbllist.Value() != 2.5 &&
3277 itr_dbllist.Value() != 3.5)
3282 getdbllist->Clear();
3284 // TDataStd_ExtStringList:
3286 Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
3287 setstrlist->Append("Hello");
3288 setstrlist->Prepend("Guten Tag");
3289 setstrlist->InsertAfter("Bonjour", "Guten Tag");
3290 setstrlist->InsertBefore("Bonsoir", "Hello");
3291 setstrlist->Append("Good bye");
3292 setstrlist->Remove("Bonsoir");
3293 setstrlist->Remove("Good bye");
3295 Handle(TDataStd_ExtStringList) getstrlist;
3296 if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
3298 if (getstrlist->First() != "Guten Tag")
3300 if (getstrlist->Last() != "Hello")
3302 const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
3303 TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
3304 for (; itr_strlist.More(); itr_strlist.Next())
3306 if (itr_strlist.Value() != "Guten Tag" &&
3307 itr_strlist.Value() != "Bonjour" &&
3308 itr_strlist.Value() != "Hello")
3313 getstrlist->Clear();
3315 // TDataStd_BooleanList:
3317 Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
3318 setboollist->Append(Standard_True);
3319 setboollist->Prepend(Standard_False);
3321 Handle(TDataStd_BooleanList) getboollist;
3322 if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
3324 if (getboollist->First() != Standard_False)
3326 if (getboollist->Last() != Standard_True)
3328 const TDataStd_ListOfByte& boollist = getboollist->List();
3329 for (TDataStd_ListIteratorOfListOfByte itr_boollist(boollist); itr_boollist.More(); itr_boollist.Next())
3331 if (itr_boollist.Value() != 1
3332 && itr_boollist.Value() != 0)
3337 getboollist->Clear();
3339 // TDataStd_ReferenceList:
3340 TDF_Label L1 = doc->Main().FindChild(100);
3341 TDF_Label L2 = doc->Main().FindChild(101);
3342 TDF_Label L3 = doc->Main().FindChild(102);
3343 TDF_Label L4 = doc->Main().FindChild(103);
3344 TDF_Label L5 = doc->Main().FindChild(104);
3346 Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
3347 setreflist->Append(L1);
3348 setreflist->Prepend(L2);
3349 setreflist->InsertAfter(L3, L2);
3350 setreflist->InsertBefore(L4, L1);
3351 setreflist->Append(L5);
3352 setreflist->Remove(L4);
3353 setreflist->Remove(L5);
3355 Handle(TDataStd_ReferenceList) getreflist;
3356 if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
3358 if (getreflist->First() != L2)
3360 if (getreflist->Last() != L1)
3362 const TDF_LabelList& reflist = getreflist->List();
3363 TDF_ListIteratorOfLabelList itr_reflist(reflist);
3364 for (; itr_reflist.More(); itr_reflist.Next())
3366 if (itr_reflist.Value() != L1 &&
3367 itr_reflist.Value() != L2 &&
3368 itr_reflist.Value() != L3)
3373 getreflist->Clear();
3375 // TDataStd_BooleanArray:
3377 Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
3378 setboolarr->SetValue(12, Standard_True);
3379 setboolarr->SetValue(13, Standard_False);
3380 setboolarr->SetValue(14, Standard_False);
3381 setboolarr->SetValue(15, Standard_False);
3382 setboolarr->SetValue(16, Standard_True);
3383 setboolarr->SetValue(14, Standard_True);
3385 Handle(TDataStd_BooleanArray) getboolarr;
3386 if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
3388 if (getboolarr->Value(12) != Standard_True)
3390 if (getboolarr->Value(13) != Standard_False)
3392 if (getboolarr->Value(14) != Standard_True)
3394 if (getboolarr->Value(15) != Standard_False)
3396 if (getboolarr->Value(16) != Standard_True)
3399 // TDataStd_ReferenceArray:
3401 Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
3402 setrefarr->SetValue(0, L1);
3403 setrefarr->SetValue(1, L2);
3404 setrefarr->SetValue(2, L3);
3405 setrefarr->SetValue(3, L4);
3406 setrefarr->SetValue(4, L5);
3408 Handle(TDataStd_ReferenceArray) getrefarr;
3409 if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
3411 if (getrefarr->Value(0) != L1)
3413 if (getrefarr->Value(1) != L2)
3415 if (getrefarr->Value(2) != L3)
3417 if (getrefarr->Value(3) != L4)
3419 if (getrefarr->Value(4) != L5)
3422 // TDataStd_ByteArray:
3424 Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
3425 setbytearr->SetValue(12, 0);
3426 setbytearr->SetValue(13, 1);
3427 setbytearr->SetValue(14, 2);
3428 setbytearr->SetValue(15, 3);
3429 setbytearr->SetValue(16, 255);
3431 Handle(TDataStd_ByteArray) getbytearr;
3432 if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
3434 if (getbytearr->Value(12) != 0)
3436 if (getbytearr->Value(13) != 1)
3438 if (getbytearr->Value(14) != 2)
3440 if (getbytearr->Value(15) != 3)
3442 if (getbytearr->Value(16) != 255)
3445 // TDataStd_NamedData:
3447 Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
3448 setnd->SetInteger("Integer1", 1);
3449 setnd->SetInteger("Integer2", 2);
3450 setnd->SetInteger("Integer3", 8);
3451 setnd->SetInteger("Integer3", 3);
3453 Handle(TDataStd_NamedData) getnd;
3454 if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
3456 if (!getnd->HasIntegers())
3458 if (!getnd->HasInteger("Integer1"))
3460 if (getnd->GetInteger("Integer2") != 2)
3462 if (getnd->GetInteger("Integer3") != 3)
3468 int TestUndoRedo(const Handle(TDocStd_Document)& doc)
3472 Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
3473 doc->CommitCommand();
3474 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3477 if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3480 if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
3483 // TDataStd_IntegerList:
3485 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
3487 intlist->Prepend(1);
3488 intlist->InsertBefore(0, 1);
3489 intlist->InsertAfter(3, 2);
3490 doc->CommitCommand();
3491 if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
3494 if (!intlist->IsEmpty())
3497 if (!intlist->Extent())
3499 if (intlist->First() != 0)
3501 if (intlist->Last() != 3)
3505 // TDataStd_RealList:
3507 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
3508 dbllist->Append(2.5);
3509 dbllist->Prepend(1.5);
3510 dbllist->InsertBefore(0.5, 1.5);
3511 dbllist->InsertAfter(3.5, 2.5);
3512 doc->CommitCommand();
3513 if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
3516 if (!dbllist->IsEmpty())
3519 if (!dbllist->Extent())
3521 if (dbllist->First() != 0.5)
3523 if (dbllist->Last() != 3.5)
3527 // TDataStd_ExtStringList:
3529 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
3530 strlist->Append("Hello");
3531 strlist->Prepend("Guten Tag");
3532 strlist->InsertAfter("Bonjour", "Guten Tag");
3533 strlist->InsertBefore("Bonsoir", "Hello");
3534 doc->CommitCommand();
3535 if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
3538 if (!strlist->IsEmpty())
3541 if (!strlist->Extent())
3543 if (strlist->First() != "Guten Tag")
3545 if (strlist->Last() != "Hello")
3549 // TDataStd_BooleanList:
3551 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
3552 boollist->Append(Standard_True);
3553 boollist->Prepend(Standard_False);
3554 doc->CommitCommand();
3555 if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
3558 if (!boollist->IsEmpty())
3561 if (!boollist->Extent())
3563 if (boollist->First() != Standard_False)
3565 if (boollist->Last() != Standard_True)
3569 // TDataStd_ReferenceList:
3570 TDF_Label L1 = doc->Main().FindChild(100);
3571 TDF_Label L2 = doc->Main().FindChild(101);
3572 TDF_Label L3 = doc->Main().FindChild(102);
3573 TDF_Label L4 = doc->Main().FindChild(103);
3575 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
3576 reflist->Append(L1);
3577 reflist->Prepend(L2);
3578 reflist->InsertBefore(L3, L1);
3579 reflist->InsertAfter(L4, L2);
3580 doc->CommitCommand();
3581 if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
3584 if (!reflist->IsEmpty())
3587 if (!reflist->Extent())
3589 if (reflist->First() != L2)
3591 if (reflist->Last() != L1)
3595 // TDataStd_BooleanArray:
3597 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
3598 boolarr->SetValue(23, Standard_True);
3599 boolarr->SetValue(25, Standard_True);
3600 doc->CommitCommand();
3602 boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
3603 boolarr->SetValue(230, Standard_True);
3604 boolarr->SetValue(250, Standard_True);
3605 doc->CommitCommand();
3607 if (boolarr->Value(23) != Standard_True)
3609 if (boolarr->Value(24) != Standard_False)
3611 if (boolarr->Value(25) != Standard_True)
3614 if (boolarr->Value(230) != Standard_True)
3616 if (boolarr->Value(240) != Standard_False)
3618 if (boolarr->Value(250) != Standard_True)
3621 // TDataStd_ReferenceArray:
3623 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
3624 refarr->SetValue(5, L1);
3625 refarr->SetValue(6, L2);
3626 refarr->SetValue(7, L3);
3627 refarr->SetValue(8, L4);
3628 doc->CommitCommand();
3629 if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
3633 if (refarr->Value(5) != L1)
3635 if (refarr->Value(6) != L2)
3637 if (refarr->Value(7) != L3)
3639 if (refarr->Value(8) != L4)
3642 // TDataStd_ByteArray:
3644 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
3645 bytearr->SetValue(23, 23);
3646 bytearr->SetValue(25, 25);
3647 doc->CommitCommand();
3649 bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
3650 bytearr->SetValue(230, 230);
3651 bytearr->SetValue(250, 250);
3652 doc->CommitCommand();
3654 if (bytearr->Value(23) != 23)
3656 if (bytearr->Value(25) != 25)
3659 if (bytearr->Value(230) != 230)
3661 if (bytearr->Value(250) != 250)
3664 // TDataStd_NamedData:
3666 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
3667 nd->SetByte("b14", 12);
3668 nd->SetByte("b17", 18);
3669 nd->SetByte("b14", 14);
3670 nd->SetByte("b17", 17);
3671 doc->CommitCommand();
3673 nd = TDataStd_NamedData::Set(doc->Main());
3674 nd->SetReal("r14", 14);
3675 nd->SetReal("r17", 17);
3676 nd->SetReal("r14", 14.4);
3677 nd->SetReal("r17", 17.7);
3678 doc->CommitCommand();
3680 if (nd->HasStrings())
3684 if (nd->HasReal("r17"))
3686 if (!nd->HasBytes())
3688 if (nd->GetByte("b14") != 14)
3690 if (nd->GetByte("b17") != 17)
3692 if (nd->HasByte("b18"))
3695 if (!nd->HasBytes())
3697 if (!nd->HasReals())
3699 if (nd->GetByte("b14") != 14)
3701 if (nd->GetReal("r14") != 14.4)
3703 if (nd->GetReal("r17") != 17.7)
3709 int TestCopyPaste(const Handle(TDocStd_Document)& doc)
3711 TDF_Label L1 = doc->Main().FindChild(1);
3712 TDF_Label L2 = doc->Main().FindChild(2);
3713 TDF_CopyLabel copier(L1, L2);
3716 TDataStd_Tick::Set(L1);
3718 if (!copier.IsDone())
3720 if (!L2.IsAttribute(TDataStd_Tick::GetID()))
3723 // TDataStd_IntegerList:
3724 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
3726 intlist->InsertAfter(2, 1);
3728 if (!copier.IsDone())
3732 if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3734 if (intlist->First() != 1)
3736 if (intlist->Last() != 2)
3740 // TDataStd_RealList:
3741 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
3742 dbllist->Append(1.5);
3743 dbllist->InsertAfter(2.5, 1.5);
3745 if (!copier.IsDone())
3749 if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
3751 if (dbllist->First() != 1.5)
3753 if (dbllist->Last() != 2.5)
3757 // TDataStd_ExtStringList:
3758 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
3759 strlist->Append("Open CASCADE");
3760 strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
3762 if (!copier.IsDone())
3766 if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
3768 if (strlist->First() != "Open CASCADE")
3770 if (strlist->Last() != " - is the best set of libraries!")
3774 // TDataStd_BooleanList:
3775 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
3776 boollist->Append(Standard_True);
3777 boollist->Prepend(Standard_False);
3779 if (!copier.IsDone())
3783 if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
3785 if (boollist->First() != Standard_False)
3787 if (boollist->Last() != Standard_True)
3791 // TDataStd_ReferenceList:
3792 TDF_Label L100 = doc->Main().FindChild(100);
3793 TDF_Label L101 = doc->Main().FindChild(101);
3794 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
3795 reflist->Append(L100);
3796 reflist->InsertAfter(L101, L100);
3798 if (!copier.IsDone())
3802 if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
3804 if (reflist->First() != L100)
3806 if (reflist->Last() != L101)
3810 // TDataStd_BooleanArray:
3811 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
3812 boolarr->SetValue(4, Standard_True);
3813 boolarr->SetValue(6, Standard_True);
3815 if (!copier.IsDone())
3818 if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
3820 if (boolarr->Value(4) != Standard_True)
3822 if (boolarr->Value(5) != Standard_False)
3824 if (boolarr->Value(6) != Standard_True)
3827 // TDataStd_ReferenceArray:
3828 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
3829 refarr->SetValue(3, L100);
3830 refarr->SetValue(4, L101);
3832 if (!copier.IsDone())
3835 if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
3837 if (refarr->Value(3) != L100)
3839 if (refarr->Value(4) != L101)
3842 // TDataStd_ByteArray:
3843 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
3844 bytearr->SetValue(4, 40);
3845 bytearr->SetValue(6, 60);
3847 if (!copier.IsDone())
3850 if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
3852 if (bytearr->Value(4) != 40)
3854 if (bytearr->Value(6) != 60)
3857 // TDataStd_NamedData:
3858 Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
3859 nd->SetInteger("Integer1", 11);
3860 nd->SetReal("Real1", 11.1);
3861 nd->SetString("String1", "11.11111111");
3862 nd->SetByte("Byte1", 111);
3863 Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
3864 ints_arr->SetValue(4, 4);
3865 ints_arr->SetValue(5, 5);
3866 nd->SetArrayOfIntegers("Integers1", ints_arr);
3868 if (!copier.IsDone())
3871 if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
3873 if (!nd->HasIntegers())
3875 if (!nd->HasReals())
3877 if (!nd->HasStrings())
3879 if (!nd->HasBytes())
3881 if (!nd->HasArraysOfIntegers())
3883 if (nd->HasArraysOfReals())
3885 if (!nd->HasInteger("Integer1"))
3887 if (nd->GetInteger("Integer1") != 11)
3889 if (!nd->HasReal("Real1"))
3891 if (nd->GetReal("Real1") != 11.1)
3893 if (!nd->HasString("String1"))
3895 if (nd->GetString("String1") != "11.11111111")
3897 if (!nd->HasByte("Byte1"))
3899 if (nd->GetByte("Byte1") != 111)
3901 if (!nd->HasArrayOfIntegers("Integers1"))
3903 const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
3904 if (ints_arr_out.IsNull())
3906 if (ints_arr_out->Value(5) != 5)
3912 int TestOpenSave(TCollection_ExtendedString aFile1,
3913 TCollection_ExtendedString aFile2,
3914 TCollection_ExtendedString aFile3)
3917 Handle(TDocStd_Document) doc_std, doc_std_open;
3918 app->NewDocument("BinOcaf", doc_std);
3920 TDataStd_Tick::Set(doc_std->Main());
3921 // TDataStd_IntegerList:
3922 Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
3925 // TDataStd_RealList:
3926 Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
3927 dbllist->Append(1.5);
3928 dbllist->Append(5.5);
3929 // TDataStd_ExtStringList:
3930 Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
3931 strlist->Append("Auf");
3932 strlist->Append("Wiedersehen");
3933 // TDataStd_BooleanList:
3934 Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
3935 boollist->Append(Standard_False);
3936 boollist->Append(Standard_True);
3937 // TDataStd_ReferenceList:
3938 TCollection_AsciiString entry1, entry2, entry_first, entry_last;
3939 TDF_Label Lstd1 = doc_std->Main().FindChild(100);
3940 TDF_Tool::Entry(Lstd1, entry1);
3941 TDF_Label Lstd2 = doc_std->Main().FindChild(101);
3942 TDF_Tool::Entry(Lstd2, entry2);
3943 Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
3944 reflist->Append(Lstd1);
3945 reflist->Append(Lstd2);
3946 // TDataStd_BooleanArray:
3947 Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
3948 boolarr->SetValue(15, Standard_False);
3949 boolarr->SetValue(16, Standard_True);
3950 boolarr->SetValue(17, Standard_True);
3951 boolarr->SetValue(18, Standard_True);
3952 // TDataStd_ReferenceArray:
3953 Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
3954 refarr->SetValue(45, Lstd1);
3955 refarr->SetValue(46, Lstd2);
3956 // TDataStd_ByteArray:
3957 Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
3958 bytearr->SetValue(15, 150);
3959 bytearr->SetValue(16, 160);
3960 bytearr->SetValue(17, 170);
3961 bytearr->SetValue(18, 180);
3962 // TDataStd_NamedData:
3963 Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
3965 TDF_Label Lstd3 = doc_std->Main().FindChild(103);
3966 Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
3969 //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
3970 if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
3979 app->Close(doc_std);
3981 //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
3982 if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
3984 if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
3986 if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
3988 if (intlist->First() != 1)
3990 if (intlist->Last() != 5)
3992 if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
3994 if (dbllist->First() != 1.5)
3996 if (dbllist->Last() != 5.5)
3998 if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4000 if (strlist->First() != "Auf")
4002 if (strlist->Last() != "Wiedersehen")
4004 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4006 if (boollist->First() != Standard_False)
4008 if (boollist->Last() != Standard_True)
4010 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4012 TDF_Tool::Entry(reflist->First(), entry_first);
4013 if (entry1 != entry_first)
4015 TDF_Tool::Entry(reflist->Last(), entry_last);
4016 if (entry2 != entry_last)
4018 if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4020 if (boolarr->Value(15) != Standard_False)
4022 if (boolarr->Value(16) != Standard_True)
4024 if (boolarr->Value(17) != Standard_True)
4026 if (boolarr->Value(18) != Standard_True)
4028 if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4030 TDF_Tool::Entry(refarr->Value(45), entry_first);
4031 if (entry1 != entry_first)
4033 TDF_Tool::Entry(refarr->Value(46), entry_last);
4034 if (entry2 != entry_last)
4036 if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4038 if (bytearr->Value(15) != 150)
4040 if (bytearr->Value(16) != 160)
4042 if (bytearr->Value(17) != 170)
4044 if (bytearr->Value(18) != 180)
4046 if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4048 if (ref->Get().IsNull())
4050 if (ref->Get().Tag() != 103)
4054 Handle(TDocStd_Document) doc_xml, doc_xml_open;
4055 app->NewDocument("XmlOcaf", doc_xml);
4057 TDataStd_Tick::Set(doc_xml->Main());
4058 // TDataStd_IntegerList:
4059 intlist = TDataStd_IntegerList::Set(doc_xml->Main());
4062 // TDataStd_RealList:
4063 dbllist = TDataStd_RealList::Set(doc_xml->Main());
4064 dbllist->Append(1.5);
4065 dbllist->Append(5.5);
4066 // TDataStd_ExtStringList:
4067 strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
4068 strlist->Append("Guten ");
4069 strlist->Append("Tag");
4070 // TDataStd_BooleanList:
4071 boollist = TDataStd_BooleanList::Set(doc_xml->Main());
4072 boollist->Append(Standard_False);
4073 boollist->Append(Standard_True);
4074 // TDataStd_ReferenceList:
4075 TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
4076 TDF_Tool::Entry(Lxml1, entry1);
4077 TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
4078 TDF_Tool::Entry(Lxml2, entry2);
4079 reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
4080 reflist->Append(Lxml1);
4081 reflist->Append(Lxml2);
4082 // TDataStd_BooleanArray:
4083 boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
4084 boolarr->SetValue(15, Standard_False);
4085 boolarr->SetValue(16, Standard_True);
4086 boolarr->SetValue(17, Standard_True);
4087 boolarr->SetValue(18, Standard_True);
4088 boolarr->SetValue(19, Standard_True);
4089 boolarr->SetValue(20, Standard_True);
4090 boolarr->SetValue(21, Standard_False);
4091 boolarr->SetValue(22, Standard_True);
4092 boolarr->SetValue(23, Standard_True);
4093 boolarr->SetValue(24, Standard_True);
4094 // TDataStd_ReferenceArray:
4095 refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
4096 refarr->SetValue(444, Lxml1);
4097 refarr->SetValue(445, Lxml2);
4098 // TDataStd_ByteArray:
4099 bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
4100 bytearr->SetValue(15, 0);
4101 bytearr->SetValue(16, 10);
4102 bytearr->SetValue(17, 100);
4103 bytearr->SetValue(18, 200);
4104 bytearr->SetValue(19, 250);
4105 bytearr->SetValue(20, 251);
4106 bytearr->SetValue(21, 252);
4107 bytearr->SetValue(22, 253);
4108 bytearr->SetValue(23, 254);
4109 bytearr->SetValue(24, 255);
4111 Lstd3 = doc_xml->Main().FindChild(103);
4112 ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
4115 //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
4116 if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
4120 app->Close(doc_xml);
4122 //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
4123 if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
4125 if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4127 if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4129 if (intlist->First() != 1)
4131 if (intlist->Last() != 5)
4133 if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4135 if (dbllist->First() != 1.5)
4137 if (dbllist->Last() != 5.5)
4139 if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4141 if (strlist->First() != "Guten ")
4143 if (strlist->Last() != "Tag")
4145 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4147 if (boollist->First() != Standard_False)
4149 if (boollist->Last() != Standard_True)
4151 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4153 TDF_Tool::Entry(reflist->First(), entry_first);
4154 if (entry1 != entry_first)
4156 TDF_Tool::Entry(reflist->Last(), entry_last);
4157 if (entry2 != entry_last)
4159 if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4161 if (boolarr->Value(15) != Standard_False)
4163 if (boolarr->Value(16) != Standard_True)
4165 if (boolarr->Value(17) != Standard_True)
4167 if (boolarr->Value(18) != Standard_True)
4169 if (boolarr->Value(19) != Standard_True)
4171 if (boolarr->Value(20) != Standard_True)
4173 if (boolarr->Value(21) != Standard_False)
4175 if (boolarr->Value(22) != Standard_True)
4177 if (boolarr->Value(23) != Standard_True)
4179 if (boolarr->Value(24) != Standard_True)
4181 if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4183 TDF_Tool::Entry(refarr->Value(444), entry_first);
4184 if (entry1 != entry_first)
4186 TDF_Tool::Entry(refarr->Value(445), entry_last);
4187 if (entry2 != entry_last)
4189 if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4191 if (bytearr->Value(15) != 0)
4193 if (bytearr->Value(16) != 10)
4195 if (bytearr->Value(17) != 100)
4197 if (bytearr->Value(18) != 200)
4199 if (bytearr->Value(19) != 250)
4201 if (bytearr->Value(20) != 251)
4203 if (bytearr->Value(21) != 252)
4205 if (bytearr->Value(22) != 253)
4207 if (bytearr->Value(23) != 254)
4209 if (bytearr->Value(24) != 255)
4211 if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4213 if (ref->Get().IsNull())
4215 if (ref->Get().Tag() != 103)
4219 Handle(TDocStd_Document) doc_bin, doc_bin_open;
4220 app->NewDocument("BinOcaf", doc_bin);
4222 TDataStd_Tick::Set(doc_bin->Main());
4223 // TDataStd_IntegerList:
4224 intlist = TDataStd_IntegerList::Set(doc_bin->Main());
4227 // TDataStd_RealList:
4228 dbllist = TDataStd_RealList::Set(doc_bin->Main());
4229 dbllist->Append(1.5);
4230 dbllist->Append(5.5);
4231 // TDataStd_ExtStringList:
4232 strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
4233 strlist->Append("Bonjour");
4234 strlist->Append("Bonsoir");
4235 // TDataStd_BooleanList:
4236 boollist = TDataStd_BooleanList::Set(doc_bin->Main());
4237 boollist->Append(Standard_False);
4238 boollist->Append(Standard_True);
4239 // TDataStd_ReferenceList:
4240 TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
4241 TDF_Tool::Entry(Lbin1, entry1);
4242 TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
4243 TDF_Tool::Entry(Lbin2, entry2);
4244 reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
4245 reflist->Append(Lbin1);
4246 reflist->Append(Lbin2);
4247 // TDataStd_BooleanArray:
4248 boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
4249 boolarr->SetValue(15, Standard_False);
4250 boolarr->SetValue(16, Standard_True);
4251 boolarr->SetValue(17, Standard_True);
4252 boolarr->SetValue(18, Standard_True);
4253 boolarr->SetValue(19, Standard_True);
4254 boolarr->SetValue(20, Standard_True);
4255 boolarr->SetValue(21, Standard_False);
4256 boolarr->SetValue(22, Standard_True);
4257 boolarr->SetValue(23, Standard_True);
4258 boolarr->SetValue(24, Standard_True);
4259 // TDataStd_ReferenceArray:
4260 refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
4261 refarr->SetValue(0, Lbin1);
4262 refarr->SetValue(1, Lbin2);
4263 // TDataStd_ByteArray:
4264 bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
4265 bytearr->SetValue(15, 0);
4266 bytearr->SetValue(16, 255);
4267 // TDataStd_NamedData:
4268 nameddata = TDataStd_NamedData::Set(doc_bin->Main());
4269 nameddata->SetByte("A", 12);
4270 nameddata->SetByte("B", 234);
4272 Lstd3 = doc_bin->Main().FindChild(103);
4273 ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
4276 //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
4277 if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
4281 app->Close(doc_bin);
4283 //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
4284 if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
4286 if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
4288 if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
4290 if (intlist->First() != 1)
4292 if (intlist->Last() != 5)
4294 if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
4296 if (dbllist->First() != 1.5)
4298 if (dbllist->Last() != 5.5)
4300 if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
4302 if (strlist->First() != "Bonjour")
4304 if (strlist->Last() != "Bonsoir")
4306 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
4308 if (boollist->First() != Standard_False)
4310 if (boollist->Last() != Standard_True)
4312 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
4314 TDF_Tool::Entry(reflist->First(), entry_first);
4315 if (entry1 != entry_first)
4317 TDF_Tool::Entry(reflist->Last(), entry_last);
4318 if (entry2 != entry_last)
4320 if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
4322 if (boolarr->Value(15) != Standard_False)
4324 if (boolarr->Value(16) != Standard_True)
4326 if (boolarr->Value(17) != Standard_True)
4328 if (boolarr->Value(18) != Standard_True)
4330 if (boolarr->Value(19) != Standard_True)
4332 if (boolarr->Value(20) != Standard_True)
4334 if (boolarr->Value(21) != Standard_False)
4336 if (boolarr->Value(22) != Standard_True)
4338 if (boolarr->Value(23) != Standard_True)
4340 if (boolarr->Value(24) != Standard_True)
4342 if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
4344 TDF_Tool::Entry(refarr->Value(0), entry_first);
4345 if (entry1 != entry_first)
4347 TDF_Tool::Entry(refarr->Value(1), entry_last);
4348 if (entry2 != entry_last)
4350 if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
4352 if (bytearr->Value(15) != 0)
4354 if (bytearr->Value(16) != 255)
4356 if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
4358 if (nameddata->GetByte("A") != 12)
4360 if (nameddata->GetByte("B") != 234)
4362 if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
4364 if (ref->Get().IsNull())
4366 if (ref->Get().Tag() != 103)
4371 // For OCC16782 testing
4373 static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4377 di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
4380 TCollection_ExtendedString aFile1(argv[1]);
4381 TCollection_ExtendedString aFile2(argv[2]);
4382 TCollection_ExtendedString aFile3(argv[3]);
4385 app = new AppStd_Application();
4389 Handle(TDocStd_Document) doc;
4390 app->NewDocument("BinOcaf", doc);
4391 doc->SetUndoLimit(10);
4393 di <<"\nTestSetGet start\n";
4394 good += TestSetGet(doc);
4395 di <<"TestSetGet finish\n";
4396 di <<"Status = " << good << "\n";
4398 di <<"\nTestUndoRedo start\n";
4399 good += TestUndoRedo(doc);
4400 di <<"TestUndoRedo finish\n";
4401 di <<"Status = " << good << "\n";
4403 di <<"\nTestCopyPaste start\n";
4404 good += TestCopyPaste(doc);
4405 di <<"TestCopyPaste finish\n";
4406 di <<"Status = " << good << "\n";
4408 di <<"\nTestOpenSave start\n";
4409 good += TestOpenSave(aFile1, aFile2, aFile3);
4410 di <<"TestOpenSave finish\n";
4411 di <<"Status = " << good << "\n";
4414 di <<"\nThe " << argv[0] << " test is passed well, OK\n";
4416 di <<"\nThe " << argv[0] << " test failed, Faulty\n";
4421 static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4423 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
4424 if(aContext.IsNull()) {
4425 di << argv[0] << " ERROR : use 'vinit' command before \n";
4431 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4434 Standard_Integer mode = 0;
4437 mode = Draw::Atoi(argv[1]);
4439 if (mode > 2 || mode < 0)
4441 di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
4444 Handle(V3d_View) V = ViewerTest::CurrentView();
4445 static Handle(AIS_ColorScale) aCS;
4448 aCS = new AIS_ColorScale();
4450 if (aCS->ZLayer() != Graphic3d_ZLayerId_TopOSD)
4452 aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
4454 if (aCS->TransformPersistence().IsNull()
4455 || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
4457 aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
4459 Standard_Integer aWinWidth, aWinHeight;
4460 V->Window()->Size (aWinWidth, aWinHeight);
4461 aCS->SetSize (aWinWidth, aWinHeight);
4462 if ( !V.IsNull() ) {
4464 aContext->Display (aCS, Standard_True);
4467 aContext->Erase (aCS, Standard_False);
4472 Standard_Boolean IsDisplayed = aContext->IsDisplayed (aCS);
4474 di <<"ColorScaleIsDisplayed = 1\n";
4476 di <<"ColorScaleIsDisplayed = 0\n";
4482 #include <Interface_Macros.hxx>
4483 #include <IGESControl_Controller.hxx>
4484 #include <XSDRAW.hxx>
4485 #include <Draw_ProgressIndicator.hxx>
4486 #include <XSControl_WorkSession.hxx>
4487 #include <Transfer_TransientProcess.hxx>
4488 #include <TColStd_HSequenceOfTransient.hxx>
4489 #include <Message_ProgressScope.hxx>
4490 #include <XSControl_TransferReader.hxx>
4492 #include <Geom_Plane.hxx>
4493 static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4497 di << "Usage : " << argv[0] << " plane a b c d\n";
4501 Standard_Real A = Draw::Atof(argv[2]);
4502 Standard_Real B = Draw::Atof(argv[3]);
4503 Standard_Real C = Draw::Atof(argv[4]);
4504 Standard_Real D = Draw::Atof(argv[5]);
4506 Handle(Geom_Geometry) result;
4508 Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
4511 DrawTrSurf::Set(argv[1],result);
4515 static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4519 di << "Usage : " << argv[0] << " MaxNbr\n";
4522 Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
4524 for (Standard_Integer i=0;i<aMaxNbr;i++)
4526 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
4528 TopoDS_Wire wireShape( w.Wire());
4529 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
4530 TopoDS_Face f( faceBuilder.Face());
4531 BRepMesh_IncrementalMesh im(f,1);
4532 BRepTools::Clean(f);
4537 #include <IntCurvesFace_ShapeIntersector.hxx>
4538 #include <gp_Lin.hxx>
4539 Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4543 di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf\n";
4547 TopoDS_Shape shape = DBRep::Get(argv[1]);
4549 if (shape.IsNull()) {
4550 di<<" Null shape is not allowed";
4554 Standard_Real X_Pnt = Draw::Atof(argv[2]);
4555 Standard_Real Y_Pnt = Draw::Atof(argv[3]);
4556 Standard_Real Z_Pnt = Draw::Atof(argv[4]);
4558 Standard_Real X_Dir = Draw::Atof(argv[5]);
4559 Standard_Real Y_Dir = Draw::Atof(argv[6]);
4560 Standard_Real Z_Dir = Draw::Atof(argv[7]);
4562 Standard_Real PInf = Draw::Atof(argv[8]);
4564 IntCurvesFace_ShapeIntersector intersector;
4565 intersector.Load(shape, Precision::Intersection());
4567 gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
4568 gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
4569 gp_Lin ray(origin, dir);
4571 Standard_Real PSup = RealLast();
4572 intersector.PerformNearest(ray, PInf, PSup);
4573 if (intersector.NbPnt() != 0)
4575 di << argv[0] << " status = 0 \n";
4576 Standard_Real w = intersector.WParameter(1);
4577 di << "w = " << w << "\n";
4579 di << argv[0] << " status = -1 \n";
4584 Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4587 di << "Usage : " << argv[0] << "\n";
4591 // Create mask 1111: extent == 4
4592 TColStd_PackedMapOfInteger aFullMask;
4593 for (Standard_Integer i = 0; i < 4; i++)
4596 // Create mask 1100: extent == 2
4597 TColStd_PackedMapOfInteger aPartMask;
4598 for (Standard_Integer i = 0; i < 2; i++)
4601 di << "aFullMask = 1111\n";
4602 di << "aPartMask = 1100\n";
4604 Standard_Boolean isAffected;
4606 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
4607 di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4608 isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
4609 di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4610 isAffected = aFullMask.Subtract(aPartMask); // false (?)
4611 di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
4616 #include <NCollection_DataMap.hxx>
4617 Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4621 di << "Usage : " << argv[0] << "\n";
4625 TCollection_ExtendedString anExtString;
4627 Standard_ExtCharacter aNonAsciiChar = 0x0f00;
4628 anExtString.Insert(1, aNonAsciiChar);
4630 di << "Is ASCII: " << ( anExtString.IsAscii() ? "true : Error" : "false : OK" ) << "\n";
4631 NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
4632 aMap.Bind(anExtString, 0);
4638 Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4641 di << "Wrong number of arguments" << argv[0] << "\n";
4645 Standard_Real X_vec = Draw::Atof(argv[1]);
4646 Standard_Real Y_vec = Draw::Atof(argv[2]);
4647 Standard_Real Z_vec = Draw::Atof(argv[3]);
4649 Standard_Real X_dir = Draw::Atof(argv[4]);
4650 Standard_Real Y_dir = Draw::Atof(argv[5]);
4651 Standard_Real Z_dir = Draw::Atof(argv[6]);
4653 Standard_Real X_pnt = Draw::Atof(argv[7]);
4654 Standard_Real Y_pnt = Draw::Atof(argv[8]);
4655 Standard_Real Z_pnt = Draw::Atof(argv[9]);
4657 gp_Dir toSym(X_vec, Y_vec, Z_vec);
4658 gp_Dir dir(X_dir, Y_dir, Z_dir);
4659 gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
4660 gp_Ax2 symObj(loc,dir);
4661 toSym.Mirror(symObj);
4663 di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n";
4668 Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4672 di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
4676 Standard_Real X_mirrorFirstPoint = Draw::Atof(argv[1]);
4677 Standard_Real Y_mirrorFirstPoint = Draw::Atof(argv[2]);
4678 Standard_Real X_mirrorSecondPoint = Draw::Atof(argv[3]);
4679 Standard_Real Y_mirrorSecondPoint = Draw::Atof(argv[4]);
4680 Standard_Real X_p1 = Draw::Atof(argv[5]);
4681 Standard_Real Y_p1 = Draw::Atof(argv[6]);
4682 Standard_Real X_p2 = Draw::Atof(argv[7]);
4683 Standard_Real Y_p2 = Draw::Atof(argv[8]);
4685 gp_Trsf2d identityTransformation;
4687 gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
4688 gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
4689 gp_Ax2d mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
4691 gp_Pnt2d p1(X_p1,Y_p1);
4692 gp_Pnt2d p2(X_p2,Y_p2);
4695 M1.SetMirror(mirrorAxis);
4697 M2.SetMirror(mirrorAxis);
4699 Tcomp = M2.Multiplied(M1);
4701 Standard_Real aTol = Precision::Confusion();
4702 Standard_Integer aStatus = 0;
4704 //After applying two times the same mirror the point is located on the same location OK
4705 gp_Pnt2d p1MirrorM1 = p1.Transformed(M1);
4706 if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
4708 if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
4711 gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
4712 if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
4714 if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
4717 //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
4718 gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
4719 if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
4721 if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
4724 di << "Status = " << aStatus << "\n";
4728 Standard_Integer OCC23429(Draw_Interpretor& /*di*/,
4729 Standard_Integer narg, const char** a)
4731 if (narg < 4) return 1;
4733 TopoDS_Shape aShape = DBRep::Get(a[2]);
4734 if (aShape.IsNull()) return 1;
4736 BRepFeat_SplitShape Spls(aShape);
4737 Spls.SetCheckInterior(Standard_False);
4739 TopoDS_Shape aTool = DBRep::Get(a[3]);
4741 BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
4742 Builder.ComputePCurveOn1(Standard_True);
4744 Builder.Approximation(Standard_True);
4746 TopoDS_Shape aSection = Builder.Shape();
4748 TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
4749 for (; ExpSec.More(); ExpSec.Next())
4751 TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
4752 Handle(Geom2d_Curve) thePCurve;
4753 Handle(Geom_Surface) theSurface;
4754 TopLoc_Location theLoc;
4755 Standard_Real fpar, lpar;
4756 BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
4758 TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
4759 for (; ExpShape.More(); ExpShape.Next())
4761 aFace = TopoDS::Face(ExpShape.Current());
4762 TopLoc_Location aLoc;
4763 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
4764 if (aSurface == theSurface && aLoc == theLoc)
4767 Spls.Add(anEdge, aFace);
4770 TopoDS_Shape Result = Spls.Shape();
4771 DBRep::Set(a[1], Result);
4776 #include <ExprIntrp_GenExp.hxx>
4777 Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4781 di << "Usage : " << argv[0] << " string\n";
4785 Standard_CString aString = argv[1];
4786 Handle(ExprIntrp_GenExp) myExpr = ExprIntrp_GenExp::Create();
4789 myExpr->Process( aString );
4791 catch(Standard_Failure const& anException) {
4792 di << "Exception : " << anException.GetMessageString() << "\n";
4798 Standard_Integer OCC28478 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4800 Standard_Integer nbOuter = (argc > 1 ? Draw::Atoi(argv[1]) : 3);
4801 Standard_Integer nbInner = (argc > 2 ? Draw::Atoi(argv[2]) : 2);
4802 Standard_Boolean isInf = (argc > 3 && ! strcmp (argv[3], "-inf"));
4804 // test behavior of progress indicator when using nested scopes with names
4805 Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
4808 Message_ProgressScope anOuter (aProgress->Start(), "Outer", nbOuter);
4809 for (int i = 0; i < nbOuter && anOuter.More(); i++)
4812 Message_ProgressScope anInner (anOuter.Next(), "Inner", nbInner, isInf);
4813 for (int j = 0; j < (isInf ? 2 * nbInner : nbInner) && anInner.More(); j++, anInner.Next())
4822 Standard_Integer OCC31189 (Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char ** /*argv*/)
4824 // redirect output of default messenger to DRAW (temporarily)
4825 const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger();
4826 Message_SequenceOfPrinters aPrinters;
4827 aPrinters.Append (aMsgMgr->ChangePrinters());
4828 aMsgMgr->AddPrinter (new Draw_Printer (theDI));
4830 // scope block to test output of message on destruction of a stream buffer
4832 Message_Messenger::StreamBuffer aSender = Message::SendInfo();
4834 // check that messages output to sender and directly to messenger do not intermix
4835 aSender << "Sender message 1: start ...";
4836 aMsgMgr->Send ("Direct message 1");
4837 aSender << "... end" << std::endl; // endl should send the message
4839 // check that empty stream buffer does not produce output on destruction
4840 Message::SendInfo();
4842 // additional message to check that they go in expected order
4843 aMsgMgr->Send ("Direct message 2");
4845 // check that empty stream buffer does produce empty line if std::endl is passed
4846 Message::SendInfo() << std::endl;
4848 // last message should be sent on destruction of a sender
4849 aSender << "Sender message 2";
4852 // restore initial output queue
4853 aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer));
4854 aMsgMgr->ChangePrinters().Append (aPrinters);
4863 Message_ProgressRange Range;
4864 math_Matrix Mat1, Mat2, Mat3;
4866 Task(const Message_ProgressRange& thePR, int theSize)
4868 Mat1(1, theSize, 1, theSize, 0.12345), Mat2(1, theSize, 1, theSize, 12345),
4869 Mat3(1, theSize, 1, theSize)
4874 void operator()(Task& theTask) const
4876 if (theTask.Range.More())
4878 if (theTask.Mat1.RowNumber() > 1)
4879 theTask.Mat3 = theTask.Mat1 * theTask.Mat2;
4881 theTask.Range.Close();
4886 Standard_Integer OCC25748(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
4888 // test behavior of progress indicator in multi-threaded execution
4889 Standard_Integer nIter = 1000;
4890 Standard_Integer aMatSize = 1;
4891 Standard_Boolean isProgress = false;
4892 Standard_Boolean isParallel = false;
4894 for (int i = 1; i < argc; i++)
4896 if (strcmp(argv[i], "-niter") == 0)
4897 nIter = Draw::Atoi(argv[++i]);
4898 else if (strcmp(argv[i], "-matsize") == 0)
4899 aMatSize = Draw::Atoi(argv[++i]);
4900 else if (strcmp(argv[i], "-progr") == 0)
4902 else if (strcmp(argv[i], "-parallel") == 0)
4906 di.PrintHelp("OCC25748");
4911 OSD_Timer aTimerWhole;
4912 aTimerWhole.Start();
4914 Handle(Draw_ProgressIndicator) aProgress;
4917 aProgress = new Draw_ProgressIndicator(di, 1);
4919 Message_ProgressScope aPS(Message_ProgressIndicator::Start(aProgress),
4920 "Parallel data processing", nIter);
4922 std::vector<Task> aTasks;
4923 aTasks.reserve (nIter);
4924 for (int i = 0; i < nIter; i++)
4926 aTasks.push_back (Task (aPS.Next(), aMatSize));
4931 OSD_Parallel::ForEach(aTasks.begin(), aTasks.end(), Functor(), !isParallel);
4936 TCollection_AsciiString aText(nIter);
4937 aText += (isParallel ? " parallel" : " sequential");
4939 aText = aText + " calculations on matrices " + aMatSize + "x" + aMatSize;
4941 aText += " empty tasks";
4943 aText += " with progress";
4944 di << "COUNTER " << aText << ": " << aTimer.ElapsedTime();
4945 di << "\nCOUNTER " << "including preparations" << ": " << aTimerWhole.ElapsedTime();
4949 void QABugs::Commands_11(Draw_Interpretor& theCommands) {
4950 const char *group = "QABugs";
4952 theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
4954 // Remove as bad version of QAAddOrRemoveSelected from QADraw
4955 //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
4957 theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
4958 theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
4960 theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
4961 theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
4963 theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
4965 theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
4966 //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
4967 theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
4968 theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
4969 //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
4970 theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
4973 theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
4974 theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
4976 theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
4977 theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
4978 theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
4980 //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
4981 theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
4983 theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
4985 //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
4986 theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
4987 theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
4988 theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
4989 theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
4990 theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
4991 theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
4992 //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
4993 theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
4994 theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
4995 theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
4996 theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
4997 theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
4998 theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
4999 theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
5000 theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
5001 theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
5002 theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
5004 theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
5005 theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
5006 theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
5007 theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
5008 theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
5010 //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5011 theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
5013 theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
5014 theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
5015 theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
5016 theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
5017 theCommands.Add("OCC6143", "OCC6143 catching signals", __FILE__, OCC6143, group);
5018 theCommands.Add("OCC30775", "OCC30775 catching signals in threads", __FILE__, OCC30775, group);
5019 theCommands.Add("OCC30762", "OCC30762 printing backtrace", __FILE__, OCC30762, group);
5020 theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
5021 theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
5022 theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
5023 theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
5024 theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
5025 theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
5026 theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
5027 theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
5028 theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
5029 theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
5030 theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
5031 theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
5032 theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
5033 theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
5034 theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
5035 theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
5036 theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
5037 theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
5038 theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
5039 theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
5040 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);
5041 theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
5042 theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
5043 theCommands.Add("OCC28478", "OCC28478 [nb_outer=3 [nb_inner=2] [-inf]: test progress indicator on nested cycles", __FILE__, OCC28478, group);
5044 theCommands.Add("OCC31189", "OCC31189: check stream buffer interface of Message_Messenger", __FILE__, OCC31189, group);
5045 theCommands.Add("OCC25748", "OCC25748 [-niter val] [-matsize val] [-progr] [-parallel]\n"
5046 "\t\ttest progress indicator in parallel execution", __FILE__, OCC25748, group);
5048 theCommands.Add("OCC31965", "OCC31965 object : tests AIS_InteractiveContext::Hilight()", __FILE__, OCC31965, group);