9ebaae37 |
1 | // Created on: 2015-06-18 |
2 | // Created by: Ilya Novikov |
3 | // Copyright (c) 2000-2015 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #include <XDEDRAW_GDTs.hxx> |
17 | |
18 | #include <Draw.hxx> |
19 | #include <DBRep.hxx> |
20 | #include <DDocStd.hxx> |
21 | |
727b5ad9 |
22 | #include <STEPCAFControl_GDTProperty.hxx> |
6595eee7 |
23 | |
9ebaae37 |
24 | #include <TDF_Tool.hxx> |
25 | #include <TDF_Label.hxx> |
26 | #include <TDF_LabelSequence.hxx> |
27 | #include <TDocStd_Document.hxx> |
28 | #include <XCAFDoc_GraphNode.hxx> |
29 | |
30 | #include <XCAFDoc.hxx> |
31 | #include <XCAFDoc_DocumentTool.hxx> |
32 | #include <XCAFDoc_ShapeTool.hxx> |
33 | #include <XCAFDoc_DimTol.hxx> |
34 | #include <XCAFDoc_Dimension.hxx> |
35 | #include <XCAFDimTolObjects_DimensionObject.hxx> |
36 | #include <XCAFDoc_Datum.hxx> |
37 | #include <XCAFDimTolObjects_DatumObject.hxx> |
38 | #include <XCAFDoc_GeomTolerance.hxx> |
39 | #include <XCAFDimTolObjects_GeomToleranceObject.hxx> |
40 | #include <XCAFDoc_DimTolTool.hxx> |
41 | #include <XCAFDimTolObjects_DimensionObjectSequence.hxx> |
42 | #include <XCAFDimTolObjects_DatumObjectSequence.hxx> |
43 | #include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx> |
44 | #include <XCAFDimTolObjects_DatumSingleModif.hxx> |
45 | #include <XCAFDimTolObjects_DimensionModif.hxx> |
46 | #include <XCAFDimTolObjects_GeomToleranceModif.hxx> |
47 | #include <XCAFDimTolObjects_DatumModifiersSequence.hxx> |
48 | #include <XCAFDimTolObjects_DatumObject.hxx> |
49 | #include <XCAFDimTolObjects_Tool.hxx> |
50 | |
51 | #include <TCollection_AsciiString.hxx> |
52 | #include <TCollection_HAsciiString.hxx> |
53 | #include <TColStd_HArray1OfReal.hxx> |
54 | #include <TColgp_HArray1OfPnt.hxx> |
55 | |
56 | #include <TopoDS.hxx> |
57 | #include <TopoDS_Shape.hxx> |
58 | #include <TopoDS_Edge.hxx> |
59 | #include <TopoDS_Vertex.hxx> |
60 | #include <BRep_Tool.hxx> |
61 | |
62 | |
63 | |
64 | static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
65 | { |
66 | if (argc < 3) { |
586db386 |
67 | di<<"Use: XDumpDGTs Doc shape/label/all\n"; |
9ebaae37 |
68 | return 1; |
69 | } |
70 | Handle(TDocStd_Document) Doc; |
71 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
72 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
73 | Handle(XCAFDoc_DimTolTool) aDimTolTool= XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
74 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
75 | |
76 | TCollection_AsciiString name = argv[2]; |
77 | TDF_LabelSequence aLabels; |
78 | if(name.IsEqual("all")) |
79 | { |
80 | aShapeTool->GetShapes(aLabels); |
81 | for ( Standard_Integer i=1; i <= aLabels.Length(); i++ ) |
82 | { |
83 | aShapeTool->GetSubShapes(aLabels.Value(i), aLabels); |
84 | } |
85 | } |
86 | else |
87 | { |
88 | TDF_Label aLabel; |
89 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
90 | if ( !aLabel.IsNull() ) { |
91 | aLabels.Append(aLabel); |
92 | aShapeTool->GetSubShapes(aLabel, aLabels); |
93 | } |
94 | else |
95 | { |
96 | TopoDS_Shape aShape= DBRep::Get(argv[2]); |
97 | if ( !aShape.IsNull() ) |
98 | { |
99 | aShapeTool->Search(aShape, aLabel); |
100 | if ( !aLabel.IsNull() ) { |
101 | aLabels.Append(aLabel); |
102 | aShapeTool->GetSubShapes(aLabel, aLabels); |
103 | } |
104 | else |
105 | { |
106 | di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
107 | return 1; |
108 | } |
109 | } |
110 | } |
111 | } |
112 | |
113 | for ( Standard_Integer i=1; i <= aLabels.Length(); i++ ) |
114 | { |
115 | Standard_Boolean flag = Standard_True; |
116 | TDF_LabelSequence aGDTs; |
117 | aDimTolTool->GetRefDimensionLabels(aLabels.Value(i), aGDTs); |
118 | for ( Standard_Integer j=1; j <= aGDTs.Length(); j++ ) |
119 | { |
120 | Handle(XCAFDoc_Dimension) aDimTol; |
121 | if(aGDTs.Value(j).FindAttribute(XCAFDoc_Dimension::GetID(), aDimTol)) |
122 | { |
123 | Handle(XCAFDimTolObjects_DimensionObject) aDimTolObj = aDimTol->GetObject(); |
124 | if(flag) |
125 | { |
126 | TCollection_AsciiString Entry; |
127 | TDF_Tool::Entry(aLabels.Value(i), Entry); |
586db386 |
128 | di << "\n " << Entry << " Shape."<< i; |
9ebaae37 |
129 | flag = Standard_False; |
130 | } |
131 | TCollection_AsciiString Entry; |
132 | TDF_Tool::Entry(aGDTs.Value(j), Entry); |
133 | di << "\n \t " << Entry; |
134 | flag = Standard_False; |
135 | |
586db386 |
136 | di << " Dimension."<< i << "."<< j; |
1c9d3225 |
137 | if (argc > 3) |
138 | { |
139 | di <<" ("; |
140 | di << " T " << aDimTolObj->GetType(); |
141 | if(aDimTolObj->IsDimWithRange()) |
142 | { |
143 | di << ", LB " << aDimTolObj->GetLowerBound(); |
144 | di << ", UB " << aDimTolObj->GetUpperBound(); |
145 | } |
146 | else |
147 | { |
148 | di << ", V " << aDimTolObj->GetValue(); |
149 | if (aDimTolObj->IsDimWithPlusMinusTolerance()) |
150 | { |
151 | di << ", VL " << aDimTolObj->GetLowerTolValue(); |
152 | di << ", VU " << aDimTolObj->GetUpperTolValue(); |
153 | } |
154 | else if (aDimTolObj->IsDimWithClassOfTolerance()) |
155 | { |
156 | Standard_Boolean isH; |
157 | XCAFDimTolObjects_DimensionFormVariance aFV; |
158 | XCAFDimTolObjects_DimensionGrade aG; |
159 | aDimTolObj->GetClassOfTolerance(isH, aFV, aG); |
160 | di << ", H " << (Standard_Integer)isH<< " F " << aFV << " G " << aG; |
161 | } |
162 | } |
163 | if (aDimTolObj->HasQualifier()) |
164 | di << ", Q " << aDimTolObj->GetQualifier(); |
165 | if (aDimTolObj->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented) |
166 | { |
167 | gp_Dir aD; |
168 | aDimTolObj->GetDirection(aD); |
169 | di << ", D (" << aD.X() << ", " << aD.Y() << ", " << aD.Z() << ")"; |
170 | } |
171 | XCAFDimTolObjects_DimensionModifiersSequence aModif = |
172 | aDimTolObj->GetModifiers(); |
173 | if (!aModif.IsEmpty()) |
174 | { |
175 | di << ","; |
176 | for (Standard_Integer k = aModif.Lower(); k <= aModif.Upper(); k++) |
177 | { |
178 | di << " M " << aModif.Value(k); |
179 | } |
180 | } |
181 | di << ", P " << (Standard_Integer)!aDimTolObj->GetPath().IsNull(); |
182 | di << " )"; |
183 | } |
9ebaae37 |
184 | } |
185 | } |
186 | aGDTs.Clear(); |
187 | aDimTolTool->GetRefGeomToleranceLabels(aLabels.Value(i), aGDTs); |
188 | for ( Standard_Integer j=1; j <= aGDTs.Length(); j++ ) |
189 | { |
190 | Handle(XCAFDoc_GeomTolerance) aDimTol; |
191 | if(aGDTs.Value(j).FindAttribute(XCAFDoc_GeomTolerance::GetID(), aDimTol)) |
192 | { |
193 | Handle(XCAFDimTolObjects_GeomToleranceObject) aDimTolObj = aDimTol->GetObject(); |
194 | if(flag) |
195 | { |
196 | TCollection_AsciiString Entry; |
197 | TDF_Tool::Entry(aLabels.Value(i), Entry); |
586db386 |
198 | di << "\n " << Entry << " Shape."<< i; |
9ebaae37 |
199 | flag = Standard_False; |
200 | } |
201 | TCollection_AsciiString Entry; |
202 | TDF_Tool::Entry(aGDTs.Value(j), Entry); |
203 | di << "\n \t " << Entry; |
204 | flag = Standard_False; |
205 | |
586db386 |
206 | di << " GeomTolerance."<< i << "."<< j; |
1c9d3225 |
207 | if (argc > 3) |
208 | { |
209 | di <<" ("; |
210 | di << " T " << aDimTolObj->GetType(); |
211 | di << " TV " << aDimTolObj->GetTypeOfValue(); |
212 | di << ", V " << aDimTolObj->GetValue(); |
213 | |
214 | if (aDimTolObj->HasAxis()) |
215 | { |
216 | gp_Ax2 anAx = aDimTolObj->GetAxis(); |
217 | di << ", A ( L (" << anAx.Location().X() << anAx.Location().Y() << anAx.Location().Z() |
218 | << "), XD (" << anAx.XDirection().X() << anAx.XDirection().Y() << anAx.XDirection().Z() |
219 | << "), RD (" << anAx.YDirection().X() << anAx.YDirection().Y() << anAx.YDirection().Z() << "))"; |
220 | } |
221 | XCAFDimTolObjects_GeomToleranceModifiersSequence aModif = |
222 | aDimTolObj->GetModifiers(); |
223 | if (!aModif.IsEmpty()) |
224 | { |
225 | di << ","; |
226 | for (Standard_Integer k = aModif.Lower(); k <= aModif.Upper(); k++) |
227 | { |
228 | di << " M " << aModif.Value(k); |
229 | } |
230 | } |
231 | if (aDimTolObj->GetMaterialRequirementModifier() != XCAFDimTolObjects_GeomToleranceMatReqModif_None) |
232 | { |
233 | di << ", MR " << aDimTolObj->GetMaterialRequirementModifier(); |
234 | } |
235 | if (aDimTolObj->GetMaxValueModifier() > 0) |
236 | { |
237 | di << "MaxV " << aDimTolObj->GetMaxValueModifier(); |
238 | } |
239 | if ( aDimTolObj->GetZoneModifier() != XCAFDimTolObjects_GeomToleranceZoneModif_None) |
240 | { |
241 | di << ", ZM " << aDimTolObj->GetZoneModifier(); |
242 | if (aDimTolObj->GetValueOfZoneModifier() > 0) |
243 | { |
244 | di << " ZMV " <<aDimTolObj->GetValueOfZoneModifier(); |
245 | } |
246 | } |
247 | |
248 | di << " )"; |
249 | } |
9ebaae37 |
250 | Handle(XCAFDoc_GraphNode) aNode; |
251 | if(aGDTs.Value(j).FindAttribute(XCAFDoc::DatumTolRefGUID(), aNode) && aNode->NbChildren() > 0) |
252 | { |
51740958 |
253 | for(Standard_Integer k = 1; k<=aNode->NbChildren(); k++) |
9ebaae37 |
254 | { |
255 | Handle(XCAFDoc_Datum) aDatum; |
51740958 |
256 | if(aNode->GetChild(k)->Label().FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
9ebaae37 |
257 | { |
1c9d3225 |
258 | Handle(XCAFDimTolObjects_DatumObject) aDatumObj = aDatum->GetObject(); |
51740958 |
259 | TCollection_AsciiString anEntry; |
260 | TDF_Tool::Entry(aNode->GetChild(k)->Label(), anEntry); |
261 | di << "\n \t \t " << anEntry; |
586db386 |
262 | di << " Datum."<< i << "."<< j << "."<< k; |
1c9d3225 |
263 | if (argc > 3) |
264 | { |
265 | di <<" ("; |
266 | XCAFDimTolObjects_DatumModifiersSequence aModif = |
267 | aDatumObj->GetModifiers(); |
268 | if (!aModif.IsEmpty()) |
269 | { |
270 | di << ","; |
f2139a7f |
271 | for (Standard_Integer iModif = aModif.Lower(); iModif <= aModif.Upper(); iModif++) |
1c9d3225 |
272 | { |
f2139a7f |
273 | di << " M " << aModif.Value(iModif); |
1c9d3225 |
274 | } |
275 | } |
276 | XCAFDimTolObjects_DatumModifWithValue aM; |
277 | Standard_Real aV; |
278 | aDatumObj->GetModifierWithValue(aM, aV); |
279 | if (aM != XCAFDimTolObjects_DatumModifWithValue_None) |
280 | { |
281 | di << ", MV" << aM << " " << aV; |
282 | } |
283 | di << " )"; |
284 | } |
9ebaae37 |
285 | } |
286 | } |
287 | } |
288 | } |
289 | } |
1c9d3225 |
290 | TDF_LabelSequence aDatumL; |
9ebaae37 |
291 | if (aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatumL)) |
292 | { |
1c9d3225 |
293 | for(Standard_Integer j = aDatumL.Lower(); j <= aDatumL.Upper(); j++) |
9ebaae37 |
294 | { |
1c9d3225 |
295 | Handle(XCAFDoc_Datum) aDatum; |
296 | if(aDatumL.Value(j).FindAttribute(XCAFDoc_Datum::GetID(), aDatum) && |
297 | aDatum->GetObject()->IsDatumTarget()) |
9ebaae37 |
298 | { |
1c9d3225 |
299 | Handle(XCAFDimTolObjects_DatumObject) aDatumObj = aDatum->GetObject(); |
300 | if(flag) |
301 | { |
302 | TCollection_AsciiString Entry; |
303 | TDF_Tool::Entry(aLabels.Value(i), Entry); |
586db386 |
304 | di << "\n " << Entry << " Shape."<< i; |
1c9d3225 |
305 | flag = Standard_False; |
306 | } |
9ebaae37 |
307 | TCollection_AsciiString Entry; |
1c9d3225 |
308 | TDF_Tool::Entry(aDatumL.First(), Entry); |
309 | di << "\n \t " << Entry; |
9ebaae37 |
310 | flag = Standard_False; |
1c9d3225 |
311 | |
586db386 |
312 | di << " Datum target."<< i << "."<< j; |
1c9d3225 |
313 | if (argc > 3) |
314 | { |
315 | di <<" ("; |
316 | di << " T " << aDatumObj->GetDatumTargetType(); |
317 | if (aDatumObj->GetDatumTargetType() != XCAFDimTolObjects_DatumTargetType_Area) |
318 | { |
319 | gp_Ax2 anAx = aDatumObj->GetDatumTargetAxis(); |
320 | di << ", A ( L (" << anAx.Location().X() << anAx.Location().Y() << anAx.Location().Z() |
321 | << "), XD (" << anAx.XDirection().X() << anAx.XDirection().Y() << anAx.XDirection().Z() |
322 | << "), RD (" << anAx.YDirection().X() << anAx.YDirection().Y() << anAx.YDirection().Z() << "))"; |
323 | if (aDatumObj->GetDatumTargetType() != XCAFDimTolObjects_DatumTargetType_Point) |
324 | { |
325 | di << ", L " << aDatumObj->GetDatumTargetLength() ; |
326 | if (aDatumObj->GetDatumTargetType() == XCAFDimTolObjects_DatumTargetType_Rectangle) |
327 | { |
328 | di << ", W " << aDatumObj->GetDatumTargetWidth() ; |
329 | } |
330 | } |
331 | } |
332 | di << " )"; |
333 | } |
9ebaae37 |
334 | } |
1c9d3225 |
335 | } |
336 | } |
337 | } |
338 | return 0; |
339 | } |
340 | |
341 | static Standard_Integer DumpNbDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
342 | { |
343 | if (argc < 2) { |
586db386 |
344 | di<<"Use: XDumpNbDGTs Doc"; |
1c9d3225 |
345 | return 1; |
346 | } |
6595eee7 |
347 | |
348 | Standard_Boolean isFull = Standard_False; |
349 | if (argc == 3) { |
350 | char aChar = argv[2][0]; |
351 | if (aChar == 'f') |
352 | isFull = Standard_True; |
353 | } |
1c9d3225 |
354 | Handle(TDocStd_Document) Doc; |
355 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
356 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
1c9d3225 |
357 | Handle(XCAFDoc_DimTolTool) aDimTolTool= XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
358 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
359 | |
360 | TDF_LabelSequence aLabels; |
361 | aShapeTool->GetShapes(aLabels); |
362 | for ( Standard_Integer i=1; i <= aLabels.Length(); i++ ) |
363 | { |
364 | aShapeTool->GetSubShapes(aLabels.Value(i), aLabels); |
365 | } |
9ebaae37 |
366 | |
1c9d3225 |
367 | TDF_LabelSequence aGDTs; |
368 | aDimTolTool->GetDimensionLabels(aGDTs); |
369 | di << "\n NbOfDimensions : " << aGDTs.Length(); |
6595eee7 |
370 | if (isFull) { |
371 | Standard_Integer nbSize = 0, |
372 | nbLocation = 0, |
373 | nbAngular = 0, |
0b622d67 |
374 | nbWithPath = 0, |
375 | nbCommon = 0; |
6595eee7 |
376 | for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) { |
377 | Handle(XCAFDoc_Dimension) aDimAttr; |
378 | if (!aGDTs.Value(i).FindAttribute(XCAFDoc_Dimension::GetID(),aDimAttr)) |
379 | continue; |
380 | Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimAttr->GetObject(); |
381 | if (anObject.IsNull()) |
382 | continue; |
383 | XCAFDimTolObjects_DimensionType aDimType = anObject->GetType(); |
0b622d67 |
384 | if (aDimType == XCAFDimTolObjects_DimensionType_CommonLabel) { |
385 | nbCommon++; |
386 | } |
387 | else if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType)) { |
6595eee7 |
388 | nbLocation++; |
389 | } |
390 | else if (aDimType == XCAFDimTolObjects_DimensionType_Location_Angular) { |
391 | nbAngular++; |
392 | nbLocation++; |
393 | } |
394 | else if (aDimType == XCAFDimTolObjects_DimensionType_Location_WithPath) { |
395 | nbLocation++; |
396 | nbWithPath++; |
397 | } |
727b5ad9 |
398 | else if (STEPCAFControl_GDTProperty::IsDimensionalSize(aDimType)) { |
6595eee7 |
399 | nbSize++; |
400 | } |
401 | else if (aDimType == XCAFDimTolObjects_DimensionType_Size_Angular) { |
402 | nbSize++; |
403 | nbAngular++; |
404 | } |
405 | else if (aDimType == XCAFDimTolObjects_DimensionType_Size_WithPath) { |
406 | nbSize++; |
407 | nbWithPath++; |
408 | } |
409 | } |
410 | di << "\n NbOfDimensionalSize : " << nbSize; |
411 | di << "\n NbOfDimensionalLocation: " << nbLocation; |
412 | di << "\n NbOfAngular : " << nbAngular; |
413 | di << "\n NbOfWithPath : " << nbWithPath; |
0b622d67 |
414 | di << "\n NbOfCommonLabels : " << nbCommon; |
6595eee7 |
415 | } |
1c9d3225 |
416 | |
417 | aGDTs.Clear(); |
418 | aDimTolTool->GetGeomToleranceLabels(aGDTs); |
419 | di << "\n NbOfTolerances : " << aGDTs.Length(); |
6595eee7 |
420 | if (isFull) { |
421 | Standard_Integer nbWithModif = 0, |
422 | nbWithMaxTol = 0, |
423 | nbWithDatumRef = 0; |
424 | for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) { |
425 | Handle(XCAFDoc_GeomTolerance) aGTAttr; |
426 | if (!aGDTs.Value(i).FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGTAttr)) |
427 | continue; |
428 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObject = aGTAttr->GetObject(); |
429 | if (anObject.IsNull()) |
430 | continue; |
431 | if (anObject->GetModifiers().Length() > 0 || |
432 | anObject->GetMaterialRequirementModifier() != XCAFDimTolObjects_GeomToleranceMatReqModif_None) { |
433 | nbWithModif++; |
434 | } |
435 | if (anObject->GetMaxValueModifier() != 0) { |
436 | nbWithMaxTol++; |
437 | } |
438 | TDF_LabelSequence aDatumSeq; |
439 | aDimTolTool->GetDatumWithObjectOfTolerLabels(aGDTs.Value(i), aDatumSeq); |
440 | if (aDatumSeq.Length() > 0) { |
441 | nbWithDatumRef++; |
442 | } |
443 | } |
444 | di << "\n NbOfGTWithModifiers : " << nbWithModif; |
445 | di << "\n NbOfGTWithMaxTolerance : " << nbWithMaxTol; |
446 | di << "\n NbOfGTWithDatums : " << nbWithDatumRef; |
447 | } |
1c9d3225 |
448 | |
449 | Standard_Integer aCounter = 0; |
450 | Standard_Integer aCounter1 = 0; |
451 | Standard_Integer aCounter2 = 0; |
452 | |
453 | for ( Standard_Integer i=1; i <= aLabels.Length(); i++ ) |
454 | { |
455 | Standard_Boolean isDatum = Standard_False; |
456 | TDF_LabelSequence aDatL; |
457 | if(aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatL)) |
458 | { |
459 | for(Standard_Integer j = aDatL.Lower(); j <= aDatL.Upper(); j++) |
460 | { |
461 | Handle(XCAFDoc_Datum) aDat; |
462 | if(aDatL.Value(j).FindAttribute(XCAFDoc_Datum::GetID(), aDat)) |
463 | { |
464 | if(aDat->GetObject()->IsDatumTarget()) |
465 | { |
466 | aCounter1++; |
467 | } |
468 | else |
469 | { |
470 | aCounter2++; |
471 | isDatum = Standard_True; |
472 | } |
473 | } |
9ebaae37 |
474 | } |
1c9d3225 |
475 | if(isDatum) |
476 | aCounter++; |
9ebaae37 |
477 | } |
478 | } |
1c9d3225 |
479 | di << "\n NbOfDatumFeature : " << aCounter; |
480 | di << "\n NbOfAttachedDatum : " << aCounter2; |
481 | di << "\n NbOfDatumTarget : " << aCounter1; |
482 | |
9ebaae37 |
483 | return 0; |
484 | } |
485 | |
486 | static Standard_Integer addDim (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
487 | { |
488 | if (argc < 3) { |
586db386 |
489 | di<<"Use: XAddDimension Doc shape/label [shape/label]\n"; |
9ebaae37 |
490 | return 1; |
491 | } |
492 | Handle(TDocStd_Document) Doc; |
493 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
494 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
495 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
496 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
497 | |
498 | TDF_Label aLabel; |
499 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
500 | if ( aLabel.IsNull() ) |
501 | { |
502 | TopoDS_Shape aShape= DBRep::Get(argv[2]); |
503 | if ( !aShape.IsNull() ) |
504 | { |
505 | aShapeTool->Search(aShape, aLabel); |
506 | if ( aLabel.IsNull() ) |
507 | { |
508 | di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
509 | return 1; |
510 | } |
511 | } |
512 | } |
513 | TDF_Label aLabel1; |
514 | if(argc == 4) |
515 | { |
516 | TDF_Tool::Label(Doc->GetData(), argv[3], aLabel1); |
517 | if ( aLabel1.IsNull() ) |
518 | { |
519 | TopoDS_Shape aShape= DBRep::Get(argv[3]); |
520 | if ( !aShape.IsNull() ) |
521 | { |
522 | aShapeTool->Search(aShape, aLabel1); |
523 | if ( aLabel1.IsNull() ) |
524 | { |
525 | di<<"Shape "<<argv[3]<<" is absent in "<<argv[1]<<"\n"; |
526 | return 1; |
527 | } |
528 | } |
529 | } |
530 | } |
531 | |
532 | TDF_Label aDimL = aDimTolTool->AddDimension(); |
533 | if(aLabel1.IsNull()) |
534 | aDimTolTool->SetDimension(aLabel, aDimL); |
535 | else |
536 | aDimTolTool->SetDimension(aLabel, aLabel1, aDimL); |
537 | TCollection_AsciiString Entry; |
538 | TDF_Tool::Entry(aDimL, Entry); |
539 | di << Entry; |
540 | return 0; |
541 | } |
542 | |
543 | static Standard_Integer addGTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
544 | { |
545 | if (argc < 3) { |
586db386 |
546 | di<<"Use: XAddGeomTolerance Doc shape/label\n"; |
9ebaae37 |
547 | return 1; |
548 | } |
549 | Handle(TDocStd_Document) Doc; |
550 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
551 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
552 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
553 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
554 | |
555 | TDF_Label aLabel; |
556 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
557 | if ( aLabel.IsNull() ) |
558 | { |
559 | TopoDS_Shape aShape= DBRep::Get(argv[2]); |
560 | if ( !aShape.IsNull() ) |
561 | { |
562 | aShapeTool->Search(aShape, aLabel); |
563 | if ( aLabel.IsNull() ) |
564 | { |
565 | di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
566 | return 1; |
567 | } |
568 | } |
569 | } |
570 | |
571 | TDF_Label aTolL = aDimTolTool->AddGeomTolerance(); |
572 | aDimTolTool->SetGeomTolerance(aLabel, aTolL); |
573 | TCollection_AsciiString Entry; |
574 | TDF_Tool::Entry(aTolL, Entry); |
575 | di << Entry; |
576 | return 0; |
577 | } |
578 | |
579 | static Standard_Integer addDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
580 | { |
581 | if (argc < 3) { |
586db386 |
582 | di<<"Use: XAddDatum Doc shape/label\n"; |
9ebaae37 |
583 | return 1; |
584 | } |
585 | Handle(TDocStd_Document) Doc; |
586 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
587 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
588 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
589 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
590 | |
591 | TDF_Label aLabel; |
592 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
593 | if ( aLabel.IsNull() ) |
594 | { |
595 | TopoDS_Shape aShape= DBRep::Get(argv[2]); |
596 | if ( !aShape.IsNull() ) |
597 | { |
598 | aShapeTool->Search(aShape, aLabel); |
599 | if ( aLabel.IsNull() ) |
600 | { |
601 | di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
602 | return 1; |
603 | } |
604 | } |
605 | } |
606 | |
607 | TDF_Label aDatumL = aDimTolTool->AddDatum(); |
608 | aDimTolTool->SetDatum(aLabel, aDatumL); |
609 | TCollection_AsciiString Entry; |
610 | TDF_Tool::Entry(aDatumL, Entry); |
611 | di << Entry; |
612 | return 0; |
613 | } |
614 | |
615 | static Standard_Integer setDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
616 | { |
617 | if (argc < 4) { |
586db386 |
618 | di<<"Use: XSetDatum Doc Datum_Label GeomTol_Label\n"; |
9ebaae37 |
619 | return 1; |
620 | } |
621 | Handle(TDocStd_Document) Doc; |
622 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
623 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
624 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
625 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
626 | |
627 | TDF_Label aLabel; |
628 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
629 | if ( aLabel.IsNull() ) |
630 | { |
631 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
632 | return 1; |
633 | } |
634 | |
635 | TDF_Label aTol; |
636 | TDF_Tool::Label(Doc->GetData(), argv[3], aTol); |
637 | if ( aTol.IsNull() ) |
638 | { |
639 | di<<"GeomTolerance "<<argv[3]<<" is absent in "<<argv[1]<<"\n"; |
640 | return 1; |
641 | } |
642 | |
c1070321 |
643 | // check datum position number |
644 | Handle(XCAFDoc_Datum) aDatumAttr; |
645 | if (!aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatumAttr)) |
646 | { |
647 | di<<"Invalid datum object\n"; |
648 | return 1; |
649 | } |
650 | Handle(XCAFDimTolObjects_DatumObject) aDatumObj = aDatumAttr->GetObject(); |
651 | if (aDatumObj.IsNull()) |
652 | { |
653 | di<<"Invalid datum object\n"; |
654 | return 1; |
655 | } |
656 | |
657 | if (aDatumObj->GetPosition() < 1 || aDatumObj->GetPosition() > 3) |
658 | { |
659 | di<<"Invalid datum position number: use XSetDatumPosition\n"; |
660 | return 1; |
661 | } |
662 | |
9ebaae37 |
663 | aDimTolTool->SetDatumToGeomTol(aLabel, aTol); |
664 | return 0; |
665 | } |
666 | |
c1070321 |
667 | static Standard_Integer setDatumPosition (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
668 | { |
669 | if (argc < 4) { |
670 | di<<"Use: XSetDatumPosition Doc Datum_Label position[1-3]\n"; |
671 | return 1; |
672 | } |
673 | |
674 | if (Draw::Atoi(argv[3]) < 1 || Draw::Atoi(argv[3]) > 3) { |
675 | di<<"Datum position should be 1, 2 or 3\n"; |
676 | return 1; |
677 | } |
678 | |
679 | Handle(TDocStd_Document) Doc; |
680 | DDocStd::GetDocument(argv[1], Doc); |
681 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
682 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
683 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
684 | |
685 | TDF_Label aLabel; |
686 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
687 | if ( aLabel.IsNull() ) |
688 | { |
689 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
690 | return 1; |
691 | } |
692 | Handle(XCAFDoc_Datum) aDatum; |
693 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
694 | { |
695 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
696 | anObj->SetPosition(Draw::Atoi(argv[3])); |
697 | aDatum->SetObject(anObj); |
698 | } |
699 | return 0; |
700 | } |
701 | |
702 | static Standard_Integer getDatumPosition (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
703 | { |
704 | if (argc < 3) { |
705 | di<<"Use: XGetDatumPosition Doc Datum_Label\n"; |
706 | return 1; |
707 | } |
708 | Handle(TDocStd_Document) Doc; |
709 | DDocStd::GetDocument(argv[1], Doc); |
710 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
711 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
712 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
713 | |
714 | TDF_Label aLabel; |
715 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
716 | if ( aLabel.IsNull() ) |
717 | { |
718 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
719 | return 1; |
720 | } |
721 | Handle(XCAFDoc_Datum) aDatum; |
722 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
723 | { |
724 | di << aDatum->GetObject()->GetPosition(); |
725 | } |
726 | return 0; |
727 | } |
728 | |
729 | |
9ebaae37 |
730 | static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
731 | { |
732 | if (argc < 3) { |
586db386 |
733 | di<<"Use: XGetDatum Doc GeomTol_Label/Shape_Label\n"; |
9ebaae37 |
734 | return 1; |
735 | } |
736 | Handle(TDocStd_Document) Doc; |
737 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
738 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
739 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
740 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
741 | |
742 | TDF_Label aLabel; |
743 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
744 | if ( aLabel.IsNull() ) |
745 | { |
746 | di<<"Label "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
747 | return 1; |
748 | } |
749 | |
1c9d3225 |
750 | TDF_LabelSequence aD; |
9ebaae37 |
751 | if(!aDimTolTool->GetRefDatumLabel(aLabel, aD)) |
752 | { |
1c9d3225 |
753 | aDimTolTool->GetDatumOfTolerLabels(aLabel, aD); |
9ebaae37 |
754 | } |
1c9d3225 |
755 | for(Standard_Integer i = aD.Lower(); i <= aD.Upper(); i++) |
9ebaae37 |
756 | { |
1c9d3225 |
757 | if(i>1) di<<", "; |
9ebaae37 |
758 | TCollection_AsciiString Entry; |
1c9d3225 |
759 | TDF_Tool::Entry(aD.Value(i), Entry); |
9ebaae37 |
760 | di<<Entry; |
761 | } |
762 | return 0; |
763 | } |
764 | |
765 | static Standard_Integer addDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
766 | { |
767 | if (argc < 4) { |
586db386 |
768 | di<<"Use: XAddDatumModifier Doc Datum_Label mod1 mod2 ...\n"; |
9ebaae37 |
769 | return 1; |
770 | } |
771 | Handle(TDocStd_Document) Doc; |
772 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
773 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
774 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
775 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
776 | |
777 | TDF_Label aLabel; |
778 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
779 | if ( aLabel.IsNull() ) |
780 | { |
781 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
782 | return 1; |
783 | } |
784 | Handle(XCAFDoc_Datum) aDatum; |
785 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
786 | { |
787 | for(Standard_Integer i = 3; i < argc; i++) |
788 | { |
789 | if(Draw::Atoi(argv[i]) < 22 && Draw::Atoi(argv[i]) > -1) |
790 | { |
791 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
792 | anObj->AddModifier((XCAFDimTolObjects_DatumSingleModif)Draw::Atoi(argv[i])); |
793 | aDatum->SetObject(anObj); |
794 | } |
795 | } |
796 | } |
797 | return 0; |
798 | } |
799 | |
800 | static Standard_Integer getDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
801 | { |
802 | if (argc < 3) { |
586db386 |
803 | di<<"Use: XGetDatumModifiers Doc Datum_Label\n"; |
9ebaae37 |
804 | return 1; |
805 | } |
806 | Handle(TDocStd_Document) Doc; |
807 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
808 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
809 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
810 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
811 | |
812 | TDF_Label aLabel; |
813 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
814 | if ( aLabel.IsNull() ) |
815 | { |
816 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
817 | return 1; |
818 | } |
819 | Handle(XCAFDoc_Datum) aDatum; |
820 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
821 | { |
822 | XCAFDimTolObjects_DatumModifiersSequence aS = aDatum->GetObject()->GetModifiers(); |
823 | for(Standard_Integer i = 1; i<=aS.Length();i++) |
824 | { |
825 | if (i > 1) di<<", "; |
826 | switch(aS.Value(i)){ |
827 | case 0 : di<<"AnyCrossSection"; break; |
828 | case 1 : di<<"AnyLongitudinalSection"; break; |
829 | case 2 : di<<"Basic"; break; |
830 | case 3 : di<<"ContactingFeature\n"; break; |
831 | case 4 : di<<"DegreeOfFreedomConstraintU"; break; |
832 | case 5 : di<<"DegreeOfFreedomConstraintV"; break; |
833 | case 6 : di<<"DegreeOfFreedomConstraintW"; break; |
834 | case 7 : di<<"DegreeOfFreedomConstraintX"; break; |
835 | case 8 : di<<"DegreeOfFreedomConstraintY"; break; |
836 | case 9 : di<<"DegreeOfFreedomConstraintZ"; break; |
837 | case 10 : di<<"DistanceVariable"; break; |
838 | case 11 : di<<"FreeState"; break; |
839 | case 12 : di<<"LeastMaterialRequirement"; break; |
840 | case 13 : di<<"Line"; break; |
841 | case 14 : di<<"MajorDiameter"; break; |
842 | case 15 : di<<"MaximumMaterialRequirement"; break; |
843 | case 16 : di<<"MinorDiameter"; break; |
844 | case 17 : di<<"Orientation"; break; |
845 | case 18 : di<<"PitchDiameter"; break; |
846 | case 19 : di<<"Plane"; break; |
847 | case 20 : di<<"Point"; break; |
848 | case 21 : di<<"Translation"; break; |
849 | default : break; |
850 | } |
851 | } |
852 | } |
853 | return 0; |
854 | } |
855 | |
856 | static Standard_Integer setDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
857 | { |
858 | if (argc < 4) { |
586db386 |
859 | di<<"Use: XSetDatumName Doc Datum_Label name\n"; |
9ebaae37 |
860 | return 1; |
861 | } |
862 | Handle(TDocStd_Document) Doc; |
863 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
864 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
865 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
866 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
867 | |
868 | TDF_Label aLabel; |
869 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
870 | if ( aLabel.IsNull() ) |
871 | { |
872 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
873 | return 1; |
874 | } |
875 | Handle(XCAFDoc_Datum) aDatum; |
876 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
877 | { |
878 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
879 | anObj->SetName(new TCollection_HAsciiString(argv[3])); |
880 | aDatum->SetObject(anObj); |
881 | } |
882 | return 0; |
883 | } |
884 | |
885 | static Standard_Integer getDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
886 | { |
887 | if (argc < 3) { |
586db386 |
888 | di<<"Use: XGetDatumName Doc Datum_Label\n"; |
9ebaae37 |
889 | return 1; |
890 | } |
891 | Handle(TDocStd_Document) Doc; |
892 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
893 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
894 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
895 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
896 | |
897 | TDF_Label aLabel; |
898 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
899 | if ( aLabel.IsNull() ) |
900 | { |
901 | di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
902 | return 1; |
903 | } |
904 | Handle(XCAFDoc_Datum) aDatum; |
905 | if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
906 | { |
907 | di<<aDatum->GetObject()->GetName()->ToCString(); |
908 | } |
909 | return 0; |
910 | } |
911 | |
912 | static Standard_Integer setTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
913 | { |
914 | if (argc < 4) { |
586db386 |
915 | di<<"Use: XSetTypeOfTolerance Doc GTol_Label type\n"; |
9ebaae37 |
916 | return 1; |
917 | } |
918 | Handle(TDocStd_Document) Doc; |
919 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
920 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
921 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
922 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
923 | |
924 | TDF_Label aLabel; |
925 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
926 | if ( aLabel.IsNull() ) |
927 | { |
928 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
929 | return 1; |
930 | } |
931 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
932 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
933 | { |
934 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 16) |
935 | { |
936 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
937 | anObj->SetType((XCAFDimTolObjects_GeomToleranceType)Draw::Atoi(argv[3])); |
938 | aGeomTolerance->SetObject(anObj); |
939 | } |
940 | } |
941 | return 0; |
942 | } |
943 | |
944 | static Standard_Integer getTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
945 | { |
946 | if (argc < 3) { |
586db386 |
947 | di<<"Use: XGetTypeOfTolerance Doc GTol_Label\n"; |
9ebaae37 |
948 | return 1; |
949 | } |
950 | Handle(TDocStd_Document) Doc; |
951 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
952 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
953 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
954 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
955 | |
956 | TDF_Label aLabel; |
957 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
958 | if ( aLabel.IsNull() ) |
959 | { |
960 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
961 | return 1; |
962 | } |
963 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
964 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
965 | { |
966 | switch(aGeomTolerance->GetObject()->GetType()){ |
967 | case 0 : di<<"type is absent"; break; |
968 | case 1 : di<<"Angularity"; break; |
969 | case 2 : di<<"CircularRunout"; break; |
970 | case 3 : di<<"CircularityOrRoundness"; break; |
971 | case 4 : di<<"Coaxiality"; break; |
972 | case 5 : di<<"Concentricity"; break; |
973 | case 6 : di<<"Cylindricity"; break; |
974 | case 7 : di<<"Flatness"; break; |
975 | case 8 : di<<"Parallelism"; break; |
976 | case 9 : di<<"Perpendicularity"; break; |
977 | case 10 : di<<"Position"; break; |
978 | case 11 : di<<"ProfileOfLine"; break; |
979 | case 12 : di<<"ProfileOfSurface"; break; |
980 | case 13 : di<<"Straightness"; break; |
981 | case 14 : di<<"Symmetry"; break; |
982 | case 15 : di<<"TotalRunout"; break; |
983 | default : break; |
984 | } |
985 | } |
986 | return 0; |
987 | } |
988 | |
989 | static Standard_Integer setTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
990 | { |
991 | if (argc < 4) { |
586db386 |
992 | di<<"Use: XSetTypeOfToleranceValue Doc GTol_Label type\n"; |
9ebaae37 |
993 | return 1; |
994 | } |
995 | Handle(TDocStd_Document) Doc; |
996 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
997 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
998 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
999 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1000 | |
1001 | TDF_Label aLabel; |
1002 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1003 | if ( aLabel.IsNull() ) |
1004 | { |
1005 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1006 | return 1; |
1007 | } |
1008 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1009 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1010 | { |
1011 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3) |
1012 | { |
1013 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1014 | anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)Draw::Atoi(argv[3])); |
1015 | aGeomTolerance->SetObject(anObj); |
1016 | } |
1017 | } |
1018 | return 0; |
1019 | } |
1020 | |
1021 | static Standard_Integer getTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1022 | { |
1023 | if (argc < 3) { |
586db386 |
1024 | di<<"Use: XGetTypeOfToleranceValue Doc GTol_Label\n"; |
9ebaae37 |
1025 | return 1; |
1026 | } |
1027 | Handle(TDocStd_Document) Doc; |
1028 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1029 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1030 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1031 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1032 | |
1033 | TDF_Label aLabel; |
1034 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1035 | if ( aLabel.IsNull() ) |
1036 | { |
1037 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1038 | return 1; |
1039 | } |
1040 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1041 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1042 | { |
1043 | switch(aGeomTolerance->GetObject()->GetTypeOfValue()){ |
1044 | case 0 : di<<"type is absent"; break; |
1045 | case 1 : di<<"Diameter"; break; |
1046 | case 2 : di<<"SphericalDiameter"; break; |
1047 | default : break; |
1048 | } |
1049 | } |
1050 | return 0; |
1051 | } |
1052 | |
1053 | static Standard_Integer setTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1054 | { |
1055 | if (argc < 4) { |
586db386 |
1056 | di<<"Use: XSetToleranceValue Doc GTol_Label value\n"; |
9ebaae37 |
1057 | return 1; |
1058 | } |
1059 | Handle(TDocStd_Document) Doc; |
1060 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1061 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1062 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1063 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1064 | |
1065 | TDF_Label aLabel; |
1066 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1067 | if ( aLabel.IsNull() ) |
1068 | { |
1069 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1070 | return 1; |
1071 | } |
1072 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1073 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1074 | { |
1075 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1076 | anObj->SetValue(Draw::Atof(argv[3])); |
1077 | aGeomTolerance->SetObject(anObj); |
1078 | } |
1079 | return 0; |
1080 | } |
1081 | |
1082 | static Standard_Integer getTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1083 | { |
1084 | if (argc < 3) { |
586db386 |
1085 | di<<"Use: XGetToleranceValue Doc GTol_Label\n"; |
9ebaae37 |
1086 | return 1; |
1087 | } |
1088 | Handle(TDocStd_Document) Doc; |
1089 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1090 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1091 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1092 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1093 | |
1094 | TDF_Label aLabel; |
1095 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1096 | if ( aLabel.IsNull() ) |
1097 | { |
1098 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1099 | return 1; |
1100 | } |
1101 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1102 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1103 | { |
1104 | di << aGeomTolerance->GetObject()->GetValue(); |
1105 | } |
1106 | return 0; |
1107 | } |
1108 | |
1109 | static Standard_Integer setMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1110 | { |
1111 | if (argc < 4) { |
586db386 |
1112 | di<<"Use: XSetTolMaterialReq Doc GTol_Label mod\n"; |
9ebaae37 |
1113 | return 1; |
1114 | } |
1115 | Handle(TDocStd_Document) Doc; |
1116 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1117 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1118 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1119 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1120 | |
1121 | TDF_Label aLabel; |
1122 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1123 | if ( aLabel.IsNull() ) |
1124 | { |
1125 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1126 | return 1; |
1127 | } |
1128 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1129 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1130 | { |
1131 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3) |
1132 | { |
1133 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1134 | anObj->SetMaterialRequirementModifier((XCAFDimTolObjects_GeomToleranceMatReqModif)Draw::Atoi(argv[3])); |
1135 | aGeomTolerance->SetObject(anObj); |
1136 | } |
1137 | } |
1138 | return 0; |
1139 | } |
1140 | |
1141 | static Standard_Integer getMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1142 | { |
1143 | if (argc < 3) { |
586db386 |
1144 | di<<"Use: XGetTolMaterialReq Doc GTol_Label\n"; |
9ebaae37 |
1145 | return 1; |
1146 | } |
1147 | Handle(TDocStd_Document) Doc; |
1148 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1149 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1150 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1151 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1152 | |
1153 | TDF_Label aLabel; |
1154 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1155 | if ( aLabel.IsNull() ) |
1156 | { |
1157 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1158 | return 1; |
1159 | } |
1160 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1161 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1162 | { |
1163 | switch(aGeomTolerance->GetObject()->GetMaterialRequirementModifier()){ |
1164 | case 0 : di<<"modifier is absent"; break; |
1165 | case 1 : di<<"M"; break; |
1166 | case 2 : di<<"L"; break; |
1167 | default : break; |
1168 | } |
1169 | } |
1170 | return 0; |
1171 | } |
1172 | |
1173 | static Standard_Integer setZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1174 | { |
1175 | if (argc < 4) { |
586db386 |
1176 | di<<"Use: XSetTolZoneMod Doc GTol_Label mod\n"; |
9ebaae37 |
1177 | return 1; |
1178 | } |
1179 | Handle(TDocStd_Document) Doc; |
1180 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1181 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1182 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1183 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1184 | |
1185 | TDF_Label aLabel; |
1186 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1187 | if ( aLabel.IsNull() ) |
1188 | { |
1189 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1190 | return 1; |
1191 | } |
1192 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1193 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1194 | { |
1195 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3) |
1196 | { |
1197 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1198 | anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)Draw::Atoi(argv[3])); |
1199 | aGeomTolerance->SetObject(anObj); |
1200 | } |
1201 | } |
1202 | return 0; |
1203 | } |
1204 | |
1205 | static Standard_Integer getZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1206 | { |
1207 | if (argc < 3) { |
586db386 |
1208 | di<<"Use: XGetTolZoneMod Doc GTol_Label\n"; |
9ebaae37 |
1209 | return 1; |
1210 | } |
1211 | Handle(TDocStd_Document) Doc; |
1212 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1213 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1214 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1215 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1216 | |
1217 | TDF_Label aLabel; |
1218 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1219 | if ( aLabel.IsNull() ) |
1220 | { |
1221 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1222 | return 1; |
1223 | } |
1224 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1225 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1226 | { |
1227 | switch(aGeomTolerance->GetObject()->GetZoneModifier()){ |
1228 | case 0 : di<<"modifier is absent"; break; |
1229 | case 1 : di<<"P"; break; |
1230 | case 2 : di<<"NonUniform"; break; |
1231 | default : break; |
1232 | } |
1233 | } |
1234 | return 0; |
1235 | } |
1236 | |
1237 | static Standard_Integer setZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1238 | { |
1239 | if (argc < 4) { |
586db386 |
1240 | di<<"Use: XSetTolZoneModValue Doc GTol_Label val\n"; |
9ebaae37 |
1241 | return 1; |
1242 | } |
1243 | Handle(TDocStd_Document) Doc; |
1244 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1245 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1246 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1247 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1248 | |
1249 | TDF_Label aLabel; |
1250 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1251 | if ( aLabel.IsNull() ) |
1252 | { |
1253 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1254 | return 1; |
1255 | } |
1256 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1257 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1258 | { |
1259 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1260 | anObj->SetValueOfZoneModifier(Draw::Atof(argv[3])); |
1261 | aGeomTolerance->SetObject(anObj); |
1262 | } |
1263 | return 0; |
1264 | } |
1265 | |
1266 | static Standard_Integer getZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1267 | { |
1268 | if (argc < 3) { |
586db386 |
1269 | di<<"Use: XGetTolZoneModValue Doc GTol_Label\n"; |
9ebaae37 |
1270 | return 1; |
1271 | } |
1272 | Handle(TDocStd_Document) Doc; |
1273 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1274 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1275 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1276 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1277 | |
1278 | TDF_Label aLabel; |
1279 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1280 | if ( aLabel.IsNull() ) |
1281 | { |
1282 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1283 | return 1; |
1284 | } |
1285 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1286 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1287 | { |
1288 | di << aGeomTolerance->GetObject()->GetValueOfZoneModifier(); |
1289 | } |
1290 | return 0; |
1291 | } |
1292 | |
1293 | static Standard_Integer addTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1294 | { |
1295 | if (argc < 4) { |
586db386 |
1296 | di<<"Use: XAddTolModifier Doc Tol_Label mod1 mod2 ...\n"; |
9ebaae37 |
1297 | return 1; |
1298 | } |
1299 | Handle(TDocStd_Document) Doc; |
1300 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1301 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1302 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1303 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1304 | |
1305 | TDF_Label aLabel; |
1306 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1307 | if ( aLabel.IsNull() ) |
1308 | { |
1309 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1310 | return 1; |
1311 | } |
1312 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1313 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1314 | { |
1315 | for(Standard_Integer i = 3; i < argc; i++) |
1316 | { |
1317 | if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 15) |
1318 | { |
1319 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1320 | anObj->AddModifier((XCAFDimTolObjects_GeomToleranceModif)Draw::Atoi(argv[i])); |
1321 | aGeomTolerance->SetObject(anObj); |
1322 | } |
1323 | } |
1324 | } |
1325 | return 0; |
1326 | } |
1327 | |
1328 | static Standard_Integer getTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1329 | { |
1330 | if (argc < 3) { |
586db386 |
1331 | di<<"Use: XGetTolModifiers Doc Tol_Label\n"; |
9ebaae37 |
1332 | return 1; |
1333 | } |
1334 | Handle(TDocStd_Document) Doc; |
1335 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1336 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1337 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1338 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1339 | |
1340 | TDF_Label aLabel; |
1341 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1342 | if ( aLabel.IsNull() ) |
1343 | { |
1344 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1345 | return 1; |
1346 | } |
1347 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1348 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1349 | { |
1350 | XCAFDimTolObjects_GeomToleranceModifiersSequence aS = aGeomTolerance->GetObject()->GetModifiers(); |
1351 | for(Standard_Integer i = 1; i <= aS.Length(); i++) |
1352 | { |
1353 | if (i > 1) di<<", "; |
1354 | switch(aS.Value(i)){ |
1355 | case 0 : di<<"Any_Cross_Section"; break; |
1356 | case 1 : di<<"Common_Zone"; break; |
1357 | case 2 : di<<"Each_Radial_Element"; break; |
1358 | case 3 : di<<"Free_State"; break; |
1359 | case 4 : di<<"Least_Material_Requirement"; break; |
1360 | case 5 : di<<"Line_Element"; break; |
1361 | case 6 : di<<"Major_Diameter"; break; |
1362 | case 7 : di<<"Maximum_Material_Requirement"; break; |
1363 | case 8 : di<<"Minor_Diameter"; break; |
1364 | case 9 : di<<"Not_Convex"; break; |
1365 | case 10 : di<<"Pitch_Diameter"; break; |
1366 | case 11 : di<<"Reciprocity_Requirement"; break; |
1367 | case 12 : di<<"Separate_Requirement"; break; |
1368 | case 13 : di<<"Statistical_Tolerance"; break; |
1369 | case 14 : di<<"Tangent_Plane"; break; |
1370 | default : break; |
1371 | } |
1372 | } |
1373 | } |
1374 | return 0; |
1375 | } |
1376 | |
1377 | static Standard_Integer setTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1378 | { |
1379 | if (argc < 4) { |
586db386 |
1380 | di<<"Use: XSetTolMaxValue Doc Dim_Label val\n"; |
9ebaae37 |
1381 | return 1; |
1382 | } |
1383 | Handle(TDocStd_Document) Doc; |
1384 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1385 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1386 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1387 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1388 | |
1389 | TDF_Label aLabel; |
1390 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1391 | if ( aLabel.IsNull() ) |
1392 | { |
1393 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1394 | return 1; |
1395 | } |
1396 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1397 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1398 | { |
1399 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
1400 | anObj->SetMaxValueModifier(Draw::Atof(argv[3])); |
1401 | aGeomTolerance->SetObject(anObj); |
1402 | } |
1403 | return 0; |
1404 | } |
1405 | |
1406 | static Standard_Integer getTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1407 | { |
1408 | if (argc < 3) { |
586db386 |
1409 | di<<"Use: XGetTolMaxValue Doc Dim_Label\n"; |
9ebaae37 |
1410 | return 1; |
1411 | } |
1412 | Handle(TDocStd_Document) Doc; |
1413 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1414 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1415 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1416 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1417 | |
1418 | TDF_Label aLabel; |
1419 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1420 | if ( aLabel.IsNull() ) |
1421 | { |
1422 | di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1423 | return 1; |
1424 | } |
1425 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
1426 | if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
1427 | { |
1428 | di << aGeomTolerance->GetObject()->GetMaxValueModifier(); |
1429 | } |
1430 | return 0; |
1431 | } |
1432 | |
1433 | static Standard_Integer setDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1434 | { |
1435 | if (argc < 4) { |
586db386 |
1436 | di<<"Use: XSetDimensionType Doc Dim_Label type\n"; |
9ebaae37 |
1437 | return 1; |
1438 | } |
1439 | Handle(TDocStd_Document) Doc; |
1440 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1441 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1442 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1443 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1444 | |
1445 | TDF_Label aLabel; |
1446 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1447 | if ( aLabel.IsNull() ) |
1448 | { |
1449 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1450 | return 1; |
1451 | } |
1452 | Handle(XCAFDoc_Dimension) aDimension; |
1453 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1454 | { |
1455 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 30) |
1456 | { |
1457 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1458 | anObj->SetType((XCAFDimTolObjects_DimensionType)Draw::Atoi(argv[3])); |
1459 | aDimension->SetObject(anObj); |
1460 | } |
1461 | } |
1462 | return 0; |
1463 | } |
1464 | |
1465 | static Standard_Integer getDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1466 | { |
1467 | if (argc < 3) { |
586db386 |
1468 | di<<"Use: XGetDimensionType Doc Dim_Label\n"; |
9ebaae37 |
1469 | return 1; |
1470 | } |
1471 | Handle(TDocStd_Document) Doc; |
1472 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1473 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1474 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1475 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1476 | |
1477 | TDF_Label aLabel; |
1478 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1479 | if ( aLabel.IsNull() ) |
1480 | { |
1481 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1482 | return 1; |
1483 | } |
1484 | Handle(XCAFDoc_Dimension) aDimension; |
1485 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1486 | { |
1487 | switch(aDimension->GetObject()->GetType()){ |
1488 | case 0 : di<<"type is absent"; break; |
1489 | case 1 : di<<"Location_CurvedDistance"; break; |
1490 | case 2 : di<<"Location_LinearDistance"; break; |
1491 | case 3 : di<<"Location_LinearDistance_FromCenterToOuter"; break; |
1492 | case 4 : di<<"Location_LinearDistance_FromCenterToInner"; break; |
1493 | case 5 : di<<"Location_LinearDistance_FromOuterToCenter"; break; |
1494 | case 6 : di<<"Location_LinearDistance_FromOuterToOuter"; break; |
1495 | case 7 : di<<"Location_LinearDistance_FromOuterToInner"; break; |
1496 | case 8 : di<<"Location_LinearDistance_FromInnerToCenter"; break; |
1497 | case 9 : di<<"Location_LinearDistance_FromInnerToOuter"; break; |
1498 | case 10 : di<<"Location_LinearDistance_FromInnerToInner"; break; |
1499 | case 11 : di<<"Location_Angular"; break; |
1500 | case 12 : di<<"Location_Oriented"; break; |
1501 | case 13 : di<<"Location_WithPath"; break; |
1502 | case 14 : di<<"Size_CurveLength"; break; |
1503 | case 15 : di<<"Size_Diameter"; break; |
1504 | case 16 : di<<"Size_SphericalDiameter"; break; |
1505 | case 17 : di<<"Size_Radius"; break; |
1506 | case 18 : di<<"Size_SphericalRadius"; break; |
1507 | case 19 : di<<"Size_ToroidalMinorDiameter"; break; |
1508 | case 20 : di<<"Size_ToroidalMajorDiameter"; break; |
1509 | case 21 : di<<"Size_ToroidalMinorRadius"; break; |
1510 | case 22 : di<<"Size_ToroidalMajorRadius"; break; |
1511 | case 23 : di<<"Size_ToroidalHighMajorDiameter"; break; |
1512 | case 24 : di<<"Size_ToroidalLowMajorDiameter"; break; |
1513 | case 25 : di<<"Size_ToroidalHighMajorRadius"; break; |
1514 | case 26 : di<<"Size_ToroidalLowMajorRadius"; break; |
1515 | case 27 : di<<"Size_Thickness"; break; |
1516 | case 28 : di<<"Size_Angular"; break; |
1517 | case 29 : di<<"Size_WithPath"; break; |
1518 | default : break; |
1519 | } |
1520 | } |
1521 | return 0; |
1522 | } |
1523 | |
1524 | static Standard_Integer setDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1525 | { |
1526 | if (argc < 4) { |
586db386 |
1527 | di<<"Use: XSetDimensionValue Doc Dim_Label val\n"; |
9ebaae37 |
1528 | return 1; |
1529 | } |
1530 | Handle(TDocStd_Document) Doc; |
1531 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1532 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1533 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1534 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1535 | |
1536 | TDF_Label aLabel; |
1537 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1538 | if ( aLabel.IsNull() ) |
1539 | { |
1540 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1541 | return 1; |
1542 | } |
1543 | Handle(XCAFDoc_Dimension) aDimension; |
1544 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1545 | { |
1546 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1547 | anObj->SetValue(Draw::Atof(argv[3])); |
1548 | aDimension->SetObject(anObj); |
1549 | } |
1550 | return 0; |
1551 | } |
1552 | |
1553 | static Standard_Integer getDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1554 | { |
1555 | if (argc < 3) { |
586db386 |
1556 | di<<"Use: XGetDimensionValue Doc Dim_Label\n"; |
9ebaae37 |
1557 | return 1; |
1558 | } |
1559 | Handle(TDocStd_Document) Doc; |
1560 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1561 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1562 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1563 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1564 | |
1565 | TDF_Label aLabel; |
1566 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1567 | if ( aLabel.IsNull() ) |
1568 | { |
1569 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1570 | return 1; |
1571 | } |
1572 | Handle(XCAFDoc_Dimension) aDimension; |
1573 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1574 | { |
1575 | di << aDimension->GetObject()->GetValue(); |
1576 | } |
1577 | return 0; |
1578 | } |
1579 | |
1580 | static Standard_Integer setDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1581 | { |
1582 | if (argc < 4) { |
586db386 |
1583 | di<<"Use: XSetDimensionQualifier Doc Dim_Label val\n"; |
9ebaae37 |
1584 | return 1; |
1585 | } |
1586 | Handle(TDocStd_Document) Doc; |
1587 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1588 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1589 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1590 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1591 | |
1592 | TDF_Label aLabel; |
1593 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1594 | if ( aLabel.IsNull() ) |
1595 | { |
1596 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1597 | return 1; |
1598 | } |
1599 | Handle(XCAFDoc_Dimension) aDimension; |
1600 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1601 | { |
1602 | if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 4) |
1603 | { |
1604 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1605 | anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)Draw::Atoi(argv[3])); |
1606 | aDimension->SetObject(anObj); |
1607 | } |
1608 | } |
1609 | return 0; |
1610 | } |
1611 | |
1612 | static Standard_Integer getDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1613 | { |
1614 | if (argc < 3) { |
586db386 |
1615 | di<<"Use: XGetDimensionQualifier Doc Dim_Label\n"; |
9ebaae37 |
1616 | return 1; |
1617 | } |
1618 | Handle(TDocStd_Document) Doc; |
1619 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1620 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1621 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1622 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1623 | |
1624 | TDF_Label aLabel; |
1625 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1626 | if ( aLabel.IsNull() ) |
1627 | { |
1628 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1629 | return 1; |
1630 | } |
1631 | Handle(XCAFDoc_Dimension) aDimension; |
1632 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1633 | { |
1634 | |
1635 | switch(aDimension->GetObject()->GetQualifier()){ |
1636 | case 0 : di<<"type is absent"; break; |
1637 | case 1 : di<<"Min"; break; |
1638 | case 2 : di<<"Max"; break; |
1639 | case 3 : di<<"Avg"; break; |
1640 | default : break; |
1641 | } |
1642 | } |
1643 | return 0; |
1644 | } |
1645 | |
1646 | static Standard_Integer setDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1647 | { |
1648 | if (argc < 5) { |
586db386 |
1649 | di<<"Use: XSetDimensionRange Doc Dim_Label low_val up_val\n"; |
9ebaae37 |
1650 | return 1; |
1651 | } |
1652 | Handle(TDocStd_Document) Doc; |
1653 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1654 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1655 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1656 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1657 | |
1658 | TDF_Label aLabel; |
1659 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1660 | if ( aLabel.IsNull() ) |
1661 | { |
1662 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1663 | return 1; |
1664 | } |
1665 | Handle(XCAFDoc_Dimension) aDimension; |
1666 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1667 | { |
1668 | if(Draw::Atof(argv[3]) < Draw::Atof(argv[4])) |
1669 | { |
1670 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1671 | anObj->SetLowerBound(Draw::Atof(argv[3])); |
1672 | anObj->SetUpperBound(Draw::Atof(argv[4])); |
1673 | aDimension->SetObject(anObj); |
1674 | } |
1675 | } |
1676 | return 0; |
1677 | } |
1678 | |
1679 | static Standard_Integer getDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1680 | { |
1681 | if (argc < 3) { |
586db386 |
1682 | di<<"Use: XGetDimensionRange Doc Dim_Label\n"; |
9ebaae37 |
1683 | return 1; |
1684 | } |
1685 | Handle(TDocStd_Document) Doc; |
1686 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1687 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1688 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1689 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1690 | |
1691 | TDF_Label aLabel; |
1692 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1693 | if ( aLabel.IsNull() ) |
1694 | { |
1695 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1696 | return 1; |
1697 | } |
1698 | Handle(XCAFDoc_Dimension) aDimension; |
1699 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1700 | { |
1701 | di << "lower " << aDimension->GetObject()->GetLowerBound(); |
1702 | di << " upper " << aDimension->GetObject()->GetUpperBound(); |
1703 | } |
1704 | return 0; |
1705 | } |
1706 | |
1707 | static Standard_Integer setDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1708 | { |
1709 | if (argc < 5) { |
586db386 |
1710 | di<<"Use: XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val\n"; |
9ebaae37 |
1711 | return 1; |
1712 | } |
1713 | Handle(TDocStd_Document) Doc; |
1714 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1715 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1716 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1717 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1718 | |
1719 | TDF_Label aLabel; |
1720 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1721 | if ( aLabel.IsNull() ) |
1722 | { |
1723 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1724 | return 1; |
1725 | } |
1726 | Handle(XCAFDoc_Dimension) aDimension; |
1727 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1728 | { |
1729 | if(Draw::Atof(argv[3]) < Draw::Atof(argv[4])) |
1730 | { |
1731 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1732 | anObj->SetLowerTolValue(Draw::Atof(argv[3])); |
1733 | anObj->SetUpperTolValue(Draw::Atof(argv[4])); |
1734 | aDimension->SetObject(anObj); |
1735 | } |
1736 | } |
1737 | return 0; |
1738 | } |
1739 | |
1740 | static Standard_Integer getDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1741 | { |
1742 | if (argc < 3) { |
586db386 |
1743 | di<<"Use: XGetDimensionPlusMinusTol Doc Dim_Label\n"; |
9ebaae37 |
1744 | return 1; |
1745 | } |
1746 | Handle(TDocStd_Document) Doc; |
1747 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1748 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1749 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1750 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1751 | |
1752 | TDF_Label aLabel; |
1753 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1754 | if ( aLabel.IsNull() ) |
1755 | { |
1756 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1757 | return 1; |
1758 | } |
1759 | Handle(XCAFDoc_Dimension) aDimension; |
1760 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1761 | { |
1762 | di << "lower " << aDimension->GetObject()->GetLowerTolValue(); |
1763 | di << " upper " << aDimension->GetObject()->GetUpperTolValue(); |
1764 | } |
1765 | return 0; |
1766 | } |
1767 | |
1768 | static Standard_Integer setDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1769 | { |
1770 | if (argc < 6) { |
586db386 |
1771 | di<<"Use: XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade\n"; |
9ebaae37 |
1772 | return 1; |
1773 | } |
1774 | Handle(TDocStd_Document) Doc; |
1775 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1776 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1777 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1778 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1779 | |
1780 | TDF_Label aLabel; |
1781 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1782 | if ( aLabel.IsNull() ) |
1783 | { |
1784 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1785 | return 1; |
1786 | } |
1787 | Handle(XCAFDoc_Dimension) aDimension; |
1788 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1789 | { |
1790 | if(Draw::Atoi(argv[4]) > 0 && Draw::Atoi(argv[4]) < 29 && Draw::Atoi(argv[5]) > -1 && Draw::Atoi(argv[5]) < 20) |
1791 | { |
1792 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1793 | anObj->SetClassOfTolerance((Draw::Atoi(argv[3]) != 0), (XCAFDimTolObjects_DimensionFormVariance)Draw::Atoi(argv[4]), (XCAFDimTolObjects_DimensionGrade)Draw::Atoi(argv[5])); |
1794 | aDimension->SetObject(anObj); |
1795 | } |
1796 | } |
1797 | return 0; |
1798 | } |
1799 | |
1800 | static Standard_Integer getDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1801 | { |
1802 | if (argc < 3) { |
586db386 |
1803 | di<<"Use: XGetDimensionClassOfTol Doc Dim_Label\n"; |
9ebaae37 |
1804 | return 1; |
1805 | } |
1806 | Handle(TDocStd_Document) Doc; |
1807 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1808 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1809 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1810 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1811 | |
1812 | TDF_Label aLabel; |
1813 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1814 | if ( aLabel.IsNull() ) |
1815 | { |
1816 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1817 | return 1; |
1818 | } |
1819 | Handle(XCAFDoc_Dimension) aDimension; |
1820 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1821 | { |
1822 | Standard_Boolean h; |
1823 | XCAFDimTolObjects_DimensionFormVariance f; |
1824 | XCAFDimTolObjects_DimensionGrade g; |
1825 | if(aDimension->GetObject()->GetClassOfTolerance(h ,f, g)) |
1826 | { |
1827 | if(h) |
1828 | { |
1829 | switch(f){ |
1830 | case 1 : di<<"a";break; |
1831 | case 2 : di<<"b";break; |
1832 | case 3 : di<<"c";break; |
1833 | case 4 : di<<"cd";break; |
1834 | case 5 : di<<"d";break; |
1835 | case 6 : di<<"e";break; |
1836 | case 7 : di<<"ef";break; |
1837 | case 8 : di<<"f";break; |
1838 | case 9 : di<<"fg";break; |
1839 | case 10 : di<<"g";break; |
1840 | case 11 : di<<"h";break; |
1841 | case 12 : di<<"js";break; |
1842 | case 13 : di<<"j";break; |
1843 | case 14 : di<<"k";break; |
1844 | case 15 : di<<"m";break; |
1845 | case 16 : di<<"n";break; |
1846 | case 17 : di<<"p";break; |
1847 | case 18 : di<<"r";break; |
1848 | case 19 : di<<"s";break; |
1849 | case 20 : di<<"t";break; |
1850 | case 21 : di<<"u";break; |
1851 | case 22 : di<<"v";break; |
1852 | case 23 : di<<"x";break; |
1853 | case 24 : di<<"y";break; |
1854 | case 25 : di<<"z";break; |
1855 | case 26 : di<<"a";break; |
1856 | case 27 : di<<"zb";break; |
1857 | case 28 : di<<"zc";break; |
1858 | default : break; |
1859 | } |
1860 | } |
1861 | else |
1862 | { |
1863 | switch(f){ |
1864 | case 1 : di<<"A";break; |
1865 | case 2 : di<<"B";break; |
1866 | case 3 : di<<"C";break; |
1867 | case 4 : di<<"CD";break; |
1868 | case 5 : di<<"D";break; |
1869 | case 6 : di<<"E";break; |
1870 | case 7 : di<<"EF";break; |
1871 | case 8 : di<<"F";break; |
1872 | case 9 : di<<"FG";break; |
1873 | case 10 : di<<"G";break; |
1874 | case 11 : di<<"H";break; |
1875 | case 12 : di<<"JS";break; |
1876 | case 13 : di<<"J";break; |
1877 | case 14 : di<<"K";break; |
1878 | case 15 : di<<"M";break; |
1879 | case 16 : di<<"N";break; |
1880 | case 17 : di<<"P";break; |
1881 | case 18 : di<<"R";break; |
1882 | case 19 : di<<"S";break; |
1883 | case 20 : di<<"T";break; |
1884 | case 21 : di<<"U";break; |
1885 | case 22 : di<<"V";break; |
1886 | case 23 : di<<"X";break; |
1887 | case 24 : di<<"Y";break; |
1888 | case 25 : di<<"Z";break; |
1889 | case 26 : di<<"ZA";break; |
1890 | case 27 : di<<"ZB";break; |
1891 | case 28 : di<<"ZC";break; |
1892 | default : break; |
1893 | } |
1894 | } |
1895 | switch(g){ |
1896 | case 0 : di<<"01"; break; |
1897 | case 1 : di<<"0"; break; |
1898 | case 2 : di<<"1"; break; |
1899 | case 3 : di<<"2"; break; |
1900 | case 4 : di<<"3"; break; |
1901 | case 5 : di<<"4"; break; |
1902 | case 6 : di<<"5"; break; |
1903 | case 7 : di<<"6"; break; |
1904 | case 8 : di<<"7"; break; |
1905 | case 9 : di<<"8"; break; |
1906 | case 10 : di<<"9"; break; |
1907 | case 11 : di<<"10"; break; |
1908 | case 12 : di<<"11"; break; |
1909 | case 13 : di<<"12"; break; |
1910 | case 14 : di<<"13"; break; |
1911 | case 15 : di<<"14"; break; |
1912 | case 16 : di<<"15"; break; |
1913 | case 17 : di<<"16"; break; |
1914 | case 18 : di<<"17"; break; |
1915 | case 19 : di<<"18"; break; |
1916 | default : break; |
1917 | } |
1918 | } |
1919 | } |
1920 | return 0; |
1921 | } |
1922 | |
1923 | static Standard_Integer setDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1924 | { |
1925 | if (argc < 5) { |
586db386 |
1926 | di<<"Use: XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val\n"; |
9ebaae37 |
1927 | return 1; |
1928 | } |
1929 | Handle(TDocStd_Document) Doc; |
1930 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1931 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1932 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1933 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1934 | |
1935 | TDF_Label aLabel; |
1936 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1937 | if ( aLabel.IsNull() ) |
1938 | { |
1939 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1940 | return 1; |
1941 | } |
1942 | Handle(XCAFDoc_Dimension) aDimension; |
1943 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1944 | { |
1945 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
1946 | anObj->SetNbOfDecimalPlaces(Draw::Atoi(argv[3]), Draw::Atoi(argv[4])); |
1947 | aDimension->SetObject(anObj); |
1948 | } |
1949 | return 0; |
1950 | } |
1951 | |
1952 | static Standard_Integer getDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1953 | { |
1954 | if (argc < 3) { |
586db386 |
1955 | di<<"Use: XGetDimensionNbOfDecimalPlaces Doc Dim_Label\n"; |
9ebaae37 |
1956 | return 1; |
1957 | } |
1958 | Handle(TDocStd_Document) Doc; |
1959 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1960 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1961 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1962 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1963 | |
1964 | TDF_Label aLabel; |
1965 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1966 | if ( aLabel.IsNull() ) |
1967 | { |
1968 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1969 | return 1; |
1970 | } |
1971 | Handle(XCAFDoc_Dimension) aDimension; |
1972 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
1973 | { |
1974 | Standard_Integer l, r; |
1975 | aDimension->GetObject()->GetNbOfDecimalPlaces(l,r); |
1976 | di << l << "." << r; |
1977 | } |
1978 | return 0; |
1979 | } |
1980 | |
1981 | static Standard_Integer addDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
1982 | { |
1983 | if (argc < 4) { |
586db386 |
1984 | di<<"Use: XAddDimensionModifiers Doc Dim_Label mod1 mod2 ...\n"; |
9ebaae37 |
1985 | return 1; |
1986 | } |
1987 | Handle(TDocStd_Document) Doc; |
1988 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
1989 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
1990 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
1991 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
1992 | |
1993 | TDF_Label aLabel; |
1994 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
1995 | if ( aLabel.IsNull() ) |
1996 | { |
1997 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
1998 | return 1; |
1999 | } |
2000 | Handle(XCAFDoc_Dimension) aDimension; |
2001 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2002 | { |
2003 | for(Standard_Integer i = 3; i < argc; i++) |
2004 | { |
2005 | if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 24) |
2006 | { |
2007 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2008 | anObj->AddModifier((XCAFDimTolObjects_DimensionModif)Draw::Atoi(argv[i])); |
2009 | aDimension->SetObject(anObj); |
2010 | } |
2011 | } |
2012 | } |
2013 | return 0; |
2014 | } |
2015 | |
2016 | static Standard_Integer getDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2017 | { |
2018 | if (argc < 3) { |
586db386 |
2019 | di<<"Use: XGetDimensionModifiers Doc Dim_Label\n"; |
9ebaae37 |
2020 | return 1; |
2021 | } |
2022 | Handle(TDocStd_Document) Doc; |
2023 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2024 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2025 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2026 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2027 | |
2028 | TDF_Label aLabel; |
2029 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2030 | if ( aLabel.IsNull() ) |
2031 | { |
2032 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2033 | return 1; |
2034 | } |
2035 | Handle(XCAFDoc_Dimension) aDimension; |
2036 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2037 | { |
2038 | XCAFDimTolObjects_DimensionModifiersSequence aS = aDimension->GetObject()->GetModifiers(); |
2039 | for(Standard_Integer i = 1; i <= aS.Length(); i++) |
2040 | { |
2041 | if (i > 1) di<<", "; |
2042 | switch(aS.Value(i)){ |
2043 | case 0 : di<<"ControlledRadius"; break; |
2044 | case 1 : di<<"Square"; break; |
2045 | case 2 : di<<"StatisticalTolerance"; break; |
2046 | case 3 : di<<"ContinuousFeature"; break; |
2047 | case 4 : di<<"TwoPointSize"; break; |
2048 | case 5 : di<<"LocalSizeDefinedBySphere"; break; |
2049 | case 6 : di<<"LeastSquaresAssociationCriterion"; break; |
2050 | case 7 : di<<"MaximumInscribedAssociation"; break; |
2051 | case 8 : di<<"MinimumCircumscribedAssociation"; break; |
2052 | case 9 : di<<"CircumferenceDiameter"; break; |
2053 | case 10 : di<<"AreaDiameter"; break; |
2054 | case 11 : di<<"VolumeDiameter"; break; |
2055 | case 12 : di<<"MaximumSize"; break; |
2056 | case 13 : di<<"MinimumSize"; break; |
2057 | case 14 : di<<"AverageSize"; break; |
2058 | case 15 : di<<"MedianSize"; break; |
2059 | case 16 : di<<"MidRangeSize"; break; |
2060 | case 17 : di<<"RangeOfSizes"; break; |
2061 | case 18 : di<<"AnyRestrictedPortionOfFeature"; break; |
2062 | case 19 : di<<"AnyCrossSection"; break; |
2063 | case 20 : di<<"SpecificFixedCrossSection"; break; |
2064 | case 21 : di<<"CommonTolerance"; break; |
2065 | case 22 : di<<"FreeStateCondition"; break; |
2066 | case 23 : di<<"Between"; break; |
2067 | default : break; |
2068 | } |
2069 | } |
2070 | } |
2071 | return 0; |
2072 | } |
2073 | |
2074 | static Standard_Integer addDimPath (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2075 | { |
2076 | if (argc < 4) { |
586db386 |
2077 | di<<"Use: XSetDimensionPath Doc Dim_Label path(edge)\n"; |
9ebaae37 |
2078 | return 1; |
2079 | } |
2080 | Handle(TDocStd_Document) Doc; |
2081 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2082 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2083 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2084 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2085 | |
2086 | TDF_Label aLabel; |
2087 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2088 | if ( aLabel.IsNull() ) |
2089 | { |
2090 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2091 | return 1; |
2092 | } |
2093 | Handle(XCAFDoc_Dimension) aDimension; |
2094 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2095 | { |
2096 | TopoDS_Edge aE = TopoDS::Edge(DBRep::Get(argv[3],TopAbs_EDGE)); |
2097 | if(!aE.IsNull()) |
2098 | { |
2099 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2100 | anObj->SetPath(aE); |
2101 | aDimension->SetObject(anObj); |
2102 | } |
2103 | } |
2104 | return 0; |
2105 | } |
2106 | |
2107 | static Standard_Integer addDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2108 | { |
b7b2f85a |
2109 | if (argc < 4) { |
2110 | di<<"Use: XSetDimensionPoints Doc Dim_Label v1 [v2]\n"; |
9ebaae37 |
2111 | return 1; |
2112 | } |
2113 | Handle(TDocStd_Document) Doc; |
2114 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2115 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2116 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2117 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2118 | |
2119 | TDF_Label aLabel; |
2120 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2121 | if ( aLabel.IsNull() ) |
2122 | { |
2123 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2124 | return 1; |
2125 | } |
2126 | Handle(XCAFDoc_Dimension) aDimension; |
2127 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2128 | { |
b7b2f85a |
2129 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2130 | |
9ebaae37 |
2131 | TopoDS_Vertex aV1 = TopoDS::Vertex(DBRep::Get(argv[3],TopAbs_VERTEX)); |
b7b2f85a |
2132 | if(!aV1.IsNull()) { |
2133 | anObj->SetPoint(BRep_Tool::Pnt(aV1)); |
9ebaae37 |
2134 | } |
b7b2f85a |
2135 | if (argc == 5) { |
2136 | TopoDS_Vertex aV2 = TopoDS::Vertex(DBRep::Get(argv[4],TopAbs_VERTEX)); |
2137 | if(!aV2.IsNull()) { |
2138 | anObj->SetPoint2(BRep_Tool::Pnt(aV2)); |
2139 | } |
2140 | } |
2141 | aDimension->SetObject(anObj); |
9ebaae37 |
2142 | } |
2143 | return 0; |
2144 | } |
2145 | |
2146 | static Standard_Integer getDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2147 | { |
2148 | if (argc < 3) { |
586db386 |
2149 | di<<"Use: XGetDimensionPoints Doc Dim_Label\n"; |
9ebaae37 |
2150 | return 1; |
2151 | } |
2152 | Handle(TDocStd_Document) Doc; |
2153 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2154 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2155 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2156 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2157 | |
2158 | TDF_Label aLabel; |
2159 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2160 | if ( aLabel.IsNull() ) |
2161 | { |
2162 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2163 | return 1; |
2164 | } |
2165 | Handle(XCAFDoc_Dimension) aDimension; |
2166 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2167 | { |
b7b2f85a |
2168 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2169 | if(anObj->HasPoint()) { |
2170 | di << anObj->GetPoint().X() << ";" << anObj->GetPoint().Y() << ";" << anObj->GetPoint().Z() << " "; |
2171 | } |
2172 | if(anObj->HasPoint2()) { |
2173 | di << anObj->GetPoint2().X() << ";" << anObj->GetPoint2().Y() << ";" << anObj->GetPoint2().Z(); |
9ebaae37 |
2174 | } |
2175 | } |
2176 | return 0; |
2177 | } |
2178 | |
2179 | static Standard_Integer addDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2180 | { |
2181 | if (argc < 6) { |
586db386 |
2182 | di<<"Use: XSetDimensionDir Doc Dim_Label x y z\n"; |
9ebaae37 |
2183 | return 1; |
2184 | } |
2185 | Handle(TDocStd_Document) Doc; |
2186 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2187 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2188 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2189 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2190 | |
2191 | TDF_Label aLabel; |
2192 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2193 | if ( aLabel.IsNull() ) |
2194 | { |
2195 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2196 | return 1; |
2197 | } |
2198 | Handle(XCAFDoc_Dimension) aDimension; |
2199 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2200 | { |
2201 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2202 | anObj->SetDirection(gp_Dir(Draw::Atof(argv[3]),Draw::Atof(argv[4]),Draw::Atof(argv[5]))); |
2203 | aDimension->SetObject(anObj); |
2204 | } |
2205 | return 0; |
2206 | } |
2207 | |
2208 | static Standard_Integer getDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2209 | { |
2210 | if (argc < 3) { |
7644c7f4 |
2211 | di<<"Use: XGetDimensionDir Doc Dim_Label\n"; |
9ebaae37 |
2212 | return 1; |
2213 | } |
2214 | Handle(TDocStd_Document) Doc; |
2215 | DDocStd::GetDocument(argv[1], Doc); |
586db386 |
2216 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
9ebaae37 |
2217 | Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main()); |
2218 | Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); |
2219 | |
2220 | TDF_Label aLabel; |
2221 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2222 | if ( aLabel.IsNull() ) |
2223 | { |
2224 | di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n"; |
2225 | return 1; |
2226 | } |
2227 | Handle(XCAFDoc_Dimension) aDimension; |
2228 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2229 | { |
2230 | gp_Dir dir; |
2231 | if(aDimension->GetObject()->GetDirection(dir)) |
2232 | { |
2233 | di << dir.X()<< ";"<< dir.Y()<< ";"<<dir.Z(); |
2234 | } |
2235 | } |
2236 | return 0; |
2237 | } |
2238 | |
7644c7f4 |
2239 | static Standard_Integer addDimDescr (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2240 | { |
2241 | if (argc < 4) { |
2242 | di<<"Use: XAddDimensionDescr Doc Dim_Label Description [DescriptionName]\n"; |
2243 | return 1; |
2244 | } |
2245 | Handle(TDocStd_Document) Doc; |
2246 | DDocStd::GetDocument(argv[1], Doc); |
2247 | if ( Doc.IsNull() ) { |
2248 | di << argv[1] << " is not a document\n"; |
2249 | return 1; |
2250 | } |
2251 | |
2252 | TDF_Label aLabel; |
2253 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2254 | if ( aLabel.IsNull() ) |
2255 | { |
2256 | di << "Dimension "<< argv[2] << " is absent in " << argv[1] << "\n"; |
2257 | return 1; |
2258 | } |
2259 | Handle(XCAFDoc_Dimension) aDimension; |
2260 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2261 | { |
2262 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2263 | Handle(TCollection_HAsciiString) aDescription = new TCollection_HAsciiString(argv[3]); |
2264 | Handle(TCollection_HAsciiString) aDescrName = (argc == 4) ? new TCollection_HAsciiString() |
2265 | : new TCollection_HAsciiString(argv[4]); |
2266 | anObj->AddDescription(aDescription, aDescrName); |
2267 | aDimension->SetObject(anObj); |
2268 | } |
2269 | return 0; |
2270 | } |
2271 | |
2272 | static Standard_Integer getDimDescr (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2273 | { |
2274 | if (argc < 3) { |
2275 | di << "Use: XGetDimensionDescr Doc Dim_Label\n"; |
2276 | return 1; |
2277 | } |
2278 | Handle(TDocStd_Document) Doc; |
2279 | DDocStd::GetDocument(argv[1], Doc); |
2280 | if ( Doc.IsNull() ) { |
2281 | di << argv[1] << " is not a document\n"; |
2282 | return 1; |
2283 | } |
2284 | |
2285 | TDF_Label aLabel; |
2286 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2287 | if ( aLabel.IsNull() ) |
2288 | { |
2289 | di << "Dimension "<< argv[2] << " is absent in " << argv[1] << "\n"; |
2290 | return 1; |
2291 | } |
2292 | Handle(XCAFDoc_Dimension) aDimension; |
2293 | if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2294 | { |
2295 | Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimension->GetObject(); |
2296 | for (Standard_Integer i = 0; i < anObject->NbDescriptions(); i++) { |
2297 | Handle(TCollection_HAsciiString) aDescription = anObject->GetDescription(i); |
2298 | Handle(TCollection_HAsciiString) aDescrName = anObject->GetDescriptionName(i); |
2299 | di << "name: " << aDescrName->ToCString() << " description: " << aDescription->ToCString() << "\n"; |
2300 | } |
2301 | } |
2302 | return 0; |
2303 | } |
2304 | |
f0bf70e8 |
2305 | static Standard_Integer addGDTPosition (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2306 | { |
2307 | if (argc < 12) { |
2308 | di << "Use: XSetGDTPosition Doc GDT_Label loc_x loc_y loc_z normal_x normal_y normal_z xdir_x xdir_y xdir_z\n"; |
2309 | return 1; |
2310 | } |
2311 | Handle(TDocStd_Document) Doc; |
2312 | DDocStd::GetDocument(argv[1], Doc); |
2313 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
2314 | |
2315 | TDF_Label aLabel; |
2316 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2317 | if ( aLabel.IsNull() ) |
2318 | { |
2319 | di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n"; |
2320 | return 1; |
2321 | } |
2322 | |
2323 | gp_Pnt aPoint(Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5])); |
2324 | gp_Dir aNormal(Draw::Atof(argv[6]), Draw::Atof(argv[7]), Draw::Atof(argv[8])); |
2325 | gp_Dir aDir(Draw::Atof(argv[9]), Draw::Atof(argv[10]), Draw::Atof(argv[11])); |
2326 | gp_Ax2 aPlane(aPoint, aNormal, aDir); |
2327 | // Dimension |
2328 | Handle(XCAFDoc_Dimension) aDimension; |
2329 | if (aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2330 | { |
2331 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2332 | anObj->SetPlane(aPlane); |
2333 | anObj->SetPointTextAttach(aPoint); |
2334 | aDimension->SetObject(anObj); |
2335 | } |
2336 | // Geometric Tolerance |
2337 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
2338 | if (aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
2339 | { |
2340 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
2341 | anObj->SetPlane(aPlane); |
2342 | anObj->SetPointTextAttach(aPoint); |
2343 | aGeomTolerance->SetObject(anObj); |
2344 | } |
2345 | // Datum |
2346 | Handle(XCAFDoc_Datum) aDatum; |
2347 | if (aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
2348 | { |
2349 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
2350 | anObj->SetPlane(aPlane); |
2351 | anObj->SetPointTextAttach(aPoint); |
2352 | aDatum->SetObject(anObj); |
2353 | } |
2354 | return 0; |
2355 | } |
2356 | |
2357 | static Standard_Integer getGDTPosition (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2358 | { |
2359 | if (argc < 3) { |
2360 | di << "Use: XGetGDTPosition Doc GDT_Label\n"; |
2361 | return 1; |
2362 | } |
2363 | Handle(TDocStd_Document) Doc; |
2364 | DDocStd::GetDocument(argv[1], Doc); |
2365 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
2366 | |
2367 | TDF_Label aLabel; |
2368 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2369 | if ( aLabel.IsNull() ) |
2370 | { |
2371 | di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n"; |
2372 | return 1; |
2373 | } |
2374 | gp_Pnt aPoint; |
2375 | gp_Dir aNormal, aDir; |
2376 | // Dimension |
2377 | Handle(XCAFDoc_Dimension) aDimension; |
2378 | if (aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2379 | { |
2380 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2381 | aPoint = anObj->GetPointTextAttach(); |
2382 | aNormal = anObj->GetPlane().Direction(); |
2383 | aDir = anObj->GetPlane().XDirection(); |
2384 | } |
2385 | // Geometric Tolerance |
2386 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
2387 | if (aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
2388 | { |
2389 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
2390 | aPoint = anObj->GetPointTextAttach(); |
2391 | aNormal = anObj->GetPlane().Direction(); |
2392 | aDir = anObj->GetPlane().XDirection(); |
2393 | } |
2394 | // Datum |
2395 | Handle(XCAFDoc_Datum) aDatum; |
2396 | if (aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
2397 | { |
2398 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
2399 | aPoint = anObj->GetPointTextAttach(); |
2400 | aNormal = anObj->GetPlane().Direction(); |
2401 | aDir = anObj->GetPlane().XDirection(); |
2402 | } |
2403 | |
2404 | di << "position: " << aPoint.X() << " " << aPoint.Y() << " " << aPoint.Z() << "\n"; |
2405 | di << "normal: " << aNormal.X() << " " << aNormal.Y() << " " << aNormal.Z() << "\n"; |
2406 | di << "x_direction: " << aDir.X() << " " << aDir.Y() << " " << aDir.Z() << "\n"; |
2407 | return 0; |
2408 | } |
2409 | |
2410 | static Standard_Integer addGDTPresentation (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2411 | { |
2412 | if (argc < 5) { |
2413 | di << "Use: XSetGDTPresentation Doc GDT_Label Shape Name\n"; |
2414 | return 1; |
2415 | } |
2416 | Handle(TDocStd_Document) Doc; |
2417 | DDocStd::GetDocument(argv[1], Doc); |
2418 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
2419 | |
2420 | TDF_Label aLabel; |
2421 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2422 | if ( aLabel.IsNull() ) |
2423 | { |
2424 | di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n"; |
2425 | return 1; |
2426 | } |
2427 | |
2428 | TopoDS_Shape aPresentation= DBRep::Get(argv[3]); |
2429 | Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(argv[4]); |
2430 | // Dimension |
2431 | Handle(XCAFDoc_Dimension) aDimension; |
2432 | if (aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2433 | { |
2434 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2435 | anObj->SetPresentation(aPresentation, aName); |
2436 | aDimension->SetObject(anObj); |
2437 | } |
2438 | // Geometric Tolerance |
2439 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
2440 | if (aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
2441 | { |
2442 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
2443 | anObj->SetPresentation(aPresentation, aName); |
2444 | aGeomTolerance->SetObject(anObj); |
2445 | } |
2446 | // Datum |
2447 | Handle(XCAFDoc_Datum) aDatum; |
2448 | if (aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
2449 | { |
2450 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
2451 | anObj->SetPresentation(aPresentation, aName); |
2452 | aDatum->SetObject(anObj); |
2453 | } |
2454 | return 0; |
2455 | } |
2456 | |
2457 | static Standard_Integer getGDTPresentation (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
2458 | { |
2459 | if (argc < 3) { |
2460 | di << "Use: XGetGDTPresentation Doc GDT_Label Shape\n"; |
2461 | return 1; |
2462 | } |
2463 | Handle(TDocStd_Document) Doc; |
2464 | DDocStd::GetDocument(argv[1], Doc); |
2465 | if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; } |
2466 | |
2467 | TDF_Label aLabel; |
2468 | TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); |
2469 | if ( aLabel.IsNull() ) |
2470 | { |
2471 | di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n"; |
2472 | return 1; |
2473 | } |
2474 | TopoDS_Shape aPresentation; |
2475 | // Dimension |
2476 | Handle(XCAFDoc_Dimension) aDimension; |
2477 | if (aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension)) |
2478 | { |
2479 | Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject(); |
2480 | aPresentation = anObj->GetPresentation(); |
2481 | } |
2482 | // Geometric Tolerance |
2483 | Handle(XCAFDoc_GeomTolerance) aGeomTolerance; |
2484 | if (aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance)) |
2485 | { |
2486 | Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject(); |
2487 | aPresentation = anObj->GetPresentation(); |
2488 | } |
2489 | // Datum |
2490 | Handle(XCAFDoc_Datum) aDatum; |
2491 | if (aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) |
2492 | { |
2493 | Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject(); |
2494 | aPresentation = anObj->GetPresentation(); |
2495 | } |
2496 | |
2497 | DBRep::Set (argv[3], aPresentation); |
2498 | return 0; |
2499 | } |
2500 | |
9ebaae37 |
2501 | //======================================================================= |
2502 | //function : InitCommands |
2503 | //purpose : |
2504 | //======================================================================= |
2505 | |
2506 | void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di) |
2507 | { |
2508 | |
2509 | static Standard_Boolean initactor = Standard_False; |
2510 | if (initactor) return; initactor = Standard_True; |
2511 | |
2512 | |
2513 | Standard_CString g = "XDE G&DTs commands"; |
2514 | |
2515 | di.Add ("XDumpDGTs","XDumpDGTs Doc shape/label/all ", |
2516 | __FILE__, DumpDGTs, g); |
2517 | |
6595eee7 |
2518 | di.Add ("XDumpNbDGTs","XDumpNbDGTs Doc [f (full dumping)]", |
1c9d3225 |
2519 | __FILE__, DumpNbDGTs, g); |
2520 | |
9ebaae37 |
2521 | di.Add ("XAddDimension","XAddDimension Doc shape/label [shape/label]", |
2522 | __FILE__, addDim, g); |
2523 | |
2524 | di.Add ("XAddGeomTolerance","XAddGeomTolerance Doc shape/label", |
2525 | __FILE__, addGTol, g); |
2526 | |
2527 | di.Add ("XAddDatum","XAddDatum Doc shape/label", |
2528 | __FILE__, addDatum, g); |
2529 | |
2530 | di.Add ("XSetDatum","XSetDatum Doc Datum_Label GeomTol_Label", |
2531 | __FILE__, setDatum, g); |
2532 | |
2533 | di.Add ("XGetDatum","XGetDatum Doc GeomTol_Label/Shape_Label", |
2534 | __FILE__, getDatum, g); |
2535 | |
2536 | di.Add ("XAddDatumModifier","XAddDatumModifier Doc Datum_Label mod1 mod2 ...\n" |
2537 | "Values:" |
2538 | "\n 0 AnyCrossSection" |
2539 | "\n 1 Any_LongitudinalSection" |
2540 | "\n 2 Basic" |
2541 | "\n 3 ContactingFeature" |
2542 | "\n 4 DegreeOfFreedomConstraintU" |
2543 | "\n 5 DegreeOfFreedomConstraintV" |
2544 | "\n 6 DegreeOfFreedomConstraintW" |
2545 | "\n 7 DegreeOfFreedomConstraintX" |
2546 | "\n 8 DegreeOfFreedomConstraintY" |
2547 | "\n 9 DegreeOfFreedomConstraintZ" |
2548 | "\n 10 DistanceVariable" |
2549 | "\n 11 FreeState" |
2550 | "\n 12 LeastMaterialRequirement" |
2551 | "\n 13 Line" |
2552 | "\n 14 MajorDiameter" |
2553 | "\n 15 MaximumMaterialRequirement" |
2554 | "\n 16 MinorDiameter" |
2555 | "\n 17 Orientation" |
2556 | "\n 18 PitchDiameter" |
2557 | "\n 19 Plane" |
2558 | "\n 20 Point" |
2559 | "\n 21 Translation", |
2560 | __FILE__, addDatumModif, g); |
2561 | |
2562 | di.Add ("XGetDatumModifiers","XGetDatumModifiers Doc Datum_Label", |
2563 | __FILE__, getDatumModif, g); |
2564 | |
2565 | di.Add ("XSetDatumName","XSetDatumName Doc Datum_Label name", |
2566 | __FILE__, setDatumName, g); |
2567 | |
2568 | di.Add ("XGetDatumName","XGetDatumName Doc Datum_Label", |
2569 | __FILE__, getDatumName, g); |
2570 | |
c1070321 |
2571 | di.Add ("XSetDatumPosition","XSetDatumPosition Doc Datum_Label position[1-3]" |
2572 | "Set datum position number in geometric tolerance datum system", |
2573 | __FILE__, setDatumPosition, g); |
2574 | |
2575 | di.Add ("XGetDatumPosition","XGetDatumPosition Doc Datum_Label", |
2576 | __FILE__, getDatumPosition, g); |
2577 | |
9ebaae37 |
2578 | di.Add ("XSetTypeOfTolerance","XSetTypeOfTolerance Doc GTol_Label type" |
2579 | "Values:\n" |
2580 | "\t 0 type is absent\n" |
2581 | "\t 1 Angularity\n" |
2582 | "\t 2 CircularRunout\n" |
2583 | "\t 3 CircularityOrRoundness\n" |
2584 | "\t 4 Coaxiality\n" |
2585 | "\t 5 Concentricity\n" |
2586 | "\t 6 Cylindricity\n" |
2587 | "\t 7 Flatness\n" |
2588 | "\t 8 Parallelism\n" |
2589 | "\t 9 Perpendicularity\n" |
2590 | "\t 10 Position\n" |
2591 | "\t 11 ProfileOfLine\n" |
2592 | "\t 12 ProfileOfSurface\n" |
2593 | "\t 13 Straightness\n" |
2594 | "\t 14 Symmetry\n" |
2595 | "\t 15 TotalRunout\n", |
2596 | __FILE__, setTypeOfTol, g); |
2597 | |
2598 | di.Add ("XGetTypeOfTolerance","XGetTypeOfTolerance Doc GTol_Label", |
2599 | __FILE__, getTypeOfTol, g); |
2600 | |
2601 | di.Add ("XSetTypeOfToleranceValue","XSetTypeOfToleranceValue Doc GTol_Label type" |
2602 | "Values:" |
2603 | "\n 0 none" |
2604 | "\n 1 Diameter" |
2605 | "\n 2 SphericalDiameter", |
2606 | __FILE__, setTypeOfTolVal, g); |
2607 | |
2608 | di.Add ("XGetTypeOfToleranceValue","XGetTypeOfToleranceValue Doc GTol_Label", |
2609 | __FILE__, getTypeOfTolVal, g); |
2610 | |
2611 | di.Add ("XSetToleranceValue","XSetToleranceValue Doc GTol_Label value", |
2612 | __FILE__, setTolVal, g); |
2613 | |
2614 | di.Add ("XGetToleranceValue","XGetToleranceValue Doc GTol_Label", |
2615 | __FILE__, getTolVal, g); |
2616 | |
2617 | di.Add ("XSetTolMaterialReq","XSetTolMaterialReq Doc GTol_Label mod" |
2618 | "Values:" |
2619 | "\n 0 none" |
2620 | "\n 1 M" |
2621 | "\n 2 L", |
2622 | __FILE__, setMatReq, g); |
2623 | |
2624 | di.Add ("XGetTolMaterialReq","XGetTolMaterialReq Doc GTol_Label", |
2625 | __FILE__, getMatReq, g); |
2626 | |
2627 | di.Add ("XSetTolZoneMod","XSetTolZoneMod Doc GTol_Label mod" |
2628 | "Values:" |
2629 | "\n 0 none" |
2630 | "\n 1 P" |
2631 | "\n 2 NonUniform", |
2632 | __FILE__, setZoneMod, g); |
2633 | |
2634 | di.Add ("XGetTolZoneMod","XGetTolZoneMod Doc GTol_Label", |
2635 | __FILE__, getZoneMod, g); |
2636 | |
2637 | di.Add ("XSetTolZoneModValue","XSetTolZoneModValue Doc GTol_Label val", |
2638 | __FILE__, setZoneModVal, g); |
2639 | |
2640 | di.Add ("XGetTolZoneModValue","XGetTolZoneModValue Doc GTol_Label", |
2641 | __FILE__, getZoneModVal, g); |
2642 | |
2643 | di.Add ("XAddTolModifier","XAddTolModifier Doc Tol_Label mod1 mod2 ..." |
2644 | "Values:\n" |
2645 | "\t 0 Any_Cross_Section\n" |
2646 | "\t 1 Common_Zone\n" |
2647 | "\t 2 Each_Radial_Element\n" |
2648 | "\t 3 Free_State\n" |
2649 | "\t 4 Least_Material_Requirement\n" |
2650 | "\t 5 Line_Element\n" |
2651 | "\t 6 Major_Diameter\n" |
2652 | "\t 7 Maximum_Material_Requirement\n" |
2653 | "\t 8 Minor_Diameter\n" |
2654 | "\t 9 Not_Convex\n" |
2655 | "\t 10 Pitch_Diameter\n" |
2656 | "\t 11 Reciprocity_Requirement\n" |
2657 | "\t 12 Separate_Requirement\n" |
2658 | "\t 13 Statistical_Tolerance\n" |
2659 | "\t 14 Tangent_Plane\n", |
2660 | __FILE__, addTolModif, g); |
2661 | |
2662 | di.Add ("XGetTolModifier","XGetTolModifier Doc Tol_Label", |
2663 | __FILE__, getTolModif, g); |
2664 | |
2665 | di.Add ("XSetTolMaxValue","XSetTolMaxValue Doc Dim_Label val", |
2666 | __FILE__, setTolMaxVal, g); |
2667 | |
2668 | di.Add ("XGetTolMaxValue","XGetTolMaxValue Doc Dim_Label val", |
2669 | __FILE__, getTolMaxVal, g); |
2670 | |
2671 | di.Add ("XSetDimensionType","XSetDimensionType Doc Dim_Label type" |
2672 | "Values:" |
2673 | "\t 0 type is absent\n" |
2674 | "\t 1 Location_CurvedDistance\n" |
2675 | "\t 2 Location_LinearDistance\n" |
2676 | "\t 3 Location_LinearDistance_FromCenterToOuter\n" |
2677 | "\t 4 Location_LinearDistance_FromCenterToInner\n" |
2678 | "\t 5 Location_LinearDistance_FromOuterToCenter\n" |
2679 | "\t 6 Location_LinearDistance_FromOuterToOuter\n" |
2680 | "\t 7 Location_LinearDistance_FromOuterToInner\n" |
2681 | "\t 8 Location_LinearDistance_FromInnerToCenter\n" |
2682 | "\t 9 Location_LinearDistance_FromInnerToOuter\n" |
2683 | "\t 10 Location_LinearDistance_FromInnerToInner\n" |
2684 | "\t 11 Location_Angular\n" |
2685 | "\t 12 Location_Oriented\n" |
2686 | "\t 13 Location_WithPath\n" |
2687 | "\t 14 Size_CurveLength\n" |
2688 | "\t 15 Size_Diameter\n" |
2689 | "\t 16 Size_SphericalDiameter\n" |
2690 | "\t 17 Size_Radius\n" |
2691 | "\t 18 Size_SphericalRadius\n" |
2692 | "\t 19 Size_ToroidalMinorDiameter\n" |
2693 | "\t 20 Size_ToroidalMajorDiameter\n" |
2694 | "\t 21 Size_ToroidalMinorRadius\n" |
2695 | "\t 22 Size_ToroidalMajorRadius\n" |
2696 | "\t 23 Size_ToroidalHighMajorDiameter\n" |
2697 | "\t 24 Size_ToroidalLowMajorDiameter\n" |
2698 | "\t 25 Size_ToroidalHighMajorRadius\n" |
2699 | "\t 26 Size_ToroidalLowMajorRadius\n" |
2700 | "\t 27 Size_Thickness\n" |
2701 | "\t 28 Size_Angular\n" |
2702 | "\t 29 Size_WithPath\n", |
2703 | __FILE__, setDimType, g); |
2704 | |
2705 | di.Add ("XGetDimensionType","XGetDimensionType Doc Dim_Label", |
2706 | __FILE__, getDimType, g); |
2707 | |
2708 | di.Add ("XSetDimensionValue","XSetDimensionValue Doc Dim_Label val", |
2709 | __FILE__, setDimVal, g); |
2710 | |
2711 | di.Add ("XGetDimensionValue","XGetDimensionValue Doc Dim_Label", |
2712 | __FILE__, getDimVal, g); |
2713 | |
2714 | di.Add ("XSetDimensionQualifier","XSetDimensionQualifier Doc Dim_Label val" |
2715 | "Values:" |
2716 | "\n 0 none" |
2717 | "\n 1 Min" |
2718 | "\n 2 Max" |
2719 | "\n 3 Avg", |
2720 | __FILE__, setDimQalif, g); |
2721 | |
2722 | di.Add ("XGetDimensionQualifier","XGetDimensionQualifier Doc Dim_Label", |
2723 | __FILE__, getDimQalif, g); |
2724 | |
2725 | di.Add ("XSetDimensionRange","XSetDimensionRange Doc Dim_Label low_val up_val", |
2726 | __FILE__, setDimRange, g); |
2727 | |
2728 | di.Add ("XGetDimensionRange","XGetDimensionRange Doc Dim_Label", |
2729 | __FILE__, getDimRange, g); |
2730 | |
2731 | di.Add ("XSetDimensionPlusMinusTol","XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val", |
2732 | __FILE__, setDimPlusMinusTol, g); |
2733 | |
2734 | di.Add ("XGetDimensionPlusMinusTol","XGetDimensionPlusMinusTol Doc Dim_Label", |
2735 | __FILE__, getDimPlusMinusTol, g); |
2736 | |
2737 | di.Add ("XSetDimensionClassOfTol","XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade" |
2738 | "Values of formVar:" |
2739 | "\t 1 a\n" |
2740 | "\t 2 b\n" |
2741 | "\t 3 c\n" |
2742 | "\t 4 cd\n" |
2743 | "\t 5 d\n" |
2744 | "\t 6 e\n" |
2745 | "\t 7 ef\n" |
2746 | "\t 8 f\n" |
2747 | "\t 9 fg\n" |
2748 | "\t10 g\n" |
2749 | "\t11 h\n" |
2750 | "\t12 js\n" |
2751 | "\t13 j\n" |
2752 | "\t14 k\n" |
2753 | "\t15 m\n" |
2754 | "\t16 n\n" |
2755 | "\t17 p\n" |
2756 | "\t18 r\n" |
2757 | "\t19 s\n" |
2758 | "\t20 t\n" |
2759 | "\t21 u\n" |
2760 | "\t22 v\n" |
2761 | "\t23 x\n" |
2762 | "\t24 y\n" |
2763 | "\t25 z\n" |
2764 | "\t26 za\n" |
2765 | "\t27 zb\n" |
2766 | "\t28 zc\n\n" |
2767 | "Values of grade:" |
2768 | "\t 0 01\n" |
2769 | "\t 1 0\n" |
2770 | "\t 2 1\n" |
2771 | "\t 3 2d\n" |
2772 | "\t 4 3\n" |
2773 | "\t 5 4\n" |
2774 | "\t 6 5f\n" |
2775 | "\t 7 76\n" |
2776 | "\t 8 7g\n" |
2777 | "\t 9 8\n" |
2778 | "\t10 9\n" |
2779 | "\t11 10js\n" |
2780 | "\t12 11j\n" |
2781 | "\t13 12k\n" |
2782 | "\t14 13m\n" |
2783 | "\t15 14n\n" |
2784 | "\t16 15p\n" |
2785 | "\t17 16r\n" |
2786 | "\t18 17s\n" |
2787 | "\t19 18t\n", |
2788 | __FILE__, setDimClassTol, g); |
2789 | |
2790 | di.Add ("XGetDimensionClassOfTol","XGetDimensionClassOfTol Doc Dim_Label", |
2791 | __FILE__, getDimClassTol, g); |
2792 | |
2793 | di.Add ("XSetDimensionNbOfDecimalPlaces","XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val", |
2794 | __FILE__, setDimNbOfDecimalPlaces, g); |
2795 | |
2796 | di.Add ("XGetDimensionNbOfDecimalPlaces","XGetDimensionNbOfDecimalPlaces Doc Dim_Label", |
2797 | __FILE__, getDimNbOfDecimalPlaces, g); |
2798 | |
2799 | di.Add ("XAddDimensionModifiers","XAddDimensionModifiers Doc Dim_Label mod1 mod2 ..." |
2800 | "Values:" |
2801 | "\t 0 ControlledRadius\n" |
2802 | "\t 1 Square\n" |
2803 | "\t 2 StatisticalTolerance\n" |
2804 | "\t 3 ContinuousFeature\n" |
2805 | "\t 4 TwoPointSize\n" |
2806 | "\t 5 LocalSizeDefinedBySphere\n" |
2807 | "\t 6 LeastSquaresAssociationCriterion\n" |
2808 | "\t 7 MaximumInscribedAssociation\n" |
2809 | "\t 8 MinimumCircumscribedAssociation\n" |
2810 | "\t 9 CircumferenceDiameter\n" |
2811 | "\t10 AreaDiameter\n" |
2812 | "\t11 VolumeDiameter\n" |
2813 | "\t12 MaximumSize\n" |
2814 | "\t13 MinimumSize\n" |
2815 | "\t14 AverageSize\n" |
2816 | "\t15 MedianSize\n" |
2817 | "\t16 MidRangeSize\n" |
2818 | "\t17 RangeOfSizes\n" |
2819 | "\t18 AnyRestrictedPortionOfFeature\n" |
2820 | "\t19 AnyCrossSection\n" |
2821 | "\t20 SpecificFixedCrossSection\n" |
2822 | "\t21 CommonTolerance\n" |
2823 | "\t22 FreeStateCondition\n" |
2824 | "\t23 Between\n", |
2825 | __FILE__, addDimModifier, g); |
2826 | |
2827 | di.Add ("XGetDimensionModifiers","XGetDimensionModifiers Doc Dim_Label", |
2828 | __FILE__, getDimModifier, g); |
2829 | |
2830 | di.Add ("XSetDimensionPath","XSetDimensionPath Doc Dim_Label path(edge)", |
2831 | __FILE__, addDimPath, g); |
2832 | |
b7b2f85a |
2833 | di.Add ("XSetDimensionPoints","XSetDimensionPoints Doc Dim_Label v1 [v2]", |
9ebaae37 |
2834 | __FILE__, addDimPoints, g); |
2835 | |
2836 | di.Add ("XGetDimensionPoints","XGetDimensionPoints Doc Dim_Label", |
2837 | __FILE__, getDimPoints, g); |
2838 | |
2839 | di.Add ("XSetDimensionDir","XSetDimensionDir Doc Dim_Label x y z", |
2840 | __FILE__, addDimDir, g); |
2841 | |
2842 | di.Add ("XGetDimensionDir","XGetDimensionDir Doc Dim_Label", |
2843 | __FILE__, getDimDir, g); |
7644c7f4 |
2844 | |
2845 | di.Add ("XAddDimensionDescr","XAddDimensionDescr Doc Dim_Label Description [DescriptionName]\n" |
2846 | "Add named text description to given Dimension, if DescriptionName is missed" |
2847 | "name will be an empty string.", |
2848 | __FILE__, addDimDescr, g); |
2849 | |
2850 | di.Add ("XGetDimensionDescr","XGetDimensionDescr Doc Dim_Label\n" |
2851 | "Return all descriptions of given Dimension.", |
2852 | __FILE__, getDimDescr, g); |
f0bf70e8 |
2853 | |
2854 | di.Add ("XSetGDTPosition","XSetGDTPosition Doc GDT_Label loc_x loc_y loc_z normal_x normal_y normal_z xdir_x xdir_y xdir_z" |
2855 | "Set plane to display dimension parallel to and point to display text (loc)", |
2856 | __FILE__, addGDTPosition, g); |
2857 | |
2858 | di.Add ("XGetGDTPosition","XGetGDTPosition Doc GDT_Label" |
2859 | "Returns text position and plane, parallel to which dimension is displayed", |
2860 | __FILE__, getGDTPosition, g); |
2861 | |
2862 | di.Add ("XSetGDTPresentation","XSetGDTPresentation Doc GDT_Label Shape Name" |
2863 | "Set presentation with given name for dimension", |
2864 | __FILE__, addGDTPresentation, g); |
2865 | |
2866 | di.Add ("XGetGDTPresentation","XGetGDTPresentation Doc GDT_Label Shape" |
2867 | "Returns Presentation into Shape", |
2868 | __FILE__, getGDTPresentation, g); |
9ebaae37 |
2869 | } |