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>
30 #include <BRepOffsetAPI_Sewing.hxx>
32 #include <AIS_ListOfInteractive.hxx>
33 #include <AIS_ListIteratorOfListOfInteractive.hxx>
35 #include <BRepPrimAPI_MakeBox.hxx>
37 static Standard_Integer OCC162 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
40 di << "Usage : " << argv[0] << " name\n";
44 TopoDS_Shape aShape = DBRep::Get(argv[1]);
45 if (aShape.IsNull()) return 0;
47 Standard_Real tolValue = 0.0001;
48 BRepOffsetAPI_Sewing sew(tolValue);
51 TopoDS_Shape aSewed = sew.SewedShape();
56 static Standard_Integer OCC172 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
58 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
59 if(aContext.IsNull()) {
60 di << "use 'vinit' command before " << argv[0] << "\n";
64 AIS_ListOfInteractive aListOfIO;
65 aContext->DisplayedObjects(aListOfIO);
66 AIS_ListIteratorOfListOfInteractive It;
67 for (It.Initialize(aListOfIO);It.More();It.Next())
69 aContext->AddOrRemoveSelected (It.Value(), Standard_False);
71 aContext->UpdateCurrentViewer();
75 static Standard_Integer OCC204 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
78 di << "Usage : " << argv[0] << " updateviewer=0/1\n";
82 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
83 if (aContext.IsNull()) {
84 di << "use 'vinit' command before " << argv[0] << "\n";
87 Standard_Boolean UpdateViewer = Standard_True;
88 Standard_Integer IntegerUpdateViewer = Draw::Atoi(argv[1]);
89 if (IntegerUpdateViewer == 0) {
90 UpdateViewer = Standard_False;
93 Standard_Integer deltaY = -500;
94 BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0 + deltaY, 0), gp_Pnt(100, 100 + deltaY, 100));
95 BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120 + deltaY, 120), gp_Pnt(300, 300 + deltaY,300));
96 BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320 + deltaY, 320), gp_Pnt(500, 500 + deltaY,500));
98 Handle(AIS_InteractiveObject) ais1 = new AIS_Shape(box1.Shape());
99 Handle(AIS_InteractiveObject) ais2 = new AIS_Shape(box2.Shape());
100 Handle(AIS_InteractiveObject) ais3 = new AIS_Shape(box3.Shape());
102 aContext->Display (ais1, Standard_False);
103 aContext->Display (ais2, Standard_False);
104 aContext->Display (ais3, Standard_False);
106 aContext->AddOrRemoveSelected (ais1, Standard_False);
107 aContext->AddOrRemoveSelected (ais2, Standard_False);
108 aContext->AddOrRemoveSelected (ais3, Standard_False);
110 aContext->UpdateCurrentViewer();
112 //printf("\n No of currents = %d", aContext->NbCurrents());
114 aContext->InitSelected();
117 while(aContext->MoreSelected())
119 //printf("\n count is = %d", count++);
120 Handle(AIS_InteractiveObject) ais = aContext->SelectedInteractive();
121 aContext->Remove(ais, UpdateViewer);
122 aContext->InitSelected();
128 #include <gp_Lin.hxx>
129 #include <BRepClass3d_Intersector3d.hxx>
130 #include <TopoDS.hxx>
131 static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
134 di << "Usage : " << argv[0] << " Shape PntX PntY PntZ DirX DirY DirZ\n";
138 TopoDS_Shape aShape = DBRep::Get(argv[1]);
139 if (aShape.IsNull()) return 0;
141 gp_Pnt aP1(Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]));
142 gp_Dir aD1(Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7]));
144 BRepClass3d_Intersector3d aI1;
145 aI1.Perform(aL1, -250, 1e-7, TopoDS::Face(aShape));
146 if(aI1.IsDone() && aI1.HasAPoint()) {
147 gp_Pnt aR1 = aI1.Pnt();
148 di << aR1.X() << " " << aR1.Y() << " " << aR1.Z() << "\n";
154 void QABugs::Commands_8(Draw_Interpretor& theCommands) {
155 const char *group = "QABugs";
157 theCommands.Add("OCC162", "OCC162 name", __FILE__, OCC162, group);
158 theCommands.Add("OCC172", "OCC172", __FILE__, OCC172, group);
159 theCommands.Add("OCC204", "OCC204 updateviewer=0/1", __FILE__, OCC204, group);
160 theCommands.Add("OCC1651", "OCC1651 Shape PntX PntY PntZ DirX DirY DirZ", __FILE__, OCC1651, group);