b311480e |
1 | // Created on: 2002-03-19 |
2 | // Created by: QA Admin |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <stdio.h> |
17 | |
1cd84fee |
18 | #include <QABugs.hxx> |
7fd59977 |
19 | |
20 | #include <Draw_Interpretor.hxx> |
21 | #include <DBRep.hxx> |
22 | #include <DrawTrSurf.hxx> |
23 | #include <AIS_InteractiveContext.hxx> |
24 | #include <ViewerTest.hxx> |
25 | #include <AIS_Shape.hxx> |
26 | #include <TopoDS_Shape.hxx> |
27 | |
28 | #include <Geom2d_Line.hxx> |
29 | #include <TColgp_Array1OfPnt2d.hxx> |
30 | #include <Geom2d_BezierCurve.hxx> |
31 | #include <Geom2dAdaptor_Curve.hxx> |
32 | #include <Geom2dGcc_QualifiedCurve.hxx> |
33 | #include <Geom2dGcc_Circ2d2TanRad.hxx> |
34 | #include <Geom2d_Circle.hxx> |
35 | #include <TopoDS_Edge.hxx> |
36 | #include <TopoDS.hxx> |
37 | #include <BRepAdaptor_Curve.hxx> |
38 | #include <gp_Lin.hxx> |
39 | #include <BRepFeat_SplitShape.hxx> |
40 | #include <DBRep_DrawableShape.hxx> |
41 | #include <BRep_Builder.hxx> |
42 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
43 | #include <BRepExtrema_DistShapeShape.hxx> |
44 | #include <Draw.hxx> |
45 | #include <TopoDS_Vertex.hxx> |
46 | #include <BRepLib_MakeVertex.hxx> |
47 | #include <BRepLib_MakeEdge.hxx> |
48 | #include <TColgp_HArray1OfPnt.hxx> |
49 | #include <GeomAPI_Interpolate.hxx> |
50 | #include <Precision.hxx> |
51 | #include <Geom_BSplineCurve.hxx> |
52 | #include <OSD_Path.hxx> |
53 | #include <ShapeBuild_ReShape.hxx> |
54 | #include <ShapeExtend_WireData.hxx> |
55 | #include <TopoDS_Wire.hxx> |
56 | #include <ShapeExtend_WireData.hxx> |
57 | #include <ShapeFix_Wire.hxx> |
58 | #include <ShapeAnalysis_WireOrder.hxx> |
59 | #include <ShapeAnalysis_Wire.hxx> |
60 | #include <TopExp.hxx> |
61 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
62 | #include <BRep_Tool.hxx> |
63 | #include <ShapeAnalysis_Curve.hxx> |
64 | #include <V3d_View.hxx> |
65 | #include <Standard_ErrorHandler.hxx> |
66 | |
67 | static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/) |
68 | { |
69 | Standard_Character abuf[16]; |
70 | |
71 | Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(100, 0), gp_Dir2d(-1, 0)); |
91322f44 |
72 | Sprintf(abuf,"line"); |
7fd59977 |
73 | Standard_CString st = abuf; |
74 | DrawTrSurf::Set (st, aLine); |
75 | |
76 | TColgp_Array1OfPnt2d aPoints(1, 3); |
77 | aPoints.SetValue(1, gp_Pnt2d(0, 0)); |
78 | aPoints.SetValue(2, gp_Pnt2d(50, 50)); |
79 | aPoints.SetValue(3, gp_Pnt2d(0, 100)); |
80 | Handle(Geom2d_BezierCurve) aCurve = new Geom2d_BezierCurve(aPoints); |
91322f44 |
81 | Sprintf(abuf,"curve"); |
7fd59977 |
82 | DrawTrSurf::Set (st, aCurve); |
83 | |
84 | Geom2dAdaptor_Curve aCLine(aLine); |
85 | Geom2dAdaptor_Curve aCCurve(aCurve); |
86 | Geom2dGcc_QualifiedCurve aQualifCurve1(aCLine, GccEnt_outside); |
87 | Geom2dGcc_QualifiedCurve aQualifCurve2(aCCurve, GccEnt_outside); |
88 | Geom2dGcc_Circ2d2TanRad aGccCirc2d(aQualifCurve1, aQualifCurve2, 10, 1e-7); |
89 | if(!aGccCirc2d.IsDone()) |
90 | { |
586db386 |
91 | di << "Faulty: can not create a circle.\n"; |
7fd59977 |
92 | return 1; |
93 | } |
94 | for(Standard_Integer i = 1; i <= aGccCirc2d.NbSolutions(); i++) |
95 | { |
96 | gp_Circ2d aCirc2d = aGccCirc2d.ThisSolution(i); |
97 | di << "circle : X " << aCirc2d.Location().X() << " Y " << aCirc2d.Location().Y() << " R " << aCirc2d.Radius(); |
98 | Standard_Real aTmpR1, aTmpR2; |
99 | gp_Pnt2d aPnt2d1, aPnt2d2; |
100 | aGccCirc2d.Tangency1(i, aTmpR1, aTmpR2, aPnt2d1); |
101 | aGccCirc2d.Tangency2(i, aTmpR1, aTmpR2, aPnt2d2); |
586db386 |
102 | di << "\ntangency1 : X " << aPnt2d1.X() << " Y " << aPnt2d1.Y(); |
103 | di << "\ntangency2 : X " << aPnt2d2.X() << " Y " << aPnt2d2.Y() << "\n"; |
7fd59977 |
104 | |
91322f44 |
105 | Sprintf(abuf,"circle_%d",i); |
7fd59977 |
106 | Handle(Geom2d_Curve) circ_res = new Geom2d_Circle(aCirc2d); |
107 | DrawTrSurf::Set (st, circ_res); |
108 | } |
109 | |
586db386 |
110 | di << "done\n"; |
7fd59977 |
111 | return 0; |
112 | } |
113 | |
114 | static Standard_Integer BUC60889 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
115 | { |
116 | if(argc != 10) { |
586db386 |
117 | di << "Usage : " << argv[0] << " point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2\n"; |
7fd59977 |
118 | return 1; |
119 | } else { |
120 | gp_Pnt p1, p2; |
121 | if (!(DrawTrSurf::GetPoint(argv[1], p1)) || !(DrawTrSurf::GetPoint(argv[2], p2))) |
122 | { |
586db386 |
123 | di << "Need two points to define a band\n"; |
7fd59977 |
124 | return 1; |
125 | } |
126 | TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(argv[3])); |
127 | if (ed.IsNull()) |
128 | { |
586db386 |
129 | di << "Need an edge to define the band direction\n"; |
7fd59977 |
130 | return 1; |
131 | } |
132 | BRepAdaptor_Curve curve(ed); |
133 | gp_Dir d = curve.Line().Direction(); |
134 | Bnd_Box bnd_box; |
91322f44 |
135 | bnd_box.Update(Draw::Atof(argv[4]), Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7]), Draw::Atof(argv[8]), Draw::Atof(argv[9])); |
7fd59977 |
136 | if(bnd_box.IsOut(p1, p2, d)) |
586db386 |
137 | di << "The band lies out of the box\n"; |
7fd59977 |
138 | else |
586db386 |
139 | di << "The band intersects the box\n"; |
7fd59977 |
140 | |
141 | return 0; |
142 | } |
143 | } |
144 | |
145 | static Standard_Integer BUC60852 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
146 | { |
147 | if(argc != 8) |
586db386 |
148 | di << "Usage : " << argv[0] << " name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2\n"; |
7fd59977 |
149 | else { |
150 | TopoDS_Edge shape = TopoDS::Edge(DBRep::Get(argv[1])); |
151 | if(shape.ShapeType() != TopAbs_EDGE) |
586db386 |
152 | di << "shape must be an edge\n"; |
7fd59977 |
153 | else { |
154 | BRepAdaptor_Curve curve(shape); |
155 | gp_Lin lin = curve.Line(); |
156 | Bnd_Box bnd_box; |
91322f44 |
157 | bnd_box.Update(Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7])); |
7fd59977 |
158 | if(bnd_box.IsOut(lin)) |
586db386 |
159 | di << "Line that lies on edge does not intersect the box\n"; |
7fd59977 |
160 | else |
586db386 |
161 | di << "Line that lies on edge intersects the box\n"; |
7fd59977 |
162 | } |
163 | } |
164 | return 0; |
165 | } |
166 | |
167 | static Standard_Integer BUC60854 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv) |
168 | { |
169 | Standard_Integer newnarg; |
170 | if (argc < 3) return 1; |
171 | TopoDS_Shape S = DBRep::Get(argv[2]); |
172 | BRepFeat_SplitShape Spls(S); |
173 | Standard_Boolean pick = Standard_False; |
174 | TopoDS_Shape EF; |
175 | Standard_Real u,v; |
176 | Standard_Integer i = 3; |
177 | for ( newnarg=3; newnarg<argc; newnarg++) { |
178 | if (argv[newnarg][0] == '@') { |
179 | break; |
180 | } |
181 | } |
182 | if (newnarg == 3 || |
183 | (newnarg !=argc && ((argc-newnarg)<=2 || (argc-newnarg)%2 != 1))) { |
184 | return 1; |
185 | } |
186 | if (i<newnarg) { |
187 | pick = (argv[i][0] == '.'); |
188 | EF = DBRep::Get(argv[i],TopAbs_FACE); |
189 | if (EF.IsNull()) return 1; |
190 | } |
191 | while (i < newnarg) { |
192 | if (pick) { |
193 | DBRep_DrawableShape::LastPick(EF,u,v); |
194 | } |
195 | if (EF.ShapeType() == TopAbs_FACE) { |
196 | i++; |
197 | while (i < newnarg) { |
198 | TopoDS_Shape W; |
199 | Standard_Boolean rever = Standard_False; |
200 | if (argv[i][0] == '-') { |
201 | if (argv[i][1] == '\0') |
202 | return 1; |
203 | pick = (argv[i][1] == '.'); |
204 | const char* Temp = argv[i]+1; |
205 | W = DBRep::Get(Temp,TopAbs_SHAPE,Standard_False); |
206 | rever = Standard_True; |
207 | } |
208 | else { |
209 | pick = (argv[i][0] == '.'); |
210 | W = DBRep::Get(argv[i],TopAbs_SHAPE,Standard_False); |
211 | } |
212 | if (W.IsNull()) { |
213 | return 1; |
214 | } |
215 | TopAbs_ShapeEnum wtyp = W.ShapeType(); |
216 | if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE && pick) { |
51740958 |
217 | Standard_Real aTempU, aTempV; |
218 | DBRep_DrawableShape::LastPick(W, aTempU, aTempV); |
7fd59977 |
219 | wtyp = W.ShapeType(); |
220 | } |
221 | if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE) { |
222 | EF = DBRep::Get(argv[i]); |
223 | break; |
224 | } |
225 | else { |
226 | if (rever) { |
227 | W.Reverse(); |
228 | } |
229 | if (wtyp == TopAbs_WIRE) { |
230 | Spls.Add(TopoDS::Wire(W),TopoDS::Face(EF)); |
231 | } |
232 | else { |
233 | Spls.Add(TopoDS::Edge(W),TopoDS::Face(EF)); |
234 | } |
235 | } |
236 | i++; |
237 | } |
238 | } |
239 | else |
240 | return 1; |
241 | } |
242 | for (i++; i<argc; i+=2) { |
243 | TopoDS_Shape Ew,Es; |
244 | TopoDS_Shape aLocalShape(DBRep::Get(argv[i],TopAbs_EDGE)); |
245 | Es = TopoDS::Edge(aLocalShape); |
246 | if (Es.IsNull()) { |
247 | return 1; |
248 | } |
249 | aLocalShape = DBRep::Get(argv[i+1],TopAbs_EDGE); |
250 | Ew = TopoDS::Edge(aLocalShape); |
251 | if (Ew.IsNull()) { |
252 | return 1; |
253 | } |
254 | Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es)); |
255 | } |
256 | Spls.Build(); |
257 | const TopTools_ListOfShape& aLeftPart = Spls.Left(); |
258 | BRep_Builder BB; |
259 | TopoDS_Shape aShell; |
260 | BB.MakeShell(TopoDS::Shell(aShell)); |
261 | TopTools_ListIteratorOfListOfShape anIter(aLeftPart); |
262 | for(; anIter.More(); anIter.Next()) BB.Add(aShell, anIter.Value()); |
ab860031 |
263 | aShell.Closed (BRep_Tool::IsClosed (aShell)); |
7fd59977 |
264 | DBRep::Set(argv[1],aShell); |
265 | return 0; |
266 | } |
267 | |
268 | static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
269 | { |
270 | Standard_Integer i1; |
271 | if (argc != 5) { |
586db386 |
272 | di << "Usage : " << argv[0] << " result name_of_shape_1 name_of_shape_2 dev\n"; |
7fd59977 |
273 | return 1; |
274 | } |
275 | const char *ns1 = (argv[2]), *ns2 = (argv[3]), *ns0 = (argv[1]); |
276 | TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ; |
91322f44 |
277 | Standard_Real dev = Draw::Atof(argv[4]); |
7fd59977 |
278 | BRepExtrema_DistShapeShape dst(S1 ,S2, dev ); |
279 | if (dst.IsDone()) { |
280 | char named[100]; |
91322f44 |
281 | Sprintf(named, "%s%s" ,ns0,"_val"); |
7fd59977 |
282 | char* tempd = named; |
283 | Draw::Set(tempd,dst.Value()); |
284 | di << named << " "; |
285 | for (i1=1; i1<= dst.NbSolution(); i1++) { |
286 | gp_Pnt P1,P2; |
287 | P1 = (dst.PointOnShape1(i1)); |
288 | P2 = (dst.PointOnShape2(i1)); |
289 | if (dst.Value()<=1.e-9) { |
290 | TopoDS_Vertex V =BRepLib_MakeVertex(P1); |
291 | char namev[100]; |
292 | if (i1==1) { |
91322f44 |
293 | Sprintf(namev, "%s" ,ns0); |
7fd59977 |
294 | } else { |
91322f44 |
295 | Sprintf(namev, "%s%d" ,ns0,i1); |
7fd59977 |
296 | } |
297 | char* tempv = namev; |
298 | DBRep::Set(tempv,V); |
299 | di << namev << " "; |
300 | } else { |
301 | char name[100]; |
302 | TopoDS_Edge E = BRepLib_MakeEdge (P1, P2); |
303 | if (i1==1) { |
91322f44 |
304 | Sprintf(name,"%s",ns0); |
7fd59977 |
305 | } else { |
91322f44 |
306 | Sprintf(name,"%s%d",ns0,i1); |
7fd59977 |
307 | } |
308 | char* temp = name; |
309 | DBRep::Set(temp,E); |
310 | di << name << " " ; |
311 | } |
312 | } |
313 | } else { |
586db386 |
314 | di << "Faulty : found a problem\n"; |
7fd59977 |
315 | } |
316 | return 0; |
317 | } |
318 | |
319 | static Standard_Integer BUC60902 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/) |
320 | { |
321 | Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1,5); |
322 | gp_Pnt aP(0., 0., 0.); |
323 | for(Standard_Integer i = 1; i <= 5; i++) { |
324 | aP.SetX((i-1)*1.57); |
325 | aP.SetY(Sin((i-1)*1.57)); |
326 | aPnts->SetValue(i, aP); |
327 | } |
328 | GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion()); |
329 | anInterpolater.Perform(); |
330 | if(!anInterpolater.IsDone()) { |
586db386 |
331 | di << "Faulty : error in interpolation\n"; |
7fd59977 |
332 | return 1; |
333 | } |
334 | Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve(); |
335 | gp_Vec aFirstTang, aLastTang; |
336 | aCur->D1(aCur->FirstParameter(), aP, aFirstTang); |
337 | aCur->D1(aCur->LastParameter(), aP, aLastTang); |
338 | di << " Used Tang1 = " << aFirstTang.X() << " " << aFirstTang.Y() << " " << aFirstTang.Z() << "\n"; |
339 | di << " Used Tang2 = " << aLastTang.X() << " " << aLastTang.Y() << " " << aLastTang.Z() << "\n"; |
340 | GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion()); |
341 | anInterpolater1.Load(aFirstTang, aLastTang, Standard_False); |
342 | anInterpolater1.Perform(); |
343 | if(!anInterpolater1.IsDone()) { |
586db386 |
344 | di << "Faulty : error in interpolation 1\n"; |
7fd59977 |
345 | return 1; |
346 | } |
347 | aCur = anInterpolater1.Curve(); |
348 | gp_Vec aFirstTang1, aLastTang1; |
349 | aCur->D1(aCur->FirstParameter(), aP, aFirstTang1); |
350 | aCur->D1(aCur->LastParameter(), aP, aLastTang1); |
351 | di << " Tang1 after compute = " << aFirstTang1.X() << " " << aFirstTang1.Y() << " " << aFirstTang1.Z() << "\n"; |
352 | di << " Tang2 after compute = " << aLastTang1.X() << " " << aLastTang1.Y() << " " << aLastTang1.Z() << "\n"; |
353 | if(aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular())) { |
586db386 |
354 | di << "First tangent is OK\n"; |
7fd59977 |
355 | } |
356 | else { |
586db386 |
357 | di << "Faulty : first tangent is wrong\n"; |
7fd59977 |
358 | } |
359 | if(aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular())) { |
586db386 |
360 | di << "Last tangent is OK\n"; |
7fd59977 |
361 | } |
362 | else { |
586db386 |
363 | di << "Faulty : last tangent is wrong\n"; |
7fd59977 |
364 | } |
365 | return 0; |
366 | } |
367 | |
368 | static Standard_Integer BUC60944 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
369 | { |
370 | if(argc != 2) { |
586db386 |
371 | di << "Usage : " << argv[0] << " path\n"; |
7fd59977 |
372 | } |
373 | |
374 | TCollection_AsciiString in(argv[1]); |
375 | OSD_Path* aPath = new OSD_Path(in); |
376 | TCollection_AsciiString out; |
377 | aPath->SystemName(out); |
378 | if(in == out) |
586db386 |
379 | di << "The convertion is right.\n"; |
7fd59977 |
380 | else |
381 | di << "Faulty : The convertion is incorrect : " << out.ToCString() << "\n"; |
382 | di << out.ToCString() << "\n"; |
04232180 |
383 | // std::cout << aPath->Trek() << " !" << std::endl; |
7fd59977 |
384 | return 0; |
385 | } |
386 | |
387 | Standard_Boolean BuildWiresWithReshape |
388 | (const Handle(ShapeBuild_ReShape)& theReshape, |
389 | const TopTools_ListOfShape &theListOfEdges, |
390 | TopTools_ListOfShape &theListOfWires, |
391 | const Standard_Boolean isFixConnectedMode, |
392 | const Standard_Boolean isKeepLoopsMode, |
393 | const Standard_Real theTolerance) |
394 | { |
395 | TopTools_ListIteratorOfListOfShape anEdgeIter; |
396 | Standard_Boolean isDone; |
397 | TopoDS_Wire aWire; |
398 | |
399 | theListOfWires.Clear(); |
400 | Handle(ShapeExtend_WireData) aWireData = new ShapeExtend_WireData; |
401 | Handle(ShapeFix_Wire) aShFixWire = new ShapeFix_Wire; |
402 | aShFixWire->SetContext (theReshape); |
403 | |
404 | Handle(ShapeAnalysis_Wire) aWireAnalyzer; |
405 | ShapeAnalysis_WireOrder aWireOrder; |
406 | |
407 | aShFixWire->Load(aWireData); |
408 | aShFixWire->SetPrecision(theTolerance); |
409 | |
410 | for(anEdgeIter.Initialize(theListOfEdges); anEdgeIter.More(); anEdgeIter.Next()) |
411 | aWireData->Add(TopoDS::Edge(anEdgeIter.Value())); |
412 | |
413 | aWireOrder.KeepLoopsMode() = isKeepLoopsMode; |
414 | aWireAnalyzer = aShFixWire->Analyzer(); |
415 | aWireAnalyzer->CheckOrder(aWireOrder, Standard_True); |
416 | |
417 | aShFixWire->FixReorder(aWireOrder); |
418 | isDone = !aShFixWire->StatusReorder(ShapeExtend_FAIL); |
419 | if (!isDone) |
420 | return Standard_False; |
421 | |
422 | if (isFixConnectedMode) |
423 | { |
424 | aShFixWire->ModifyTopologyMode() = Standard_True; |
425 | aShFixWire->FixConnected(theTolerance); |
426 | } |
427 | |
428 | aWire = aWireData->Wire(); |
429 | |
430 | // if (aWire.Closed()) |
431 | // { |
432 | // theListOfWires.Append(aWire); |
433 | // return Standard_True; |
434 | // } |
435 | |
436 | Standard_Integer i; |
437 | BRep_Builder aBuilder; |
438 | TopoDS_Wire aCurWire; |
439 | TopoDS_Vertex aVf; |
440 | TopoDS_Vertex aVl; |
441 | TopoDS_Vertex aVlast; |
442 | Standard_Integer aNbEdges = aWireData->NbEdges(); |
443 | |
444 | aBuilder.MakeWire(aCurWire); |
445 | if (aNbEdges >= 1) |
446 | { |
447 | TopoDS_Edge anE = aWireData->Edge(1); |
448 | TopExp::Vertices(anE, aVf, aVlast, Standard_True); |
449 | aBuilder.Add(aCurWire, anE); |
450 | } |
451 | |
452 | for(i = 2; i <= aNbEdges; i++) |
453 | { |
454 | TopoDS_Edge anE = aWireData->Edge(i); |
455 | TopExp::Vertices(anE, aVf, aVl, Standard_True); |
456 | if (aVf.IsSame(aVlast)) |
457 | { |
458 | aBuilder.Add(aCurWire, anE); |
459 | aVlast = aVl; |
460 | } |
461 | else |
462 | { |
463 | aVlast = aVl; |
464 | TopExp::Vertices(aCurWire, aVf, aVl); |
465 | if (aVf.IsSame(aVl)) |
466 | aCurWire.Closed(Standard_True); |
467 | theListOfWires.Append(aCurWire); |
468 | aBuilder.MakeWire(aCurWire); |
469 | aBuilder.Add(aCurWire, anE); |
470 | } |
471 | } |
472 | |
473 | TopExp::Vertices(aCurWire, aVf, aVl); |
474 | if (aVf.IsSame(aVl)) |
475 | aCurWire.Closed(Standard_True); |
476 | theListOfWires.Append(aCurWire); |
477 | |
478 | return Standard_True; |
479 | } |
480 | |
481 | Standard_Boolean BuildWires(const TopTools_ListOfShape &theListOfEdges, |
482 | TopTools_ListOfShape &theListOfWires, |
483 | const Standard_Boolean isFixConnectedMode = Standard_False, |
484 | const Standard_Boolean isKeepLoopsMode = Standard_True, |
485 | const Standard_Real theTolerance = Precision::Confusion()) |
486 | { |
487 | Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape; |
488 | return BuildWiresWithReshape (aReshape, theListOfEdges, theListOfWires, |
489 | isFixConnectedMode, isKeepLoopsMode, theTolerance); |
490 | } |
491 | |
492 | Standard_Boolean BuildBoundWires(const TopoDS_Shape &theShell, |
493 | TopTools_ListOfShape &theListOfWires) |
494 | { |
495 | TopTools_IndexedDataMapOfShapeListOfShape |
496 | anEdgeFaceMap; |
497 | Standard_Integer i; |
498 | Standard_Boolean isBound; |
499 | TopTools_ListOfShape aBoundaryEdges; |
500 | |
501 | TopExp::MapShapesAndAncestors(theShell, TopAbs_EDGE, TopAbs_FACE, anEdgeFaceMap); |
502 | |
503 | isBound = Standard_False; |
504 | for (i = 1; i <= anEdgeFaceMap.Extent(); i++) |
505 | { |
506 | const TopTools_ListOfShape &anAncestFaces = anEdgeFaceMap.FindFromIndex(i); |
507 | if (anAncestFaces.Extent() == 1) |
508 | { |
509 | const TopoDS_Edge &anEdge = TopoDS::Edge(anEdgeFaceMap.FindKey(i)); |
510 | if (!BRep_Tool::Degenerated(anEdge)) |
511 | { |
512 | aBoundaryEdges.Append(anEdge); |
513 | isBound = Standard_True; |
514 | } |
515 | } |
516 | } |
517 | |
518 | if (!isBound) |
519 | return Standard_True; |
520 | |
521 | return BuildWires(aBoundaryEdges, theListOfWires); |
522 | } |
523 | |
524 | static Standard_Integer BUC60868 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
525 | { |
526 | if (argc != 3) { |
586db386 |
527 | di << "Usage : " <<argv[0] << " Result Shell\n"; |
7fd59977 |
528 | return 1; |
529 | } |
530 | |
531 | TopoDS_Shape aShell = DBRep::Get(argv[2]); |
532 | |
533 | if (aShell.IsNull()) { |
586db386 |
534 | di << "Faulty : The shape is NULL\n"; |
7fd59977 |
535 | return 1; |
536 | } |
537 | |
538 | TopTools_ListOfShape aListOfWires; |
539 | BuildBoundWires(aShell, aListOfWires); |
540 | |
541 | TopoDS_Shape aRes; |
542 | if (aListOfWires.IsEmpty()) |
586db386 |
543 | di << "no bound\n"; |
7fd59977 |
544 | else if (aListOfWires.Extent() == 1) |
545 | aRes = aListOfWires.First(); |
546 | else { |
547 | BRep_Builder aBld; |
548 | aBld.MakeCompound (TopoDS::Compound(aRes)); |
549 | TopTools_ListIteratorOfListOfShape aWireIter (aListOfWires); |
550 | for(; aWireIter.More(); aWireIter.Next()) |
551 | aBld.Add (aRes, aWireIter.Value()); |
552 | } |
553 | |
554 | DBRep::Set(argv[1], aRes); |
555 | return 0; |
556 | } |
557 | |
558 | static Standard_Integer BUC60924 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
559 | { |
560 | if (argc != 5) { |
586db386 |
561 | di << "Usage : " <<argv[0] << " curve X Y Z\n"; |
7fd59977 |
562 | return 1; |
563 | } |
564 | |
565 | Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]); |
566 | |
567 | if (aCurve.IsNull()) { |
586db386 |
568 | di << "Faulty : the curve is NULL.\n"; |
7fd59977 |
569 | return 1; |
570 | } |
571 | |
91322f44 |
572 | gp_XYZ aVec(Draw::Atof(argv[2]),Draw::Atof(argv[3]),Draw::Atof(argv[4])); |
7fd59977 |
573 | |
574 | Standard_Boolean isPlanar=Standard_False; |
575 | isPlanar=ShapeAnalysis_Curve::IsPlanar(aCurve,aVec,1e-7); |
576 | |
577 | if(isPlanar) |
586db386 |
578 | di << "The curve is planar !\n"; |
7fd59977 |
579 | else |
586db386 |
580 | di << "Faulty : the curve is not planar!\n"; |
7fd59977 |
581 | |
582 | return 0; |
583 | } |
584 | |
585 | static Standard_Integer BUC60920(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv) |
586 | { |
587 | |
588 | Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext(); |
589 | if(myAISContext.IsNull()) { |
04232180 |
590 | std::cerr << "use 'vinit' command before " << argv[0] << "\n"; |
7fd59977 |
591 | return -1; |
592 | } |
593 | |
594 | di.Eval("box b 10 10 10"); |
595 | di.Eval("box w 20 20 20"); |
596 | di.Eval("explode w e"); |
597 | |
598 | di.Eval(" vdisplay b"); |
599 | di.Eval("vsetdispmode 1"); |
600 | |
601 | const char * Shname="w_11"; |
602 | TopoDS_Shape theShape = DBRep::Get(Shname); |
603 | |
604 | Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); |
605 | myAISContext->Display( anAISShape, Standard_True ); |
606 | |
607 | Handle(V3d_View) myV3dView = ViewerTest::CurrentView(); |
608 | |
609 | double Xv,Yv; |
610 | myV3dView->Project(20,20,0,Xv,Yv); |
04232180 |
611 | // std::cout<<Xv<<"\t"<<Yv<<std::endl; |
7fd59977 |
612 | |
613 | Standard_Integer Xp,Yp; |
614 | myV3dView->Convert(Xv,Yv,Xp,Yp); |
04232180 |
615 | // std::cout<<Xp<<"\t"<<Yp<<std::endl; |
7fd59977 |
616 | |
0577ae8c |
617 | myAISContext->MoveTo (Xp,Yp, myV3dView, Standard_True); |
7fd59977 |
618 | |
619 | // if (myAISContext->IsHilighted(anAISShape)) |
04232180 |
620 | // std::cout << "has hilighted shape : OK" << std::endl; |
621 | // else std::cout << "has hilighted shape : bugged - Faulty " << std::endl; |
7fd59977 |
622 | |
623 | return 0; |
624 | } |
625 | |
626 | #include <LDOMParser.hxx> |
627 | static Standard_Integer OCC983 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
628 | { |
629 | if (argc != 2) { |
586db386 |
630 | di << "Usage : " << argv[0] << " file\n"; |
7fd59977 |
631 | return 1; |
632 | } |
633 | |
634 | LDOMParser aParser; |
635 | LDOM_Document myDOM; |
636 | |
637 | const char *File = (argv[1]); |
638 | |
639 | if(!aParser.parse(File)) { |
640 | myDOM=aParser.getDocument(); |
586db386 |
641 | di<<"Document parsed\n"; |
7fd59977 |
642 | } else { |
586db386 |
643 | di<<"Document not parsed\n"; |
7fd59977 |
644 | return 0; |
645 | } |
646 | |
647 | LDOM_Element root = myDOM.getDocumentElement(); |
648 | |
649 | if ( root.isNull() ) { |
586db386 |
650 | di<<"Root element is null\n"; |
7fd59977 |
651 | return 0; |
652 | } |
653 | |
654 | TCollection_AsciiString RootName = root.getTagName(); |
655 | di << " RootName = " << RootName.ToCString() << "\n"; |
656 | LDOM_NodeList aChildList = root.GetAttributesList(); |
657 | for(Standard_Integer i=0,n=aChildList.getLength();i<n;i++) { |
658 | LDOM_Node item = aChildList.item(i); |
659 | TCollection_AsciiString itemName = item.getNodeName(); |
660 | TCollection_AsciiString itemValue = item.getNodeValue(); |
661 | di << " AttributeName = " << itemName.ToCString() << "\n"; |
662 | di << " AttributeValue = " << itemValue.ToCString() << "\n"; |
663 | } |
664 | |
665 | // LDOM_Element element; |
666 | // for ( element = (const LDOM_Element&) root.getFirstChild(); |
667 | // !element.isNull(); |
668 | // element = (const LDOM_Element&) element.getNextSibling() ) { |
669 | LDOM_Element element; |
670 | LDOM_Node node; |
671 | for ( node = root.getFirstChild(), element = (const LDOM_Element&) node; |
672 | !element.isNull(); |
673 | node = element.getNextSibling(), element = (const LDOM_Element&) node) { |
674 | TCollection_AsciiString ElementName = element.getTagName(); |
675 | di << " ElementName = " << ElementName.ToCString() << "\n"; |
676 | LDOM_NodeList aChildList2 = element.GetAttributesList(); |
677 | for(Standard_Integer i2=0,n2=aChildList2.getLength();i2<n2;i2++) { |
678 | LDOM_Node item2 = aChildList2.item(i2); |
679 | TCollection_AsciiString itemName2 = item2.getNodeName(); |
680 | TCollection_AsciiString itemValue2 = item2.getNodeValue(); |
681 | di << " AttributeName = " << itemName2.ToCString() << "\n"; |
682 | di << " AttributeValue = " << itemValue2.ToCString() << "\n"; |
683 | } |
684 | } |
685 | |
686 | return 0; |
687 | } |
688 | |
689 | static Standard_Integer OCC984 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
690 | { |
691 | if (argc != 2) { |
586db386 |
692 | di << "Usage : " << argv[0] << " file\n"; |
7fd59977 |
693 | return 1; |
694 | } |
695 | |
696 | LDOMParser aParser; |
697 | LDOM_Document myDOM; |
698 | |
699 | //Standard_Character *File = new Standard_Character [100]; |
91322f44 |
700 | //Sprintf(File,"%s",argv[1]); |
7fd59977 |
701 | const char *File = (argv[1]); |
702 | |
703 | if(!aParser.parse(File)) { |
704 | myDOM=aParser.getDocument(); |
586db386 |
705 | di<<"Document parsed\n"; |
7fd59977 |
706 | } else { |
586db386 |
707 | di<<"Document not parsed\n"; |
7fd59977 |
708 | } |
709 | |
710 | return 0; |
711 | } |
712 | |
7fd59977 |
713 | //#include <math.h> |
714 | // See QAOCC.cxx OCC6143 |
715 | //static Standard_Integer OCC1723 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv) |
716 | //{ |
717 | // if( argc != 1) |
718 | // { |
04232180 |
719 | // std::cout << "Usage : " << argv[0] << std::endl; |
7fd59977 |
720 | // return 1; |
721 | // } |
722 | // |
723 | // Standard_Boolean isBad = Standard_False, isCaught; |
724 | // |
725 | // // Case 1 |
726 | // isCaught = Standard_False; |
727 | // { |
728 | // try { |
729 | // OCC_CATCH_SIGNALS |
730 | // Standard_Integer a = 1; |
731 | // Standard_Integer b = 0; |
732 | // Standard_Integer c = a / b; |
733 | // } |
734 | // catch ( Standard_Failure ) { |
735 | // isCaught = Standard_True; |
04232180 |
736 | // std::cout << "OCC1723 Case 1 : OK" << std::endl; |
7fd59977 |
737 | // } |
738 | // } |
739 | // isBad = isBad || !isCaught; |
740 | // |
741 | // // Case 2 |
742 | // isCaught = Standard_False; |
743 | // { |
744 | // try { |
745 | // OCC_CATCH_SIGNALS |
746 | // Standard_Real d = -1.0; |
747 | // Standard_Real e = sqrt(d); |
748 | // } |
749 | // catch ( Standard_Failure ) { |
750 | // isCaught = Standard_True; |
04232180 |
751 | // std::cout << "OCC1723 Case 2 : OK" << std::endl; |
7fd59977 |
752 | // } |
753 | // } |
754 | // isBad = isBad || !isCaught; |
755 | // |
756 | // // Case 3 |
757 | // isCaught = Standard_False; |
758 | // { |
759 | // try { |
760 | // OCC_CATCH_SIGNALS |
761 | // Standard_Real f = 1.0e-200; |
762 | // Standard_Real g = 1.0e-200; |
763 | // Standard_Real h = f * g; |
764 | // } |
765 | // catch ( Standard_Failure ) { |
766 | // isCaught = Standard_True; |
04232180 |
767 | // std::cout << "OCC1723 Case 3 : OK" << std::endl; |
7fd59977 |
768 | // } |
769 | // } |
770 | // // MSV: underflow is not caught |
771 | // //isBad = isBad || !isCaught; |
772 | // |
773 | // // Case 4 |
774 | // isCaught = Standard_False; |
775 | // { |
776 | // try { |
777 | // OCC_CATCH_SIGNALS |
778 | // Standard_Real i = 1.0e+200; |
779 | // Standard_Real j = 1.0e+200; |
780 | // Standard_Real k = i * j; |
781 | // } |
782 | // catch ( Standard_Failure ) { |
783 | // isCaught = Standard_True; |
04232180 |
784 | // std::cout << "OCC1723 Case 4 : OK" << std::endl; |
7fd59977 |
785 | // } |
786 | // } |
787 | // isBad = isBad || !isCaught; |
788 | // |
789 | // if (isBad) { |
04232180 |
790 | // std::cout << "OCC1723 : Error" << std::endl; |
7fd59977 |
791 | // } else { |
04232180 |
792 | // std::cout << "OCC1723 : OK" << std::endl; |
7fd59977 |
793 | // } |
794 | // |
795 | // return 0; |
796 | //} |
797 | |
798 | #include <locale.h> |
799 | static Standard_Integer OCC1919_get (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
800 | { |
801 | if( argc != 1) |
802 | { |
803 | di << "Usage : " << argv[0] << "\n"; |
804 | return 1; |
805 | } |
806 | const TCollection_AsciiString anOldNumLocale = |
807 | (Standard_CString) setlocale (LC_NUMERIC, NULL); |
808 | di << "LC_NUMERIC = " << anOldNumLocale.ToCString() << "\n"; |
809 | return 0; |
810 | } |
811 | static Standard_Integer OCC1919_set (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
812 | { |
813 | if( argc != 2) |
814 | { |
586db386 |
815 | di << "Usage : " << argv[0] << " LC_NUMERIC\n"; |
7fd59977 |
816 | return 1; |
817 | } |
818 | TCollection_AsciiString aNumLocale(argv[1]); |
819 | setlocale(LC_ALL, "") ; |
820 | setlocale(LC_NUMERIC, aNumLocale.ToCString()) ; |
821 | return 0; |
822 | } |
823 | #include <DDF.hxx> |
824 | #include <TDF_Label.hxx> |
825 | #include <TDataStd_Real.hxx> |
826 | #include <NCollection_BaseMap.hxx> |
827 | static Standard_Integer OCC1919_real (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
828 | { |
829 | if (argc == 4) { |
830 | Handle(TDF_Data) DF; |
831 | if (!DDF::GetDF(argv[1],DF)) return 1; |
832 | TDF_Label L; |
833 | DDF::AddLabel(DF, argv[2], L); |
834 | |
91322f44 |
835 | //TDataStd_Real::Set(L,Draw::Atof(arg[3])); |
7fd59977 |
836 | TCollection_AsciiString AsciiStringReal(argv[3]); |
837 | if (!AsciiStringReal.IsRealValue()) return 1; |
838 | Standard_Real aReal = AsciiStringReal.RealValue(); |
839 | di << "aReal = " << aReal << "\n"; |
840 | |
841 | TDataStd_Real::Set(L,aReal); |
842 | return 0; |
843 | } |
844 | return 1; |
845 | } |
846 | |
847 | #include <TDataStd_UAttribute.hxx> |
848 | static Standard_Integer OCC2932_SetIDUAttribute (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
849 | { |
850 | if( argc != 5) |
851 | { |
586db386 |
852 | di << "Usage : " << argv[0] << " (DF, entry, oldLocalID, newLocalID)\n"; |
7fd59977 |
853 | return 1; |
854 | } |
855 | Handle(TDF_Data) DF; |
856 | if (!DDF::GetDF(argv[1],DF)) return 1; |
857 | TDF_Label label; |
858 | if( !DDF::FindLabel(DF, argv[2], label) ) { |
859 | di << "No label for entry " << argv[2] << "\n"; |
860 | return 0; |
861 | } |
862 | Standard_GUID old_guid(argv[3]); //"00000000-0000-0000-2222-000000000000"); |
863 | Standard_GUID new_guid(argv[4]); //"00000000-0000-0000-2222-000000000001"); |
864 | |
865 | Handle(TDataStd_UAttribute) UA; |
866 | if( !label.FindAttribute(old_guid, UA) ) { |
867 | di << "No UAttribute Attribute on label " << argv[2] << "\n"; |
868 | return 0; |
869 | } |
870 | Handle(TDataStd_UAttribute) anotherUA; |
871 | if( label.FindAttribute(new_guid, anotherUA) ) { |
872 | di << "There is this UAttribute Attribute on label " << argv[2] << "\n"; |
873 | return 0; |
874 | } |
875 | UA->SetID(new_guid); |
876 | return 0; |
877 | } |
878 | |
879 | static Standard_Integer OCC2932_SetTag (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
880 | { |
881 | if( argc != 4) |
882 | { |
586db386 |
883 | di << "Usage : " << argv[0] << " (DF, entry, Tag)\n"; |
7fd59977 |
884 | return 1; |
885 | } |
886 | Handle(TDF_Data) DF; |
887 | if (!DDF::GetDF(argv[1],DF)) return 1; |
888 | TDF_Label L; |
889 | DDF::AddLabel(DF, argv[2], L); |
91322f44 |
890 | Standard_Integer Tag = Draw::Atoi(argv[3]); |
7fd59977 |
891 | Handle(TDF_TagSource) A = TDF_TagSource::Set(L); |
892 | A->Set(Tag); |
893 | return 0; |
894 | } |
895 | |
896 | #include <TDataStd_Current.hxx> |
897 | static Standard_Integer OCC2932_SetCurrent (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
898 | { |
899 | if( argc != 3) |
900 | { |
586db386 |
901 | di << "Usage : " << argv[0] << " (DF, entry)\n"; |
7fd59977 |
902 | return 1; |
903 | } |
904 | Handle(TDF_Data) DF; |
905 | if (!DDF::GetDF(argv[1],DF)) return 1; |
906 | TDF_Label L; |
907 | DDF::AddLabel(DF, argv[2], L); |
908 | TDataStd_Current::Set(L); |
909 | return 0; |
910 | } |
911 | |
912 | #include <TDataStd_Expression.hxx> |
913 | static Standard_Integer OCC2932_SetExpression (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
914 | { |
915 | if( argc != 4) |
916 | { |
586db386 |
917 | di << "Usage : " << argv[0] << " (DF, entry, Expression)\n"; |
7fd59977 |
918 | return 1; |
919 | } |
920 | Handle(TDF_Data) DF; |
921 | if (!DDF::GetDF(argv[1],DF)) return 1; |
922 | TDF_Label L; |
923 | DDF::AddLabel(DF, argv[2], L); |
924 | TCollection_ExtendedString Expression(argv[3]); |
925 | Handle(TDataStd_Expression) A = TDataStd_Expression::Set(L); |
926 | A->SetExpression(Expression); |
927 | return 0; |
928 | } |
929 | |
930 | #include <TDataStd_Relation.hxx> |
931 | static Standard_Integer OCC2932_SetRelation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
932 | { |
933 | if( argc != 4) |
934 | { |
586db386 |
935 | di << "Usage : " << argv[0] << " (DF, entry, Relation)\n"; |
7fd59977 |
936 | return 1; |
937 | } |
938 | Handle(TDF_Data) DF; |
939 | if (!DDF::GetDF(argv[1],DF)) return 1; |
940 | TDF_Label L; |
941 | DDF::AddLabel(DF, argv[2], L); |
942 | TCollection_ExtendedString Relation(argv[3]); |
943 | Handle(TDataStd_Relation) A = TDataStd_Relation::Set(L); |
944 | A->SetRelation(Relation); |
945 | return 0; |
946 | } |
947 | |
948 | static Standard_Integer OCC3277 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
949 | { |
950 | if( argc != 2) |
951 | { |
586db386 |
952 | di << "Usage : " << argv[0] << " string\n"; |
7fd59977 |
953 | return 1; |
954 | } |
955 | TCollection_ExtendedString ExtendedString; |
956 | TCollection_ExtendedString InputString(argv[1]); |
957 | ExtendedString.Cat(InputString); |
04232180 |
958 | //ExtendedString.Print(std::cout); |
7fd59977 |
959 | Standard_SStream aSStream; |
960 | ExtendedString.Print(aSStream); |
961 | di << aSStream; |
962 | return 0; |
963 | } |
964 | |
965 | static Standard_Integer OCC6794 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
966 | { |
967 | if (argc > 2) |
968 | { |
586db386 |
969 | di << "Usage: " << argv[0] << " [nb]\n"; |
7fd59977 |
970 | return 1; |
971 | } |
972 | |
973 | char* max = ::getenv( "MMGT_THRESHOLD" ); |
974 | |
975 | Standard_Integer aNb = 1; |
976 | if ( max ) |
91322f44 |
977 | aNb += Draw::Atoi( max ); |
7fd59977 |
978 | else |
979 | aNb += 40000; |
980 | |
981 | if ( argc > 1 ) |
91322f44 |
982 | aNb = Draw::Atoi( argv[1] ); |
7fd59977 |
983 | |
984 | di << "Use nb = " << aNb << "\n"; |
985 | |
986 | const char* c = "a"; |
987 | { |
988 | TCollection_AsciiString anAscii; |
989 | for ( int i = 1; i <= aNb; i++ ) { |
990 | anAscii += TCollection_AsciiString( c ); |
991 | } |
992 | Standard_Integer aLength = anAscii.Length(); |
993 | di << "aLength = " << aLength << "\n"; |
994 | } |
995 | return 0; |
996 | } |
997 | |
998 | static Standard_Integer OCC16485 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
999 | { |
1000 | if (argc > 1) |
1001 | { |
1002 | di << "Usage: " << argv[0] << "\n"; |
1003 | return 1; |
1004 | } |
1005 | |
1006 | // Create points with X co-ordinate from varying from 0. to 1000. |
1007 | // anc compute cumulative bounding box by adding boxes for all the |
1008 | // points, enlarged on tolerance |
1009 | |
1010 | Standard_Real tol = 1e-3; |
1011 | int nbstep = 1000; |
1012 | Bnd_Box Box; |
1013 | for ( int i=0; i <= nbstep; i++ ) |
1014 | { |
1015 | gp_Pnt p(i, 0., 0.); |
1016 | Bnd_Box B; |
1017 | B.Add(p); |
1018 | B.Enlarge(tol); |
1019 | B.Add ( Box ); |
1020 | Box = B; // in this case XMin of Box will grow each time |
1021 | } |
1022 | |
1023 | Standard_Real xmin, ymin, zmin, xmax, ymax, zmax; |
1024 | Box.Get (xmin, ymin, zmin, xmax, ymax, zmax); |
04232180 |
1025 | //std::cout.precision(16); |
1026 | //std::cout << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << std::endl; |
7fd59977 |
1027 | di << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << "\n"; |
1028 | if ( Abs ( xmin + tol ) > 1e-10 ) |
1029 | di << "TEST FAILED: Xmin must be equal to -1e3!\n"; |
1030 | else |
1031 | di << "TEST OK\n"; |
04232180 |
1032 | //std::cout << "TEST FAILED: Xmin must be equal to -1e3!" << std::endl; |
1033 | //std::cout << "TEST OK" << std::endl; |
7fd59977 |
1034 | //di << "TEST FAILED: Xmin must be equal to -1e3!\n"; |
1035 | //di << "TEST OK\n"; |
1036 | return 0; |
1037 | } |
1038 | //Resulting dimensions: Xmin = -0.001 , Xmax = 1000.001 , Tolerance = 0.001 |
1039 | //TEST OK |
1040 | |
1cd84fee |
1041 | void QABugs::Commands_14(Draw_Interpretor& theCommands) { |
1042 | const char *group = "QABugs"; |
7fd59977 |
1043 | |
1044 | theCommands.Add ("BUC60897", "BUC60897", __FILE__, BUC60897, group); |
1045 | theCommands.Add ("BUC60889", "BUC60889 point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60889, group); |
1046 | theCommands.Add ("BUC60852", "BUC60852 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60852, group); |
1047 | theCommands.Add ("BUC60854", "BUC60854 result_shape name_of_shape name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] [ name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] ... ] [ @ edge_on_shape edge_on_wire [ edge_on_shape edge_on_wire ... ] ] ", __FILE__, BUC60854, group); |
1048 | theCommands.Add ("BUC60870", "BUC60870 result name_of_shape_1 name_of_shape_2 dev", __FILE__, BUC60870, group); |
1049 | theCommands.Add ("BUC60902", "BUC60902", __FILE__, BUC60902, group); |
1050 | theCommands.Add ("BUC60944", "BUC60944 path", __FILE__, BUC60944, group); |
1051 | theCommands.Add ("BUC60868", "BUC60868 Result Shell", __FILE__, BUC60868, group); |
1052 | theCommands.Add ("BUC60924", "BUC60924 curve X Y Z", __FILE__, BUC60924, group); |
1053 | theCommands.Add ("BUC60920", "BUC60920", __FILE__, BUC60920, group); |
1054 | theCommands.Add ("OCC983", "OCC983 file", __FILE__, OCC983, group); |
1055 | theCommands.Add ("OCC984", "OCC984 file", __FILE__, OCC984, group); |
1056 | |
7fd59977 |
1057 | // theCommands.Add ("OCC1723", "OCC1723", __FILE__, OCC1723, group); |
1058 | |
1059 | theCommands.Add ("OCC1919_get", "OCC1919_get", __FILE__, OCC1919_get, group); |
1060 | |
1061 | theCommands.Add ("OCC1919_set", "OCC1919_set LC_NUMERIC", __FILE__, OCC1919_set, group); |
1062 | |
1063 | theCommands.Add ("OCC1919_real", "OCC1919_real (DF, entry, value)", __FILE__, OCC1919_real, group); |
1064 | |
1065 | theCommands.Add ("OCC2932_SetIDUAttribute", "OCC2932_SetIDUAttribute (DF, entry, oldLocalID, newLocalID)", __FILE__, OCC2932_SetIDUAttribute, group); |
1066 | |
1067 | theCommands.Add ("OCC2932_SetTag", "OCC2932_SetTag (DF, entry, Tag)", __FILE__, OCC2932_SetTag, group); |
1068 | |
1069 | theCommands.Add ("OCC2932_SetCurrent", "OCC2932_SetCurrent (DF, entry)", __FILE__, OCC2932_SetCurrent, group); |
1070 | |
1071 | theCommands.Add ("OCC2932_SetExpression", "OCC2932_SetExpression (DF, entry, Expression)", __FILE__, OCC2932_SetExpression, group); |
1072 | |
1073 | theCommands.Add ("OCC2932_SetRelation", "OCC2932_SetRelation (DF, entry, Relation)", __FILE__, OCC2932_SetRelation, group); |
1074 | |
1075 | theCommands.Add ("OCC3277", "OCC3277 string", __FILE__, OCC3277, group); |
1076 | |
1077 | theCommands.Add ("OCC6794", "OCC6794 [nb]", __FILE__, OCC6794, group); |
1078 | |
1079 | theCommands.Add ("OCC16485", "OCC16485", __FILE__, OCC16485, group); |
1080 | |
1081 | return; |
1082 | } |