0026859: Export of GDT from XCAF to STEP
[occt.git] / src / XDEDRAW / XDEDRAW_GDTs.cxx
CommitLineData
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
6595eee7 22#include <STEPConstruct_GDTProperty.hxx>
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
64static 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
341static 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,
374 nbWithPath = 0;
375 for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
376 Handle(XCAFDoc_Dimension) aDimAttr;
377 if (!aGDTs.Value(i).FindAttribute(XCAFDoc_Dimension::GetID(),aDimAttr))
378 continue;
379 Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimAttr->GetObject();
380 if (anObject.IsNull())
381 continue;
382 XCAFDimTolObjects_DimensionType aDimType = anObject->GetType();
383 if (STEPConstruct_GDTProperty::IsDimensionalLocation(aDimType)) {
384 nbLocation++;
385 }
386 else if (aDimType == XCAFDimTolObjects_DimensionType_Location_Angular) {
387 nbAngular++;
388 nbLocation++;
389 }
390 else if (aDimType == XCAFDimTolObjects_DimensionType_Location_WithPath) {
391 nbLocation++;
392 nbWithPath++;
393 }
394 else if (STEPConstruct_GDTProperty::IsDimensionalSize(aDimType)) {
395 nbSize++;
396 }
397 else if (aDimType == XCAFDimTolObjects_DimensionType_Size_Angular) {
398 nbSize++;
399 nbAngular++;
400 }
401 else if (aDimType == XCAFDimTolObjects_DimensionType_Size_WithPath) {
402 nbSize++;
403 nbWithPath++;
404 }
405 }
406 di << "\n NbOfDimensionalSize : " << nbSize;
407 di << "\n NbOfDimensionalLocation: " << nbLocation;
408 di << "\n NbOfAngular : " << nbAngular;
409 di << "\n NbOfWithPath : " << nbWithPath;
410 }
1c9d3225 411
412 aGDTs.Clear();
413 aDimTolTool->GetGeomToleranceLabels(aGDTs);
414 di << "\n NbOfTolerances : " << aGDTs.Length();
6595eee7 415 if (isFull) {
416 Standard_Integer nbWithModif = 0,
417 nbWithMaxTol = 0,
418 nbWithDatumRef = 0;
419 for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
420 Handle(XCAFDoc_GeomTolerance) aGTAttr;
421 if (!aGDTs.Value(i).FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGTAttr))
422 continue;
423 Handle(XCAFDimTolObjects_GeomToleranceObject) anObject = aGTAttr->GetObject();
424 if (anObject.IsNull())
425 continue;
426 if (anObject->GetModifiers().Length() > 0 ||
427 anObject->GetMaterialRequirementModifier() != XCAFDimTolObjects_GeomToleranceMatReqModif_None) {
428 nbWithModif++;
429 }
430 if (anObject->GetMaxValueModifier() != 0) {
431 nbWithMaxTol++;
432 }
433 TDF_LabelSequence aDatumSeq;
434 aDimTolTool->GetDatumWithObjectOfTolerLabels(aGDTs.Value(i), aDatumSeq);
435 if (aDatumSeq.Length() > 0) {
436 nbWithDatumRef++;
437 }
438 }
439 di << "\n NbOfGTWithModifiers : " << nbWithModif;
440 di << "\n NbOfGTWithMaxTolerance : " << nbWithMaxTol;
441 di << "\n NbOfGTWithDatums : " << nbWithDatumRef;
442 }
1c9d3225 443
444 Standard_Integer aCounter = 0;
445 Standard_Integer aCounter1 = 0;
446 Standard_Integer aCounter2 = 0;
447
448 for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
449 {
450 Standard_Boolean isDatum = Standard_False;
451 TDF_LabelSequence aDatL;
452 if(aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatL))
453 {
454 for(Standard_Integer j = aDatL.Lower(); j <= aDatL.Upper(); j++)
455 {
456 Handle(XCAFDoc_Datum) aDat;
457 if(aDatL.Value(j).FindAttribute(XCAFDoc_Datum::GetID(), aDat))
458 {
459 if(aDat->GetObject()->IsDatumTarget())
460 {
461 aCounter1++;
462 }
463 else
464 {
465 aCounter2++;
466 isDatum = Standard_True;
467 }
468 }
9ebaae37 469 }
1c9d3225 470 if(isDatum)
471 aCounter++;
9ebaae37 472 }
473 }
1c9d3225 474 di << "\n NbOfDatumFeature : " << aCounter;
475 di << "\n NbOfAttachedDatum : " << aCounter2;
476 di << "\n NbOfDatumTarget : " << aCounter1;
477
9ebaae37 478 return 0;
479}
480
481static Standard_Integer addDim (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
482{
483 if (argc < 3) {
586db386 484 di<<"Use: XAddDimension Doc shape/label [shape/label]\n";
9ebaae37 485 return 1;
486 }
487 Handle(TDocStd_Document) Doc;
488 DDocStd::GetDocument(argv[1], Doc);
586db386 489 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 490 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
491 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
492
493 TDF_Label aLabel;
494 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
495 if ( aLabel.IsNull() )
496 {
497 TopoDS_Shape aShape= DBRep::Get(argv[2]);
498 if ( !aShape.IsNull() )
499 {
500 aShapeTool->Search(aShape, aLabel);
501 if ( aLabel.IsNull() )
502 {
503 di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
504 return 1;
505 }
506 }
507 }
508 TDF_Label aLabel1;
509 if(argc == 4)
510 {
511 TDF_Tool::Label(Doc->GetData(), argv[3], aLabel1);
512 if ( aLabel1.IsNull() )
513 {
514 TopoDS_Shape aShape= DBRep::Get(argv[3]);
515 if ( !aShape.IsNull() )
516 {
517 aShapeTool->Search(aShape, aLabel1);
518 if ( aLabel1.IsNull() )
519 {
520 di<<"Shape "<<argv[3]<<" is absent in "<<argv[1]<<"\n";
521 return 1;
522 }
523 }
524 }
525 }
526
527 TDF_Label aDimL = aDimTolTool->AddDimension();
528 if(aLabel1.IsNull())
529 aDimTolTool->SetDimension(aLabel, aDimL);
530 else
531 aDimTolTool->SetDimension(aLabel, aLabel1, aDimL);
532 TCollection_AsciiString Entry;
533 TDF_Tool::Entry(aDimL, Entry);
534 di << Entry;
535 return 0;
536}
537
538static Standard_Integer addGTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
539{
540 if (argc < 3) {
586db386 541 di<<"Use: XAddGeomTolerance Doc shape/label\n";
9ebaae37 542 return 1;
543 }
544 Handle(TDocStd_Document) Doc;
545 DDocStd::GetDocument(argv[1], Doc);
586db386 546 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 547 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
548 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
549
550 TDF_Label aLabel;
551 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
552 if ( aLabel.IsNull() )
553 {
554 TopoDS_Shape aShape= DBRep::Get(argv[2]);
555 if ( !aShape.IsNull() )
556 {
557 aShapeTool->Search(aShape, aLabel);
558 if ( aLabel.IsNull() )
559 {
560 di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
561 return 1;
562 }
563 }
564 }
565
566 TDF_Label aTolL = aDimTolTool->AddGeomTolerance();
567 aDimTolTool->SetGeomTolerance(aLabel, aTolL);
568 TCollection_AsciiString Entry;
569 TDF_Tool::Entry(aTolL, Entry);
570 di << Entry;
571 return 0;
572}
573
574static Standard_Integer addDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
575{
576 if (argc < 3) {
586db386 577 di<<"Use: XAddDatum Doc shape/label\n";
9ebaae37 578 return 1;
579 }
580 Handle(TDocStd_Document) Doc;
581 DDocStd::GetDocument(argv[1], Doc);
586db386 582 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 583 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
584 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
585
586 TDF_Label aLabel;
587 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
588 if ( aLabel.IsNull() )
589 {
590 TopoDS_Shape aShape= DBRep::Get(argv[2]);
591 if ( !aShape.IsNull() )
592 {
593 aShapeTool->Search(aShape, aLabel);
594 if ( aLabel.IsNull() )
595 {
596 di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
597 return 1;
598 }
599 }
600 }
601
602 TDF_Label aDatumL = aDimTolTool->AddDatum();
603 aDimTolTool->SetDatum(aLabel, aDatumL);
604 TCollection_AsciiString Entry;
605 TDF_Tool::Entry(aDatumL, Entry);
606 di << Entry;
607 return 0;
608}
609
610static Standard_Integer setDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
611{
612 if (argc < 4) {
586db386 613 di<<"Use: XSetDatum Doc Datum_Label GeomTol_Label\n";
9ebaae37 614 return 1;
615 }
616 Handle(TDocStd_Document) Doc;
617 DDocStd::GetDocument(argv[1], Doc);
586db386 618 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 619 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
620 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
621
622 TDF_Label aLabel;
623 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
624 if ( aLabel.IsNull() )
625 {
626 di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
627 return 1;
628 }
629
630 TDF_Label aTol;
631 TDF_Tool::Label(Doc->GetData(), argv[3], aTol);
632 if ( aTol.IsNull() )
633 {
634 di<<"GeomTolerance "<<argv[3]<<" is absent in "<<argv[1]<<"\n";
635 return 1;
636 }
637
638 aDimTolTool->SetDatumToGeomTol(aLabel, aTol);
639 return 0;
640}
641
642static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
643{
644 if (argc < 3) {
586db386 645 di<<"Use: XGetDatum Doc GeomTol_Label/Shape_Label\n";
9ebaae37 646 return 1;
647 }
648 Handle(TDocStd_Document) Doc;
649 DDocStd::GetDocument(argv[1], Doc);
586db386 650 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 651 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
652 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
653
654 TDF_Label aLabel;
655 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
656 if ( aLabel.IsNull() )
657 {
658 di<<"Label "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
659 return 1;
660 }
661
1c9d3225 662 TDF_LabelSequence aD;
9ebaae37 663 if(!aDimTolTool->GetRefDatumLabel(aLabel, aD))
664 {
1c9d3225 665 aDimTolTool->GetDatumOfTolerLabels(aLabel, aD);
9ebaae37 666 }
1c9d3225 667 for(Standard_Integer i = aD.Lower(); i <= aD.Upper(); i++)
9ebaae37 668 {
1c9d3225 669 if(i>1) di<<", ";
9ebaae37 670 TCollection_AsciiString Entry;
1c9d3225 671 TDF_Tool::Entry(aD.Value(i), Entry);
9ebaae37 672 di<<Entry;
673 }
674 return 0;
675}
676
677static Standard_Integer addDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
678{
679 if (argc < 4) {
586db386 680 di<<"Use: XAddDatumModifier Doc Datum_Label mod1 mod2 ...\n";
9ebaae37 681 return 1;
682 }
683 Handle(TDocStd_Document) Doc;
684 DDocStd::GetDocument(argv[1], Doc);
586db386 685 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 686 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
687 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
688
689 TDF_Label aLabel;
690 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
691 if ( aLabel.IsNull() )
692 {
693 di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
694 return 1;
695 }
696 Handle(XCAFDoc_Datum) aDatum;
697 if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
698 {
699 for(Standard_Integer i = 3; i < argc; i++)
700 {
701 if(Draw::Atoi(argv[i]) < 22 && Draw::Atoi(argv[i]) > -1)
702 {
703 Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject();
704 anObj->AddModifier((XCAFDimTolObjects_DatumSingleModif)Draw::Atoi(argv[i]));
705 aDatum->SetObject(anObj);
706 }
707 }
708 }
709 return 0;
710}
711
712static Standard_Integer getDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
713{
714 if (argc < 3) {
586db386 715 di<<"Use: XGetDatumModifiers Doc Datum_Label\n";
9ebaae37 716 return 1;
717 }
718 Handle(TDocStd_Document) Doc;
719 DDocStd::GetDocument(argv[1], Doc);
586db386 720 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 721 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
722 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
723
724 TDF_Label aLabel;
725 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
726 if ( aLabel.IsNull() )
727 {
728 di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
729 return 1;
730 }
731 Handle(XCAFDoc_Datum) aDatum;
732 if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
733 {
734 XCAFDimTolObjects_DatumModifiersSequence aS = aDatum->GetObject()->GetModifiers();
735 for(Standard_Integer i = 1; i<=aS.Length();i++)
736 {
737 if (i > 1) di<<", ";
738 switch(aS.Value(i)){
739 case 0 : di<<"AnyCrossSection"; break;
740 case 1 : di<<"AnyLongitudinalSection"; break;
741 case 2 : di<<"Basic"; break;
742 case 3 : di<<"ContactingFeature\n"; break;
743 case 4 : di<<"DegreeOfFreedomConstraintU"; break;
744 case 5 : di<<"DegreeOfFreedomConstraintV"; break;
745 case 6 : di<<"DegreeOfFreedomConstraintW"; break;
746 case 7 : di<<"DegreeOfFreedomConstraintX"; break;
747 case 8 : di<<"DegreeOfFreedomConstraintY"; break;
748 case 9 : di<<"DegreeOfFreedomConstraintZ"; break;
749 case 10 : di<<"DistanceVariable"; break;
750 case 11 : di<<"FreeState"; break;
751 case 12 : di<<"LeastMaterialRequirement"; break;
752 case 13 : di<<"Line"; break;
753 case 14 : di<<"MajorDiameter"; break;
754 case 15 : di<<"MaximumMaterialRequirement"; break;
755 case 16 : di<<"MinorDiameter"; break;
756 case 17 : di<<"Orientation"; break;
757 case 18 : di<<"PitchDiameter"; break;
758 case 19 : di<<"Plane"; break;
759 case 20 : di<<"Point"; break;
760 case 21 : di<<"Translation"; break;
761 default : break;
762 }
763 }
764 }
765 return 0;
766}
767
768static Standard_Integer setDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
769{
770 if (argc < 4) {
586db386 771 di<<"Use: XSetDatumName Doc Datum_Label name\n";
9ebaae37 772 return 1;
773 }
774 Handle(TDocStd_Document) Doc;
775 DDocStd::GetDocument(argv[1], Doc);
586db386 776 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 777 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
778 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
779
780 TDF_Label aLabel;
781 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
782 if ( aLabel.IsNull() )
783 {
784 di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
785 return 1;
786 }
787 Handle(XCAFDoc_Datum) aDatum;
788 if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
789 {
790 Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject();
791 anObj->SetName(new TCollection_HAsciiString(argv[3]));
792 aDatum->SetObject(anObj);
793 }
794 return 0;
795}
796
797static Standard_Integer getDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
798{
799 if (argc < 3) {
586db386 800 di<<"Use: XGetDatumName Doc Datum_Label\n";
9ebaae37 801 return 1;
802 }
803 Handle(TDocStd_Document) Doc;
804 DDocStd::GetDocument(argv[1], Doc);
586db386 805 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 806 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
807 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
808
809 TDF_Label aLabel;
810 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
811 if ( aLabel.IsNull() )
812 {
813 di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
814 return 1;
815 }
816 Handle(XCAFDoc_Datum) aDatum;
817 if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
818 {
819 di<<aDatum->GetObject()->GetName()->ToCString();
820 }
821 return 0;
822}
823
824static Standard_Integer setTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
825{
826 if (argc < 4) {
586db386 827 di<<"Use: XSetTypeOfTolerance Doc GTol_Label type\n";
9ebaae37 828 return 1;
829 }
830 Handle(TDocStd_Document) Doc;
831 DDocStd::GetDocument(argv[1], Doc);
586db386 832 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 833 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
834 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
835
836 TDF_Label aLabel;
837 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
838 if ( aLabel.IsNull() )
839 {
840 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
841 return 1;
842 }
843 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
844 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
845 {
846 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 16)
847 {
848 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
849 anObj->SetType((XCAFDimTolObjects_GeomToleranceType)Draw::Atoi(argv[3]));
850 aGeomTolerance->SetObject(anObj);
851 }
852 }
853 return 0;
854}
855
856static Standard_Integer getTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
857{
858 if (argc < 3) {
586db386 859 di<<"Use: XGetTypeOfTolerance Doc GTol_Label\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<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
873 return 1;
874 }
875 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
876 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
877 {
878 switch(aGeomTolerance->GetObject()->GetType()){
879 case 0 : di<<"type is absent"; break;
880 case 1 : di<<"Angularity"; break;
881 case 2 : di<<"CircularRunout"; break;
882 case 3 : di<<"CircularityOrRoundness"; break;
883 case 4 : di<<"Coaxiality"; break;
884 case 5 : di<<"Concentricity"; break;
885 case 6 : di<<"Cylindricity"; break;
886 case 7 : di<<"Flatness"; break;
887 case 8 : di<<"Parallelism"; break;
888 case 9 : di<<"Perpendicularity"; break;
889 case 10 : di<<"Position"; break;
890 case 11 : di<<"ProfileOfLine"; break;
891 case 12 : di<<"ProfileOfSurface"; break;
892 case 13 : di<<"Straightness"; break;
893 case 14 : di<<"Symmetry"; break;
894 case 15 : di<<"TotalRunout"; break;
895 default : break;
896 }
897 }
898 return 0;
899}
900
901static Standard_Integer setTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
902{
903 if (argc < 4) {
586db386 904 di<<"Use: XSetTypeOfToleranceValue Doc GTol_Label type\n";
9ebaae37 905 return 1;
906 }
907 Handle(TDocStd_Document) Doc;
908 DDocStd::GetDocument(argv[1], Doc);
586db386 909 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 910 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
911 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
912
913 TDF_Label aLabel;
914 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
915 if ( aLabel.IsNull() )
916 {
917 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
918 return 1;
919 }
920 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
921 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
922 {
923 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
924 {
925 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
926 anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)Draw::Atoi(argv[3]));
927 aGeomTolerance->SetObject(anObj);
928 }
929 }
930 return 0;
931}
932
933static Standard_Integer getTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
934{
935 if (argc < 3) {
586db386 936 di<<"Use: XGetTypeOfToleranceValue Doc GTol_Label\n";
9ebaae37 937 return 1;
938 }
939 Handle(TDocStd_Document) Doc;
940 DDocStd::GetDocument(argv[1], Doc);
586db386 941 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 942 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
943 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
944
945 TDF_Label aLabel;
946 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
947 if ( aLabel.IsNull() )
948 {
949 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
950 return 1;
951 }
952 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
953 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
954 {
955 switch(aGeomTolerance->GetObject()->GetTypeOfValue()){
956 case 0 : di<<"type is absent"; break;
957 case 1 : di<<"Diameter"; break;
958 case 2 : di<<"SphericalDiameter"; break;
959 default : break;
960 }
961 }
962 return 0;
963}
964
965static Standard_Integer setTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
966{
967 if (argc < 4) {
586db386 968 di<<"Use: XSetToleranceValue Doc GTol_Label value\n";
9ebaae37 969 return 1;
970 }
971 Handle(TDocStd_Document) Doc;
972 DDocStd::GetDocument(argv[1], Doc);
586db386 973 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 974 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
975 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
976
977 TDF_Label aLabel;
978 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
979 if ( aLabel.IsNull() )
980 {
981 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
982 return 1;
983 }
984 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
985 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
986 {
987 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
988 anObj->SetValue(Draw::Atof(argv[3]));
989 aGeomTolerance->SetObject(anObj);
990 }
991 return 0;
992}
993
994static Standard_Integer getTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
995{
996 if (argc < 3) {
586db386 997 di<<"Use: XGetToleranceValue Doc GTol_Label\n";
9ebaae37 998 return 1;
999 }
1000 Handle(TDocStd_Document) Doc;
1001 DDocStd::GetDocument(argv[1], Doc);
586db386 1002 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1003 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1004 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1005
1006 TDF_Label aLabel;
1007 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1008 if ( aLabel.IsNull() )
1009 {
1010 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1011 return 1;
1012 }
1013 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1014 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1015 {
1016 di << aGeomTolerance->GetObject()->GetValue();
1017 }
1018 return 0;
1019}
1020
1021static Standard_Integer setMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1022{
1023 if (argc < 4) {
586db386 1024 di<<"Use: XSetTolMaterialReq Doc GTol_Label mod\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 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
1044 {
1045 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
1046 anObj->SetMaterialRequirementModifier((XCAFDimTolObjects_GeomToleranceMatReqModif)Draw::Atoi(argv[3]));
1047 aGeomTolerance->SetObject(anObj);
1048 }
1049 }
1050 return 0;
1051}
1052
1053static Standard_Integer getMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1054{
1055 if (argc < 3) {
586db386 1056 di<<"Use: XGetTolMaterialReq Doc GTol_Label\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 switch(aGeomTolerance->GetObject()->GetMaterialRequirementModifier()){
1076 case 0 : di<<"modifier is absent"; break;
1077 case 1 : di<<"M"; break;
1078 case 2 : di<<"L"; break;
1079 default : break;
1080 }
1081 }
1082 return 0;
1083}
1084
1085static Standard_Integer setZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1086{
1087 if (argc < 4) {
586db386 1088 di<<"Use: XSetTolZoneMod Doc GTol_Label mod\n";
9ebaae37 1089 return 1;
1090 }
1091 Handle(TDocStd_Document) Doc;
1092 DDocStd::GetDocument(argv[1], Doc);
586db386 1093 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1094 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1095 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1096
1097 TDF_Label aLabel;
1098 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1099 if ( aLabel.IsNull() )
1100 {
1101 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1102 return 1;
1103 }
1104 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1105 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1106 {
1107 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
1108 {
1109 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
1110 anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)Draw::Atoi(argv[3]));
1111 aGeomTolerance->SetObject(anObj);
1112 }
1113 }
1114 return 0;
1115}
1116
1117static Standard_Integer getZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1118{
1119 if (argc < 3) {
586db386 1120 di<<"Use: XGetTolZoneMod Doc GTol_Label\n";
9ebaae37 1121 return 1;
1122 }
1123 Handle(TDocStd_Document) Doc;
1124 DDocStd::GetDocument(argv[1], Doc);
586db386 1125 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1126 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1127 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1128
1129 TDF_Label aLabel;
1130 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1131 if ( aLabel.IsNull() )
1132 {
1133 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1134 return 1;
1135 }
1136 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1137 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1138 {
1139 switch(aGeomTolerance->GetObject()->GetZoneModifier()){
1140 case 0 : di<<"modifier is absent"; break;
1141 case 1 : di<<"P"; break;
1142 case 2 : di<<"NonUniform"; break;
1143 default : break;
1144 }
1145 }
1146 return 0;
1147}
1148
1149static Standard_Integer setZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1150{
1151 if (argc < 4) {
586db386 1152 di<<"Use: XSetTolZoneModValue Doc GTol_Label val\n";
9ebaae37 1153 return 1;
1154 }
1155 Handle(TDocStd_Document) Doc;
1156 DDocStd::GetDocument(argv[1], Doc);
586db386 1157 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1158 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1159 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1160
1161 TDF_Label aLabel;
1162 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1163 if ( aLabel.IsNull() )
1164 {
1165 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1166 return 1;
1167 }
1168 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1169 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1170 {
1171 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
1172 anObj->SetValueOfZoneModifier(Draw::Atof(argv[3]));
1173 aGeomTolerance->SetObject(anObj);
1174 }
1175 return 0;
1176}
1177
1178static Standard_Integer getZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1179{
1180 if (argc < 3) {
586db386 1181 di<<"Use: XGetTolZoneModValue Doc GTol_Label\n";
9ebaae37 1182 return 1;
1183 }
1184 Handle(TDocStd_Document) Doc;
1185 DDocStd::GetDocument(argv[1], Doc);
586db386 1186 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1187 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1188 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1189
1190 TDF_Label aLabel;
1191 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1192 if ( aLabel.IsNull() )
1193 {
1194 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1195 return 1;
1196 }
1197 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1198 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1199 {
1200 di << aGeomTolerance->GetObject()->GetValueOfZoneModifier();
1201 }
1202 return 0;
1203}
1204
1205static Standard_Integer addTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1206{
1207 if (argc < 4) {
586db386 1208 di<<"Use: XAddTolModifier Doc Tol_Label mod1 mod2 ...\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 for(Standard_Integer i = 3; i < argc; i++)
1228 {
1229 if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 15)
1230 {
1231 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
1232 anObj->AddModifier((XCAFDimTolObjects_GeomToleranceModif)Draw::Atoi(argv[i]));
1233 aGeomTolerance->SetObject(anObj);
1234 }
1235 }
1236 }
1237 return 0;
1238}
1239
1240static Standard_Integer getTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1241{
1242 if (argc < 3) {
586db386 1243 di<<"Use: XGetTolModifiers Doc Tol_Label\n";
9ebaae37 1244 return 1;
1245 }
1246 Handle(TDocStd_Document) Doc;
1247 DDocStd::GetDocument(argv[1], Doc);
586db386 1248 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1249 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1250 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1251
1252 TDF_Label aLabel;
1253 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1254 if ( aLabel.IsNull() )
1255 {
1256 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1257 return 1;
1258 }
1259 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1260 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1261 {
1262 XCAFDimTolObjects_GeomToleranceModifiersSequence aS = aGeomTolerance->GetObject()->GetModifiers();
1263 for(Standard_Integer i = 1; i <= aS.Length(); i++)
1264 {
1265 if (i > 1) di<<", ";
1266 switch(aS.Value(i)){
1267 case 0 : di<<"Any_Cross_Section"; break;
1268 case 1 : di<<"Common_Zone"; break;
1269 case 2 : di<<"Each_Radial_Element"; break;
1270 case 3 : di<<"Free_State"; break;
1271 case 4 : di<<"Least_Material_Requirement"; break;
1272 case 5 : di<<"Line_Element"; break;
1273 case 6 : di<<"Major_Diameter"; break;
1274 case 7 : di<<"Maximum_Material_Requirement"; break;
1275 case 8 : di<<"Minor_Diameter"; break;
1276 case 9 : di<<"Not_Convex"; break;
1277 case 10 : di<<"Pitch_Diameter"; break;
1278 case 11 : di<<"Reciprocity_Requirement"; break;
1279 case 12 : di<<"Separate_Requirement"; break;
1280 case 13 : di<<"Statistical_Tolerance"; break;
1281 case 14 : di<<"Tangent_Plane"; break;
1282 default : break;
1283 }
1284 }
1285 }
1286 return 0;
1287}
1288
1289static Standard_Integer setTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1290{
1291 if (argc < 4) {
586db386 1292 di<<"Use: XSetTolMaxValue Doc Dim_Label val\n";
9ebaae37 1293 return 1;
1294 }
1295 Handle(TDocStd_Document) Doc;
1296 DDocStd::GetDocument(argv[1], Doc);
586db386 1297 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1298 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1299 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1300
1301 TDF_Label aLabel;
1302 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1303 if ( aLabel.IsNull() )
1304 {
1305 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1306 return 1;
1307 }
1308 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1309 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1310 {
1311 Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
1312 anObj->SetMaxValueModifier(Draw::Atof(argv[3]));
1313 aGeomTolerance->SetObject(anObj);
1314 }
1315 return 0;
1316}
1317
1318static Standard_Integer getTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1319{
1320 if (argc < 3) {
586db386 1321 di<<"Use: XGetTolMaxValue Doc Dim_Label\n";
9ebaae37 1322 return 1;
1323 }
1324 Handle(TDocStd_Document) Doc;
1325 DDocStd::GetDocument(argv[1], Doc);
586db386 1326 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1327 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1328 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1329
1330 TDF_Label aLabel;
1331 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1332 if ( aLabel.IsNull() )
1333 {
1334 di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1335 return 1;
1336 }
1337 Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
1338 if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
1339 {
1340 di << aGeomTolerance->GetObject()->GetMaxValueModifier();
1341 }
1342 return 0;
1343}
1344
1345static Standard_Integer setDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1346{
1347 if (argc < 4) {
586db386 1348 di<<"Use: XSetDimensionType Doc Dim_Label type\n";
9ebaae37 1349 return 1;
1350 }
1351 Handle(TDocStd_Document) Doc;
1352 DDocStd::GetDocument(argv[1], Doc);
586db386 1353 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1354 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1355 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1356
1357 TDF_Label aLabel;
1358 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1359 if ( aLabel.IsNull() )
1360 {
1361 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1362 return 1;
1363 }
1364 Handle(XCAFDoc_Dimension) aDimension;
1365 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1366 {
1367 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 30)
1368 {
1369 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1370 anObj->SetType((XCAFDimTolObjects_DimensionType)Draw::Atoi(argv[3]));
1371 aDimension->SetObject(anObj);
1372 }
1373 }
1374 return 0;
1375}
1376
1377static Standard_Integer getDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1378{
1379 if (argc < 3) {
586db386 1380 di<<"Use: XGetDimensionType Doc Dim_Label\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<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1394 return 1;
1395 }
1396 Handle(XCAFDoc_Dimension) aDimension;
1397 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1398 {
1399 switch(aDimension->GetObject()->GetType()){
1400 case 0 : di<<"type is absent"; break;
1401 case 1 : di<<"Location_CurvedDistance"; break;
1402 case 2 : di<<"Location_LinearDistance"; break;
1403 case 3 : di<<"Location_LinearDistance_FromCenterToOuter"; break;
1404 case 4 : di<<"Location_LinearDistance_FromCenterToInner"; break;
1405 case 5 : di<<"Location_LinearDistance_FromOuterToCenter"; break;
1406 case 6 : di<<"Location_LinearDistance_FromOuterToOuter"; break;
1407 case 7 : di<<"Location_LinearDistance_FromOuterToInner"; break;
1408 case 8 : di<<"Location_LinearDistance_FromInnerToCenter"; break;
1409 case 9 : di<<"Location_LinearDistance_FromInnerToOuter"; break;
1410 case 10 : di<<"Location_LinearDistance_FromInnerToInner"; break;
1411 case 11 : di<<"Location_Angular"; break;
1412 case 12 : di<<"Location_Oriented"; break;
1413 case 13 : di<<"Location_WithPath"; break;
1414 case 14 : di<<"Size_CurveLength"; break;
1415 case 15 : di<<"Size_Diameter"; break;
1416 case 16 : di<<"Size_SphericalDiameter"; break;
1417 case 17 : di<<"Size_Radius"; break;
1418 case 18 : di<<"Size_SphericalRadius"; break;
1419 case 19 : di<<"Size_ToroidalMinorDiameter"; break;
1420 case 20 : di<<"Size_ToroidalMajorDiameter"; break;
1421 case 21 : di<<"Size_ToroidalMinorRadius"; break;
1422 case 22 : di<<"Size_ToroidalMajorRadius"; break;
1423 case 23 : di<<"Size_ToroidalHighMajorDiameter"; break;
1424 case 24 : di<<"Size_ToroidalLowMajorDiameter"; break;
1425 case 25 : di<<"Size_ToroidalHighMajorRadius"; break;
1426 case 26 : di<<"Size_ToroidalLowMajorRadius"; break;
1427 case 27 : di<<"Size_Thickness"; break;
1428 case 28 : di<<"Size_Angular"; break;
1429 case 29 : di<<"Size_WithPath"; break;
1430 default : break;
1431 }
1432 }
1433 return 0;
1434}
1435
1436static Standard_Integer setDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1437{
1438 if (argc < 4) {
586db386 1439 di<<"Use: XSetDimensionValue Doc Dim_Label val\n";
9ebaae37 1440 return 1;
1441 }
1442 Handle(TDocStd_Document) Doc;
1443 DDocStd::GetDocument(argv[1], Doc);
586db386 1444 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1445 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1446 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1447
1448 TDF_Label aLabel;
1449 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1450 if ( aLabel.IsNull() )
1451 {
1452 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1453 return 1;
1454 }
1455 Handle(XCAFDoc_Dimension) aDimension;
1456 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1457 {
1458 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1459 anObj->SetValue(Draw::Atof(argv[3]));
1460 aDimension->SetObject(anObj);
1461 }
1462 return 0;
1463}
1464
1465static Standard_Integer getDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1466{
1467 if (argc < 3) {
586db386 1468 di<<"Use: XGetDimensionValue 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 di << aDimension->GetObject()->GetValue();
1488 }
1489 return 0;
1490}
1491
1492static Standard_Integer setDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1493{
1494 if (argc < 4) {
586db386 1495 di<<"Use: XSetDimensionQualifier Doc Dim_Label val\n";
9ebaae37 1496 return 1;
1497 }
1498 Handle(TDocStd_Document) Doc;
1499 DDocStd::GetDocument(argv[1], Doc);
586db386 1500 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1501 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1502 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1503
1504 TDF_Label aLabel;
1505 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1506 if ( aLabel.IsNull() )
1507 {
1508 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1509 return 1;
1510 }
1511 Handle(XCAFDoc_Dimension) aDimension;
1512 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1513 {
1514 if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 4)
1515 {
1516 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1517 anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)Draw::Atoi(argv[3]));
1518 aDimension->SetObject(anObj);
1519 }
1520 }
1521 return 0;
1522}
1523
1524static Standard_Integer getDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1525{
1526 if (argc < 3) {
586db386 1527 di<<"Use: XGetDimensionQualifier Doc Dim_Label\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
1547 switch(aDimension->GetObject()->GetQualifier()){
1548 case 0 : di<<"type is absent"; break;
1549 case 1 : di<<"Min"; break;
1550 case 2 : di<<"Max"; break;
1551 case 3 : di<<"Avg"; break;
1552 default : break;
1553 }
1554 }
1555 return 0;
1556}
1557
1558static Standard_Integer setDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1559{
1560 if (argc < 5) {
586db386 1561 di<<"Use: XSetDimensionRange Doc Dim_Label low_val up_val\n";
9ebaae37 1562 return 1;
1563 }
1564 Handle(TDocStd_Document) Doc;
1565 DDocStd::GetDocument(argv[1], Doc);
586db386 1566 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1567 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1568 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1569
1570 TDF_Label aLabel;
1571 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1572 if ( aLabel.IsNull() )
1573 {
1574 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1575 return 1;
1576 }
1577 Handle(XCAFDoc_Dimension) aDimension;
1578 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1579 {
1580 if(Draw::Atof(argv[3]) < Draw::Atof(argv[4]))
1581 {
1582 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1583 anObj->SetLowerBound(Draw::Atof(argv[3]));
1584 anObj->SetUpperBound(Draw::Atof(argv[4]));
1585 aDimension->SetObject(anObj);
1586 }
1587 }
1588 return 0;
1589}
1590
1591static Standard_Integer getDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1592{
1593 if (argc < 3) {
586db386 1594 di<<"Use: XGetDimensionRange Doc Dim_Label\n";
9ebaae37 1595 return 1;
1596 }
1597 Handle(TDocStd_Document) Doc;
1598 DDocStd::GetDocument(argv[1], Doc);
586db386 1599 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1600 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1601 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1602
1603 TDF_Label aLabel;
1604 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1605 if ( aLabel.IsNull() )
1606 {
1607 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1608 return 1;
1609 }
1610 Handle(XCAFDoc_Dimension) aDimension;
1611 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1612 {
1613 di << "lower " << aDimension->GetObject()->GetLowerBound();
1614 di << " upper " << aDimension->GetObject()->GetUpperBound();
1615 }
1616 return 0;
1617}
1618
1619static Standard_Integer setDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1620{
1621 if (argc < 5) {
586db386 1622 di<<"Use: XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val\n";
9ebaae37 1623 return 1;
1624 }
1625 Handle(TDocStd_Document) Doc;
1626 DDocStd::GetDocument(argv[1], Doc);
586db386 1627 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1628 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1629 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1630
1631 TDF_Label aLabel;
1632 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1633 if ( aLabel.IsNull() )
1634 {
1635 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1636 return 1;
1637 }
1638 Handle(XCAFDoc_Dimension) aDimension;
1639 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1640 {
1641 if(Draw::Atof(argv[3]) < Draw::Atof(argv[4]))
1642 {
1643 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1644 anObj->SetLowerTolValue(Draw::Atof(argv[3]));
1645 anObj->SetUpperTolValue(Draw::Atof(argv[4]));
1646 aDimension->SetObject(anObj);
1647 }
1648 }
1649 return 0;
1650}
1651
1652static Standard_Integer getDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1653{
1654 if (argc < 3) {
586db386 1655 di<<"Use: XGetDimensionPlusMinusTol Doc Dim_Label\n";
9ebaae37 1656 return 1;
1657 }
1658 Handle(TDocStd_Document) Doc;
1659 DDocStd::GetDocument(argv[1], Doc);
586db386 1660 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1661 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1662 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1663
1664 TDF_Label aLabel;
1665 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1666 if ( aLabel.IsNull() )
1667 {
1668 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1669 return 1;
1670 }
1671 Handle(XCAFDoc_Dimension) aDimension;
1672 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1673 {
1674 di << "lower " << aDimension->GetObject()->GetLowerTolValue();
1675 di << " upper " << aDimension->GetObject()->GetUpperTolValue();
1676 }
1677 return 0;
1678}
1679
1680static Standard_Integer setDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1681{
1682 if (argc < 6) {
586db386 1683 di<<"Use: XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade\n";
9ebaae37 1684 return 1;
1685 }
1686 Handle(TDocStd_Document) Doc;
1687 DDocStd::GetDocument(argv[1], Doc);
586db386 1688 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1689 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1690 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1691
1692 TDF_Label aLabel;
1693 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1694 if ( aLabel.IsNull() )
1695 {
1696 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1697 return 1;
1698 }
1699 Handle(XCAFDoc_Dimension) aDimension;
1700 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1701 {
1702 if(Draw::Atoi(argv[4]) > 0 && Draw::Atoi(argv[4]) < 29 && Draw::Atoi(argv[5]) > -1 && Draw::Atoi(argv[5]) < 20)
1703 {
1704 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1705 anObj->SetClassOfTolerance((Draw::Atoi(argv[3]) != 0), (XCAFDimTolObjects_DimensionFormVariance)Draw::Atoi(argv[4]), (XCAFDimTolObjects_DimensionGrade)Draw::Atoi(argv[5]));
1706 aDimension->SetObject(anObj);
1707 }
1708 }
1709 return 0;
1710}
1711
1712static Standard_Integer getDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1713{
1714 if (argc < 3) {
586db386 1715 di<<"Use: XGetDimensionClassOfTol Doc Dim_Label\n";
9ebaae37 1716 return 1;
1717 }
1718 Handle(TDocStd_Document) Doc;
1719 DDocStd::GetDocument(argv[1], Doc);
586db386 1720 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1721 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1722 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1723
1724 TDF_Label aLabel;
1725 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1726 if ( aLabel.IsNull() )
1727 {
1728 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1729 return 1;
1730 }
1731 Handle(XCAFDoc_Dimension) aDimension;
1732 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1733 {
1734 Standard_Boolean h;
1735 XCAFDimTolObjects_DimensionFormVariance f;
1736 XCAFDimTolObjects_DimensionGrade g;
1737 if(aDimension->GetObject()->GetClassOfTolerance(h ,f, g))
1738 {
1739 if(h)
1740 {
1741 switch(f){
1742 case 1 : di<<"a";break;
1743 case 2 : di<<"b";break;
1744 case 3 : di<<"c";break;
1745 case 4 : di<<"cd";break;
1746 case 5 : di<<"d";break;
1747 case 6 : di<<"e";break;
1748 case 7 : di<<"ef";break;
1749 case 8 : di<<"f";break;
1750 case 9 : di<<"fg";break;
1751 case 10 : di<<"g";break;
1752 case 11 : di<<"h";break;
1753 case 12 : di<<"js";break;
1754 case 13 : di<<"j";break;
1755 case 14 : di<<"k";break;
1756 case 15 : di<<"m";break;
1757 case 16 : di<<"n";break;
1758 case 17 : di<<"p";break;
1759 case 18 : di<<"r";break;
1760 case 19 : di<<"s";break;
1761 case 20 : di<<"t";break;
1762 case 21 : di<<"u";break;
1763 case 22 : di<<"v";break;
1764 case 23 : di<<"x";break;
1765 case 24 : di<<"y";break;
1766 case 25 : di<<"z";break;
1767 case 26 : di<<"a";break;
1768 case 27 : di<<"zb";break;
1769 case 28 : di<<"zc";break;
1770 default : break;
1771 }
1772 }
1773 else
1774 {
1775 switch(f){
1776 case 1 : di<<"A";break;
1777 case 2 : di<<"B";break;
1778 case 3 : di<<"C";break;
1779 case 4 : di<<"CD";break;
1780 case 5 : di<<"D";break;
1781 case 6 : di<<"E";break;
1782 case 7 : di<<"EF";break;
1783 case 8 : di<<"F";break;
1784 case 9 : di<<"FG";break;
1785 case 10 : di<<"G";break;
1786 case 11 : di<<"H";break;
1787 case 12 : di<<"JS";break;
1788 case 13 : di<<"J";break;
1789 case 14 : di<<"K";break;
1790 case 15 : di<<"M";break;
1791 case 16 : di<<"N";break;
1792 case 17 : di<<"P";break;
1793 case 18 : di<<"R";break;
1794 case 19 : di<<"S";break;
1795 case 20 : di<<"T";break;
1796 case 21 : di<<"U";break;
1797 case 22 : di<<"V";break;
1798 case 23 : di<<"X";break;
1799 case 24 : di<<"Y";break;
1800 case 25 : di<<"Z";break;
1801 case 26 : di<<"ZA";break;
1802 case 27 : di<<"ZB";break;
1803 case 28 : di<<"ZC";break;
1804 default : break;
1805 }
1806 }
1807 switch(g){
1808 case 0 : di<<"01"; break;
1809 case 1 : di<<"0"; break;
1810 case 2 : di<<"1"; break;
1811 case 3 : di<<"2"; break;
1812 case 4 : di<<"3"; break;
1813 case 5 : di<<"4"; break;
1814 case 6 : di<<"5"; break;
1815 case 7 : di<<"6"; break;
1816 case 8 : di<<"7"; break;
1817 case 9 : di<<"8"; break;
1818 case 10 : di<<"9"; break;
1819 case 11 : di<<"10"; break;
1820 case 12 : di<<"11"; break;
1821 case 13 : di<<"12"; break;
1822 case 14 : di<<"13"; break;
1823 case 15 : di<<"14"; break;
1824 case 16 : di<<"15"; break;
1825 case 17 : di<<"16"; break;
1826 case 18 : di<<"17"; break;
1827 case 19 : di<<"18"; break;
1828 default : break;
1829 }
1830 }
1831 }
1832 return 0;
1833}
1834
1835static Standard_Integer setDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1836{
1837 if (argc < 5) {
586db386 1838 di<<"Use: XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val\n";
9ebaae37 1839 return 1;
1840 }
1841 Handle(TDocStd_Document) Doc;
1842 DDocStd::GetDocument(argv[1], Doc);
586db386 1843 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1844 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1845 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1846
1847 TDF_Label aLabel;
1848 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1849 if ( aLabel.IsNull() )
1850 {
1851 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1852 return 1;
1853 }
1854 Handle(XCAFDoc_Dimension) aDimension;
1855 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1856 {
1857 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1858 anObj->SetNbOfDecimalPlaces(Draw::Atoi(argv[3]), Draw::Atoi(argv[4]));
1859 aDimension->SetObject(anObj);
1860 }
1861 return 0;
1862}
1863
1864static Standard_Integer getDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1865{
1866 if (argc < 3) {
586db386 1867 di<<"Use: XGetDimensionNbOfDecimalPlaces Doc Dim_Label\n";
9ebaae37 1868 return 1;
1869 }
1870 Handle(TDocStd_Document) Doc;
1871 DDocStd::GetDocument(argv[1], Doc);
586db386 1872 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1873 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1874 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1875
1876 TDF_Label aLabel;
1877 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1878 if ( aLabel.IsNull() )
1879 {
1880 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1881 return 1;
1882 }
1883 Handle(XCAFDoc_Dimension) aDimension;
1884 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1885 {
1886 Standard_Integer l, r;
1887 aDimension->GetObject()->GetNbOfDecimalPlaces(l,r);
1888 di << l << "." << r;
1889 }
1890 return 0;
1891}
1892
1893static Standard_Integer addDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1894{
1895 if (argc < 4) {
586db386 1896 di<<"Use: XAddDimensionModifiers Doc Dim_Label mod1 mod2 ...\n";
9ebaae37 1897 return 1;
1898 }
1899 Handle(TDocStd_Document) Doc;
1900 DDocStd::GetDocument(argv[1], Doc);
586db386 1901 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1902 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1903 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1904
1905 TDF_Label aLabel;
1906 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1907 if ( aLabel.IsNull() )
1908 {
1909 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1910 return 1;
1911 }
1912 Handle(XCAFDoc_Dimension) aDimension;
1913 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1914 {
1915 for(Standard_Integer i = 3; i < argc; i++)
1916 {
1917 if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 24)
1918 {
1919 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
1920 anObj->AddModifier((XCAFDimTolObjects_DimensionModif)Draw::Atoi(argv[i]));
1921 aDimension->SetObject(anObj);
1922 }
1923 }
1924 }
1925 return 0;
1926}
1927
1928static Standard_Integer getDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1929{
1930 if (argc < 3) {
586db386 1931 di<<"Use: XGetDimensionModifiers Doc Dim_Label\n";
9ebaae37 1932 return 1;
1933 }
1934 Handle(TDocStd_Document) Doc;
1935 DDocStd::GetDocument(argv[1], Doc);
586db386 1936 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1937 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1938 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1939
1940 TDF_Label aLabel;
1941 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
1942 if ( aLabel.IsNull() )
1943 {
1944 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
1945 return 1;
1946 }
1947 Handle(XCAFDoc_Dimension) aDimension;
1948 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
1949 {
1950 XCAFDimTolObjects_DimensionModifiersSequence aS = aDimension->GetObject()->GetModifiers();
1951 for(Standard_Integer i = 1; i <= aS.Length(); i++)
1952 {
1953 if (i > 1) di<<", ";
1954 switch(aS.Value(i)){
1955 case 0 : di<<"ControlledRadius"; break;
1956 case 1 : di<<"Square"; break;
1957 case 2 : di<<"StatisticalTolerance"; break;
1958 case 3 : di<<"ContinuousFeature"; break;
1959 case 4 : di<<"TwoPointSize"; break;
1960 case 5 : di<<"LocalSizeDefinedBySphere"; break;
1961 case 6 : di<<"LeastSquaresAssociationCriterion"; break;
1962 case 7 : di<<"MaximumInscribedAssociation"; break;
1963 case 8 : di<<"MinimumCircumscribedAssociation"; break;
1964 case 9 : di<<"CircumferenceDiameter"; break;
1965 case 10 : di<<"AreaDiameter"; break;
1966 case 11 : di<<"VolumeDiameter"; break;
1967 case 12 : di<<"MaximumSize"; break;
1968 case 13 : di<<"MinimumSize"; break;
1969 case 14 : di<<"AverageSize"; break;
1970 case 15 : di<<"MedianSize"; break;
1971 case 16 : di<<"MidRangeSize"; break;
1972 case 17 : di<<"RangeOfSizes"; break;
1973 case 18 : di<<"AnyRestrictedPortionOfFeature"; break;
1974 case 19 : di<<"AnyCrossSection"; break;
1975 case 20 : di<<"SpecificFixedCrossSection"; break;
1976 case 21 : di<<"CommonTolerance"; break;
1977 case 22 : di<<"FreeStateCondition"; break;
1978 case 23 : di<<"Between"; break;
1979 default : break;
1980 }
1981 }
1982 }
1983 return 0;
1984}
1985
1986static Standard_Integer addDimPath (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1987{
1988 if (argc < 4) {
586db386 1989 di<<"Use: XSetDimensionPath Doc Dim_Label path(edge)\n";
9ebaae37 1990 return 1;
1991 }
1992 Handle(TDocStd_Document) Doc;
1993 DDocStd::GetDocument(argv[1], Doc);
586db386 1994 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 1995 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
1996 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
1997
1998 TDF_Label aLabel;
1999 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
2000 if ( aLabel.IsNull() )
2001 {
2002 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
2003 return 1;
2004 }
2005 Handle(XCAFDoc_Dimension) aDimension;
2006 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
2007 {
2008 TopoDS_Edge aE = TopoDS::Edge(DBRep::Get(argv[3],TopAbs_EDGE));
2009 if(!aE.IsNull())
2010 {
2011 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
2012 anObj->SetPath(aE);
2013 aDimension->SetObject(anObj);
2014 }
2015 }
2016 return 0;
2017}
2018
2019static Standard_Integer addDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2020{
2021 if (argc < 5) {
586db386 2022 di<<"Use: XSetDimensionPoints Doc Dim_Label v1 v2\n";
9ebaae37 2023 return 1;
2024 }
2025 Handle(TDocStd_Document) Doc;
2026 DDocStd::GetDocument(argv[1], Doc);
586db386 2027 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 2028 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
2029 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
2030
2031 TDF_Label aLabel;
2032 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
2033 if ( aLabel.IsNull() )
2034 {
2035 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
2036 return 1;
2037 }
2038 Handle(XCAFDoc_Dimension) aDimension;
2039 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
2040 {
2041 TopoDS_Vertex aV1 = TopoDS::Vertex(DBRep::Get(argv[3],TopAbs_VERTEX));
2042 TopoDS_Vertex aV2 = TopoDS::Vertex(DBRep::Get(argv[4],TopAbs_VERTEX));
2043 if(!aV1.IsNull() && !aV1.IsNull())
2044 {
2045 Handle(TColgp_HArray1OfPnt) arr = new TColgp_HArray1OfPnt(1,2);
2046 arr->SetValue(1, BRep_Tool::Pnt(aV1));
2047 arr->SetValue(2, BRep_Tool::Pnt(aV2));
2048 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
2049 anObj->SetPoints(arr);
2050 aDimension->SetObject(anObj);
2051 }
2052 }
2053 return 0;
2054}
2055
2056static Standard_Integer getDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2057{
2058 if (argc < 3) {
586db386 2059 di<<"Use: XGetDimensionPoints Doc Dim_Label\n";
9ebaae37 2060 return 1;
2061 }
2062 Handle(TDocStd_Document) Doc;
2063 DDocStd::GetDocument(argv[1], Doc);
586db386 2064 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 2065 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
2066 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
2067
2068 TDF_Label aLabel;
2069 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
2070 if ( aLabel.IsNull() )
2071 {
2072 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
2073 return 1;
2074 }
2075 Handle(XCAFDoc_Dimension) aDimension;
2076 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
2077 {
2078 Handle(TColgp_HArray1OfPnt) pnts = aDimension->GetObject()->GetPoints();
2079 if(!pnts.IsNull() && pnts->Length() == 2)
2080 {
2081 di << pnts->Value(1).X() << ";" << pnts->Value(1).Y() << ";" << pnts->Value(1).Z() << " ";
2082 di << pnts->Value(2).X() << ";" << pnts->Value(2).Y() << ";" << pnts->Value(2).Z();
2083 }
2084 }
2085 return 0;
2086}
2087
2088static Standard_Integer addDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2089{
2090 if (argc < 6) {
586db386 2091 di<<"Use: XSetDimensionDir Doc Dim_Label x y z\n";
9ebaae37 2092 return 1;
2093 }
2094 Handle(TDocStd_Document) Doc;
2095 DDocStd::GetDocument(argv[1], Doc);
586db386 2096 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 2097 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
2098 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
2099
2100 TDF_Label aLabel;
2101 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
2102 if ( aLabel.IsNull() )
2103 {
2104 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
2105 return 1;
2106 }
2107 Handle(XCAFDoc_Dimension) aDimension;
2108 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
2109 {
2110 Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
2111 anObj->SetDirection(gp_Dir(Draw::Atof(argv[3]),Draw::Atof(argv[4]),Draw::Atof(argv[5])));
2112 aDimension->SetObject(anObj);
2113 }
2114 return 0;
2115}
2116
2117static Standard_Integer getDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2118{
2119 if (argc < 3) {
586db386 2120 di<<"Use: XSetDimensionDir Doc Dim_Label\n";
9ebaae37 2121 return 1;
2122 }
2123 Handle(TDocStd_Document) Doc;
2124 DDocStd::GetDocument(argv[1], Doc);
586db386 2125 if ( Doc.IsNull() ) { di << argv[1] << " is not a document\n"; return 1; }
9ebaae37 2126 Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
2127 Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
2128
2129 TDF_Label aLabel;
2130 TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
2131 if ( aLabel.IsNull() )
2132 {
2133 di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
2134 return 1;
2135 }
2136 Handle(XCAFDoc_Dimension) aDimension;
2137 if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
2138 {
2139 gp_Dir dir;
2140 if(aDimension->GetObject()->GetDirection(dir))
2141 {
2142 di << dir.X()<< ";"<< dir.Y()<< ";"<<dir.Z();
2143 }
2144 }
2145 return 0;
2146}
2147
2148//=======================================================================
2149//function : InitCommands
2150//purpose :
2151//=======================================================================
2152
2153void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di)
2154{
2155
2156 static Standard_Boolean initactor = Standard_False;
2157 if (initactor) return; initactor = Standard_True;
2158
2159
2160 Standard_CString g = "XDE G&DTs commands";
2161
2162 di.Add ("XDumpDGTs","XDumpDGTs Doc shape/label/all ",
2163 __FILE__, DumpDGTs, g);
2164
6595eee7 2165 di.Add ("XDumpNbDGTs","XDumpNbDGTs Doc [f (full dumping)]",
1c9d3225 2166 __FILE__, DumpNbDGTs, g);
2167
9ebaae37 2168 di.Add ("XAddDimension","XAddDimension Doc shape/label [shape/label]",
2169 __FILE__, addDim, g);
2170
2171 di.Add ("XAddGeomTolerance","XAddGeomTolerance Doc shape/label",
2172 __FILE__, addGTol, g);
2173
2174 di.Add ("XAddDatum","XAddDatum Doc shape/label",
2175 __FILE__, addDatum, g);
2176
2177 di.Add ("XSetDatum","XSetDatum Doc Datum_Label GeomTol_Label",
2178 __FILE__, setDatum, g);
2179
2180 di.Add ("XGetDatum","XGetDatum Doc GeomTol_Label/Shape_Label",
2181 __FILE__, getDatum, g);
2182
2183 di.Add ("XAddDatumModifier","XAddDatumModifier Doc Datum_Label mod1 mod2 ...\n"
2184 "Values:"
2185 "\n 0 AnyCrossSection"
2186 "\n 1 Any_LongitudinalSection"
2187 "\n 2 Basic"
2188 "\n 3 ContactingFeature"
2189 "\n 4 DegreeOfFreedomConstraintU"
2190 "\n 5 DegreeOfFreedomConstraintV"
2191 "\n 6 DegreeOfFreedomConstraintW"
2192 "\n 7 DegreeOfFreedomConstraintX"
2193 "\n 8 DegreeOfFreedomConstraintY"
2194 "\n 9 DegreeOfFreedomConstraintZ"
2195 "\n 10 DistanceVariable"
2196 "\n 11 FreeState"
2197 "\n 12 LeastMaterialRequirement"
2198 "\n 13 Line"
2199 "\n 14 MajorDiameter"
2200 "\n 15 MaximumMaterialRequirement"
2201 "\n 16 MinorDiameter"
2202 "\n 17 Orientation"
2203 "\n 18 PitchDiameter"
2204 "\n 19 Plane"
2205 "\n 20 Point"
2206 "\n 21 Translation",
2207 __FILE__, addDatumModif, g);
2208
2209 di.Add ("XGetDatumModifiers","XGetDatumModifiers Doc Datum_Label",
2210 __FILE__, getDatumModif, g);
2211
2212 di.Add ("XSetDatumName","XSetDatumName Doc Datum_Label name",
2213 __FILE__, setDatumName, g);
2214
2215 di.Add ("XGetDatumName","XGetDatumName Doc Datum_Label",
2216 __FILE__, getDatumName, g);
2217
2218 di.Add ("XSetTypeOfTolerance","XSetTypeOfTolerance Doc GTol_Label type"
2219 "Values:\n"
2220 "\t 0 type is absent\n"
2221 "\t 1 Angularity\n"
2222 "\t 2 CircularRunout\n"
2223 "\t 3 CircularityOrRoundness\n"
2224 "\t 4 Coaxiality\n"
2225 "\t 5 Concentricity\n"
2226 "\t 6 Cylindricity\n"
2227 "\t 7 Flatness\n"
2228 "\t 8 Parallelism\n"
2229 "\t 9 Perpendicularity\n"
2230 "\t 10 Position\n"
2231 "\t 11 ProfileOfLine\n"
2232 "\t 12 ProfileOfSurface\n"
2233 "\t 13 Straightness\n"
2234 "\t 14 Symmetry\n"
2235 "\t 15 TotalRunout\n",
2236 __FILE__, setTypeOfTol, g);
2237
2238 di.Add ("XGetTypeOfTolerance","XGetTypeOfTolerance Doc GTol_Label",
2239 __FILE__, getTypeOfTol, g);
2240
2241 di.Add ("XSetTypeOfToleranceValue","XSetTypeOfToleranceValue Doc GTol_Label type"
2242 "Values:"
2243 "\n 0 none"
2244 "\n 1 Diameter"
2245 "\n 2 SphericalDiameter",
2246 __FILE__, setTypeOfTolVal, g);
2247
2248 di.Add ("XGetTypeOfToleranceValue","XGetTypeOfToleranceValue Doc GTol_Label",
2249 __FILE__, getTypeOfTolVal, g);
2250
2251 di.Add ("XSetToleranceValue","XSetToleranceValue Doc GTol_Label value",
2252 __FILE__, setTolVal, g);
2253
2254 di.Add ("XGetToleranceValue","XGetToleranceValue Doc GTol_Label",
2255 __FILE__, getTolVal, g);
2256
2257 di.Add ("XSetTolMaterialReq","XSetTolMaterialReq Doc GTol_Label mod"
2258 "Values:"
2259 "\n 0 none"
2260 "\n 1 M"
2261 "\n 2 L",
2262 __FILE__, setMatReq, g);
2263
2264 di.Add ("XGetTolMaterialReq","XGetTolMaterialReq Doc GTol_Label",
2265 __FILE__, getMatReq, g);
2266
2267 di.Add ("XSetTolZoneMod","XSetTolZoneMod Doc GTol_Label mod"
2268 "Values:"
2269 "\n 0 none"
2270 "\n 1 P"
2271 "\n 2 NonUniform",
2272 __FILE__, setZoneMod, g);
2273
2274 di.Add ("XGetTolZoneMod","XGetTolZoneMod Doc GTol_Label",
2275 __FILE__, getZoneMod, g);
2276
2277 di.Add ("XSetTolZoneModValue","XSetTolZoneModValue Doc GTol_Label val",
2278 __FILE__, setZoneModVal, g);
2279
2280 di.Add ("XGetTolZoneModValue","XGetTolZoneModValue Doc GTol_Label",
2281 __FILE__, getZoneModVal, g);
2282
2283 di.Add ("XAddTolModifier","XAddTolModifier Doc Tol_Label mod1 mod2 ..."
2284 "Values:\n"
2285 "\t 0 Any_Cross_Section\n"
2286 "\t 1 Common_Zone\n"
2287 "\t 2 Each_Radial_Element\n"
2288 "\t 3 Free_State\n"
2289 "\t 4 Least_Material_Requirement\n"
2290 "\t 5 Line_Element\n"
2291 "\t 6 Major_Diameter\n"
2292 "\t 7 Maximum_Material_Requirement\n"
2293 "\t 8 Minor_Diameter\n"
2294 "\t 9 Not_Convex\n"
2295 "\t 10 Pitch_Diameter\n"
2296 "\t 11 Reciprocity_Requirement\n"
2297 "\t 12 Separate_Requirement\n"
2298 "\t 13 Statistical_Tolerance\n"
2299 "\t 14 Tangent_Plane\n",
2300 __FILE__, addTolModif, g);
2301
2302 di.Add ("XGetTolModifier","XGetTolModifier Doc Tol_Label",
2303 __FILE__, getTolModif, g);
2304
2305 di.Add ("XSetTolMaxValue","XSetTolMaxValue Doc Dim_Label val",
2306 __FILE__, setTolMaxVal, g);
2307
2308 di.Add ("XGetTolMaxValue","XGetTolMaxValue Doc Dim_Label val",
2309 __FILE__, getTolMaxVal, g);
2310
2311 di.Add ("XSetDimensionType","XSetDimensionType Doc Dim_Label type"
2312 "Values:"
2313 "\t 0 type is absent\n"
2314 "\t 1 Location_CurvedDistance\n"
2315 "\t 2 Location_LinearDistance\n"
2316 "\t 3 Location_LinearDistance_FromCenterToOuter\n"
2317 "\t 4 Location_LinearDistance_FromCenterToInner\n"
2318 "\t 5 Location_LinearDistance_FromOuterToCenter\n"
2319 "\t 6 Location_LinearDistance_FromOuterToOuter\n"
2320 "\t 7 Location_LinearDistance_FromOuterToInner\n"
2321 "\t 8 Location_LinearDistance_FromInnerToCenter\n"
2322 "\t 9 Location_LinearDistance_FromInnerToOuter\n"
2323 "\t 10 Location_LinearDistance_FromInnerToInner\n"
2324 "\t 11 Location_Angular\n"
2325 "\t 12 Location_Oriented\n"
2326 "\t 13 Location_WithPath\n"
2327 "\t 14 Size_CurveLength\n"
2328 "\t 15 Size_Diameter\n"
2329 "\t 16 Size_SphericalDiameter\n"
2330 "\t 17 Size_Radius\n"
2331 "\t 18 Size_SphericalRadius\n"
2332 "\t 19 Size_ToroidalMinorDiameter\n"
2333 "\t 20 Size_ToroidalMajorDiameter\n"
2334 "\t 21 Size_ToroidalMinorRadius\n"
2335 "\t 22 Size_ToroidalMajorRadius\n"
2336 "\t 23 Size_ToroidalHighMajorDiameter\n"
2337 "\t 24 Size_ToroidalLowMajorDiameter\n"
2338 "\t 25 Size_ToroidalHighMajorRadius\n"
2339 "\t 26 Size_ToroidalLowMajorRadius\n"
2340 "\t 27 Size_Thickness\n"
2341 "\t 28 Size_Angular\n"
2342 "\t 29 Size_WithPath\n",
2343 __FILE__, setDimType, g);
2344
2345 di.Add ("XGetDimensionType","XGetDimensionType Doc Dim_Label",
2346 __FILE__, getDimType, g);
2347
2348 di.Add ("XSetDimensionValue","XSetDimensionValue Doc Dim_Label val",
2349 __FILE__, setDimVal, g);
2350
2351 di.Add ("XGetDimensionValue","XGetDimensionValue Doc Dim_Label",
2352 __FILE__, getDimVal, g);
2353
2354 di.Add ("XSetDimensionQualifier","XSetDimensionQualifier Doc Dim_Label val"
2355 "Values:"
2356 "\n 0 none"
2357 "\n 1 Min"
2358 "\n 2 Max"
2359 "\n 3 Avg",
2360 __FILE__, setDimQalif, g);
2361
2362 di.Add ("XGetDimensionQualifier","XGetDimensionQualifier Doc Dim_Label",
2363 __FILE__, getDimQalif, g);
2364
2365 di.Add ("XSetDimensionRange","XSetDimensionRange Doc Dim_Label low_val up_val",
2366 __FILE__, setDimRange, g);
2367
2368 di.Add ("XGetDimensionRange","XGetDimensionRange Doc Dim_Label",
2369 __FILE__, getDimRange, g);
2370
2371 di.Add ("XSetDimensionPlusMinusTol","XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val",
2372 __FILE__, setDimPlusMinusTol, g);
2373
2374 di.Add ("XGetDimensionPlusMinusTol","XGetDimensionPlusMinusTol Doc Dim_Label",
2375 __FILE__, getDimPlusMinusTol, g);
2376
2377 di.Add ("XSetDimensionClassOfTol","XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade"
2378 "Values of formVar:"
2379 "\t 1 a\n"
2380 "\t 2 b\n"
2381 "\t 3 c\n"
2382 "\t 4 cd\n"
2383 "\t 5 d\n"
2384 "\t 6 e\n"
2385 "\t 7 ef\n"
2386 "\t 8 f\n"
2387 "\t 9 fg\n"
2388 "\t10 g\n"
2389 "\t11 h\n"
2390 "\t12 js\n"
2391 "\t13 j\n"
2392 "\t14 k\n"
2393 "\t15 m\n"
2394 "\t16 n\n"
2395 "\t17 p\n"
2396 "\t18 r\n"
2397 "\t19 s\n"
2398 "\t20 t\n"
2399 "\t21 u\n"
2400 "\t22 v\n"
2401 "\t23 x\n"
2402 "\t24 y\n"
2403 "\t25 z\n"
2404 "\t26 za\n"
2405 "\t27 zb\n"
2406 "\t28 zc\n\n"
2407 "Values of grade:"
2408 "\t 0 01\n"
2409 "\t 1 0\n"
2410 "\t 2 1\n"
2411 "\t 3 2d\n"
2412 "\t 4 3\n"
2413 "\t 5 4\n"
2414 "\t 6 5f\n"
2415 "\t 7 76\n"
2416 "\t 8 7g\n"
2417 "\t 9 8\n"
2418 "\t10 9\n"
2419 "\t11 10js\n"
2420 "\t12 11j\n"
2421 "\t13 12k\n"
2422 "\t14 13m\n"
2423 "\t15 14n\n"
2424 "\t16 15p\n"
2425 "\t17 16r\n"
2426 "\t18 17s\n"
2427 "\t19 18t\n",
2428 __FILE__, setDimClassTol, g);
2429
2430 di.Add ("XGetDimensionClassOfTol","XGetDimensionClassOfTol Doc Dim_Label",
2431 __FILE__, getDimClassTol, g);
2432
2433 di.Add ("XSetDimensionNbOfDecimalPlaces","XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val",
2434 __FILE__, setDimNbOfDecimalPlaces, g);
2435
2436 di.Add ("XGetDimensionNbOfDecimalPlaces","XGetDimensionNbOfDecimalPlaces Doc Dim_Label",
2437 __FILE__, getDimNbOfDecimalPlaces, g);
2438
2439 di.Add ("XAddDimensionModifiers","XAddDimensionModifiers Doc Dim_Label mod1 mod2 ..."
2440 "Values:"
2441 "\t 0 ControlledRadius\n"
2442 "\t 1 Square\n"
2443 "\t 2 StatisticalTolerance\n"
2444 "\t 3 ContinuousFeature\n"
2445 "\t 4 TwoPointSize\n"
2446 "\t 5 LocalSizeDefinedBySphere\n"
2447 "\t 6 LeastSquaresAssociationCriterion\n"
2448 "\t 7 MaximumInscribedAssociation\n"
2449 "\t 8 MinimumCircumscribedAssociation\n"
2450 "\t 9 CircumferenceDiameter\n"
2451 "\t10 AreaDiameter\n"
2452 "\t11 VolumeDiameter\n"
2453 "\t12 MaximumSize\n"
2454 "\t13 MinimumSize\n"
2455 "\t14 AverageSize\n"
2456 "\t15 MedianSize\n"
2457 "\t16 MidRangeSize\n"
2458 "\t17 RangeOfSizes\n"
2459 "\t18 AnyRestrictedPortionOfFeature\n"
2460 "\t19 AnyCrossSection\n"
2461 "\t20 SpecificFixedCrossSection\n"
2462 "\t21 CommonTolerance\n"
2463 "\t22 FreeStateCondition\n"
2464 "\t23 Between\n",
2465 __FILE__, addDimModifier, g);
2466
2467 di.Add ("XGetDimensionModifiers","XGetDimensionModifiers Doc Dim_Label",
2468 __FILE__, getDimModifier, g);
2469
2470 di.Add ("XSetDimensionPath","XSetDimensionPath Doc Dim_Label path(edge)",
2471 __FILE__, addDimPath, g);
2472
2473 di.Add ("XSetDimensionPoints","XSetDimensionPoints Doc Dim_Label v1 v2",
2474 __FILE__, addDimPoints, g);
2475
2476 di.Add ("XGetDimensionPoints","XGetDimensionPoints Doc Dim_Label",
2477 __FILE__, getDimPoints, g);
2478
2479 di.Add ("XSetDimensionDir","XSetDimensionDir Doc Dim_Label x y z",
2480 __FILE__, addDimDir, g);
2481
2482 di.Add ("XGetDimensionDir","XGetDimensionDir Doc Dim_Label",
2483 __FILE__, getDimDir, g);
2484}