1 // Created on: 2002-03-19
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.
19 #include <Draw_Interpretor.hxx>
21 #include <DrawTrSurf.hxx>
22 #include <AIS_InteractiveContext.hxx>
23 #include <ViewerTest.hxx>
24 #include <AIS_Shape.hxx>
25 #include <TopoDS_Shape.hxx>
27 #include <TColStd_Array2OfReal.hxx>
28 #include <V3d_View.hxx>
29 #include <Visual3d_View.hxx>
31 #include <BRepOffsetAPI_Sewing.hxx>
33 #include <AIS_ListOfInteractive.hxx>
34 #include <AIS_ListIteratorOfListOfInteractive.hxx>
36 #include <BRepPrimAPI_MakeBox.hxx>
38 static Standard_Integer OCC162 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
41 di << "Usage : " << argv[0] << " name" << "\n";
45 TopoDS_Shape aShape = DBRep::Get(argv[1]);
46 if (aShape.IsNull()) return 0;
48 Standard_Real tolValue = 0.0001;
49 BRepOffsetAPI_Sewing sew(tolValue);
52 TopoDS_Shape aSewed = sew.SewedShape();
57 static Standard_Integer OCC172 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
59 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
60 if(aContext.IsNull()) {
61 di << "use 'vinit' command before " << argv[0] << "\n";
65 AIS_ListOfInteractive aListOfIO;
66 aContext->DisplayedObjects(aListOfIO);
67 AIS_ListIteratorOfListOfInteractive It;
68 for (It.Initialize(aListOfIO);It.More();It.Next())
70 aContext->AddOrRemoveCurrentObject(It.Value());
76 static Standard_Integer OCC204 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
79 di << "Usage : " << argv[0] << " updateviewer=0/1" << "\n";
83 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
84 if (aContext.IsNull()) {
85 di << "use 'vinit' command before " << argv[0] << "\n";
88 Standard_Boolean UpdateViewer = Standard_True;
89 Standard_Integer IntegerUpdateViewer = Draw::Atoi(argv[1]);
90 if (IntegerUpdateViewer == 0) {
91 UpdateViewer = Standard_False;
94 Standard_Integer deltaY = -500;
95 BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0 + deltaY, 0), gp_Pnt(100, 100 + deltaY, 100));
96 BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120 + deltaY, 120), gp_Pnt(300, 300 + deltaY,300));
97 BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320 + deltaY, 320), gp_Pnt(500, 500 + deltaY,500));
99 Handle(AIS_Shape) ais1 = new AIS_Shape(box1.Shape());
100 Handle(AIS_Shape) ais2 = new AIS_Shape(box2.Shape());
101 Handle(AIS_Shape) ais3 = new AIS_Shape(box3.Shape());
103 aContext->Display(ais1);
104 aContext->Display(ais2);
105 aContext->Display(ais3);
107 aContext->AddOrRemoveCurrentObject(ais1);
108 aContext->AddOrRemoveCurrentObject(ais2);
109 aContext->AddOrRemoveCurrentObject(ais3);
111 //printf("\n No of currents = %d", aContext->NbCurrents());
113 aContext->InitCurrent();
116 while(aContext->MoreCurrent())
118 //printf("\n count is = %d", count++);
119 Handle(AIS_InteractiveObject) ais = aContext->Current();
120 aContext->Remove(ais, UpdateViewer);
121 aContext->InitCurrent();
127 #include <gp_Lin.hxx>
128 #include <BRepClass3d_Intersector3d.hxx>
129 #include <TopoDS.hxx>
130 static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
133 di << "Usage : " << argv[0] << " Shape PntX PntY PntZ DirX DirY DirZ" << "\n";
137 TopoDS_Shape aShape = DBRep::Get(argv[1]);
138 if (aShape.IsNull()) return 0;
140 gp_Pnt aP1(Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]));
141 gp_Dir aD1(Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7]));
143 BRepClass3d_Intersector3d aI1;
144 aI1.Perform(aL1, -250, 1e-7, TopoDS::Face(aShape));
145 if(aI1.IsDone() && aI1.HasAPoint()) {
146 gp_Pnt aR1 = aI1.Pnt();
147 di << aR1.X() << " " << aR1.Y() << " " << aR1.Z() << "\n";
153 void QABugs::Commands_8(Draw_Interpretor& theCommands) {
154 const char *group = "QABugs";
156 theCommands.Add("OCC162", "OCC162 name", __FILE__, OCC162, group);
157 theCommands.Add("OCC172", "OCC172", __FILE__, OCC172, group);
158 theCommands.Add("OCC204", "OCC204 updateviewer=0/1", __FILE__, OCC204, group);
159 theCommands.Add("OCC1651", "OCC1651 Shape PntX PntY PntZ DirX DirY DirZ", __FILE__, OCC1651, group);