1 // Created on: 1999-09-09
2 // Created by: Andrey BETENEV
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <STEPConstruct_GDTProperty.hxx>
18 #include <StepBasic_MeasureValueMember.hxx>
19 #include <StepGeom_CartesianPoint.hxx>
20 #include <StepGeom_Direction.hxx>
21 #include <StepDimTol_CylindricityTolerance.hxx>
22 #include <StepDimTol_FlatnessTolerance.hxx>
23 #include <StepDimTol_LineProfileTolerance.hxx>
24 #include <StepDimTol_PositionTolerance.hxx>
25 #include <StepDimTol_RoundnessTolerance.hxx>
26 #include <StepDimTol_StraightnessTolerance.hxx>
27 #include <StepDimTol_SurfaceProfileTolerance.hxx>
28 #include <StepRepr_DescriptiveRepresentationItem.hxx>
29 #include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
30 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
32 //=======================================================================
33 //function : STEPConstruct_GDTProperty
35 //=======================================================================
37 STEPConstruct_GDTProperty::STEPConstruct_GDTProperty ()
41 //=======================================================================
42 //function : getDimModifiers
44 //=======================================================================
45 void STEPConstruct_GDTProperty::GetDimModifiers(const Handle(StepRepr_CompoundRepresentationItem)& theCRI,
46 XCAFDimTolObjects_DimensionModifiersSequence& theModifiers)
48 for (Standard_Integer l = 1; l <= theCRI->ItemElement()->Length(); l++)
50 Handle(StepRepr_DescriptiveRepresentationItem) aDRI =
51 Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(theCRI->ItemElement()->Value(l));
52 if(aDRI.IsNull()) continue;
53 XCAFDimTolObjects_DimensionModif aModifier = XCAFDimTolObjects_DimensionModif_ControlledRadius;
54 const TCollection_AsciiString aModifStr = aDRI->Description()->String();
55 Standard_Boolean aFound = Standard_False;
56 if(aModifStr.IsEqual("controlled radius"))
58 aFound = Standard_True;
59 aModifier = XCAFDimTolObjects_DimensionModif_ControlledRadius;
61 else if(aModifStr.IsEqual("square"))
63 aFound = Standard_True;
64 aModifier = XCAFDimTolObjects_DimensionModif_Square;
66 else if(aModifStr.IsEqual("statistical"))
68 aFound = Standard_True;
69 aModifier = XCAFDimTolObjects_DimensionModif_StatisticalTolerance;
71 else if(aModifStr.IsEqual("continuous feature"))
73 aFound = Standard_True;
74 aModifier = XCAFDimTolObjects_DimensionModif_ContinuousFeature;
76 else if(aModifStr.IsEqual("two point size"))
78 aFound = Standard_True;
79 aModifier = XCAFDimTolObjects_DimensionModif_TwoPointSize;
81 else if(aModifStr.IsEqual("local size defined by a sphere"))
83 aFound = Standard_True;
84 aModifier = XCAFDimTolObjects_DimensionModif_LocalSizeDefinedBySphere;
86 else if(aModifStr.IsEqual("least squares association criteria"))
88 aFound = Standard_True;
89 aModifier = XCAFDimTolObjects_DimensionModif_LeastSquaresAssociationCriterion;
91 else if(aModifStr.IsEqual("maximum inscribed association criteria"))
93 aFound = Standard_True;
94 aModifier = XCAFDimTolObjects_DimensionModif_MaximumInscribedAssociation;
96 else if(aModifStr.IsEqual("minimum circumscribed association criteria"))
98 aFound = Standard_True;
99 aModifier = XCAFDimTolObjects_DimensionModif_MinimumCircumscribedAssociation;
101 else if(aModifStr.IsEqual("circumference diameter calculated size"))
103 aFound = Standard_True;
104 aModifier = XCAFDimTolObjects_DimensionModif_CircumferenceDiameter;
106 else if(aModifStr.IsEqual("area diameter calculated size"))
108 aFound = Standard_True;
109 aModifier = XCAFDimTolObjects_DimensionModif_AreaDiameter;
111 else if(aModifStr.IsEqual("volume diameter calculated size"))
113 aFound = Standard_True;
114 aModifier = XCAFDimTolObjects_DimensionModif_VolumeDiameter;
116 else if(aModifStr.IsEqual("maximum rank order size"))
118 aFound = Standard_True;
119 aModifier = XCAFDimTolObjects_DimensionModif_MaximumSize;
121 else if(aModifStr.IsEqual("minimum rank order size"))
123 aFound = Standard_True;
124 aModifier = XCAFDimTolObjects_DimensionModif_MinimumSize;
126 else if(aModifStr.IsEqual("average rank order size"))
128 aFound = Standard_True;
129 aModifier = XCAFDimTolObjects_DimensionModif_AverageSize;
131 else if(aModifStr.IsEqual("median rank order size"))
133 aFound = Standard_True;
134 aModifier = XCAFDimTolObjects_DimensionModif_MedianSize;
136 else if(aModifStr.IsEqual("mid range rank order size"))
138 aFound = Standard_True;
139 aModifier = XCAFDimTolObjects_DimensionModif_MidRangeSize;
141 else if(aModifStr.IsEqual("range rank order size"))
143 aFound = Standard_True;
144 aModifier = XCAFDimTolObjects_DimensionModif_RangeOfSizes;
146 else if(aModifStr.IsEqual("any part of the feature"))
148 aFound = Standard_True;
149 aModifier = XCAFDimTolObjects_DimensionModif_AnyRestrictedPortionOfFeature;
151 else if(aModifStr.IsEqual("any cross section"))
153 aFound = Standard_True;
154 aModifier = XCAFDimTolObjects_DimensionModif_AnyCrossSection;
156 else if(aModifStr.IsEqual("specific fixed cross section"))
158 aFound = Standard_True;
159 aModifier = XCAFDimTolObjects_DimensionModif_SpecificFixedCrossSection;
161 else if(aModifStr.IsEqual("common tolerance"))
163 aFound = Standard_True;
164 aModifier = XCAFDimTolObjects_DimensionModif_CommonTolerance;
166 else if(aModifStr.IsEqual("free state condition"))
168 aFound = Standard_True;
169 aModifier = XCAFDimTolObjects_DimensionModif_FreeStateCondition;
172 theModifiers.Append(aModifier);
176 //=======================================================================
177 //function : getClassOfTolerance
179 //=======================================================================
180 void STEPConstruct_GDTProperty::GetDimClassOfTolerance(const Handle(StepShape_LimitsAndFits)& theLAF,
181 Standard_Boolean& theHolle,
182 XCAFDimTolObjects_DimensionFormVariance& theFV,
183 XCAFDimTolObjects_DimensionGrade& theG)
185 Handle(TCollection_HAsciiString) aFormV = theLAF->FormVariance();
186 Handle(TCollection_HAsciiString) aGrade = theLAF->Grade();
187 theFV = XCAFDimTolObjects_DimensionFormVariance_None;
188 Standard_Boolean aFound;
189 theHolle = Standard_False;
190 //it is not verified information
191 for(Standard_Integer c = 0; c <= 1; c++)
193 aFound = Standard_False;
194 Standard_Boolean aCaseSens = Standard_False;
196 aCaseSens = Standard_True;
197 Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString("a");
198 if(aFormV->IsSameString(aStr, aCaseSens))
200 aFound = Standard_True;
201 theFV = XCAFDimTolObjects_DimensionFormVariance_A;
204 aStr = new TCollection_HAsciiString("b");
205 if(aFormV->IsSameString(aStr, aCaseSens))
207 aFound = Standard_True;
208 theFV = XCAFDimTolObjects_DimensionFormVariance_B;
211 aStr = new TCollection_HAsciiString("c");
212 if(aFormV->IsSameString(aStr, aCaseSens))
214 aFound = Standard_True;
215 theFV = XCAFDimTolObjects_DimensionFormVariance_C;
218 aStr = new TCollection_HAsciiString("cd");
219 if(aFormV->IsSameString(aStr, aCaseSens))
221 aFound = Standard_True;
222 theFV = XCAFDimTolObjects_DimensionFormVariance_CD;
225 aStr = new TCollection_HAsciiString("d");
226 if(aFormV->IsSameString(aStr, aCaseSens))
228 aFound = Standard_True;
229 theFV = XCAFDimTolObjects_DimensionFormVariance_D;
232 aStr = new TCollection_HAsciiString("e");
233 if(aFormV->IsSameString(aStr, aCaseSens))
235 aFound = Standard_True;
236 theFV = XCAFDimTolObjects_DimensionFormVariance_E;
239 aStr = new TCollection_HAsciiString("ef");
240 if(aFormV->IsSameString(aStr, aCaseSens))
242 aFound = Standard_True;
243 theFV = XCAFDimTolObjects_DimensionFormVariance_EF;
246 aStr = new TCollection_HAsciiString("f");
247 if(aFormV->IsSameString(aStr, aCaseSens))
249 aFound = Standard_True;
250 theFV = XCAFDimTolObjects_DimensionFormVariance_F;
253 aStr = new TCollection_HAsciiString("fg");
254 if(aFormV->IsSameString(aStr, aCaseSens))
256 aFound = Standard_True;
257 theFV = XCAFDimTolObjects_DimensionFormVariance_FG;
260 aStr = new TCollection_HAsciiString("g");
261 if(aFormV->IsSameString(aStr, aCaseSens))
263 aFound = Standard_True;
264 theFV = XCAFDimTolObjects_DimensionFormVariance_G;
267 aStr = new TCollection_HAsciiString("h");
268 if(aFormV->IsSameString(aStr, aCaseSens))
270 aFound = Standard_True;
271 theFV = XCAFDimTolObjects_DimensionFormVariance_H;
274 aStr = new TCollection_HAsciiString("js");
275 if(aFormV->IsSameString(aStr, aCaseSens))
277 aFound = Standard_True;
278 theFV = XCAFDimTolObjects_DimensionFormVariance_JS;
281 aStr = new TCollection_HAsciiString("k");
282 if(aFormV->IsSameString(aStr, aCaseSens))
284 aFound = Standard_True;
285 theFV = XCAFDimTolObjects_DimensionFormVariance_K;
288 aStr = new TCollection_HAsciiString("m");
289 if(aFormV->IsSameString(aStr, aCaseSens))
291 aFound = Standard_True;
292 theFV = XCAFDimTolObjects_DimensionFormVariance_M;
295 aStr = new TCollection_HAsciiString("n");
296 if(aFormV->IsSameString(aStr, aCaseSens))
298 aFound = Standard_True;
299 theFV = XCAFDimTolObjects_DimensionFormVariance_N;
302 aStr = new TCollection_HAsciiString("p");
303 if(aFormV->IsSameString(aStr, aCaseSens))
305 aFound = Standard_True;
306 theFV = XCAFDimTolObjects_DimensionFormVariance_P;
309 aStr = new TCollection_HAsciiString("r");
310 if(aFormV->IsSameString(aStr, aCaseSens))
312 aFound = Standard_True;
313 theFV = XCAFDimTolObjects_DimensionFormVariance_R;
316 aStr = new TCollection_HAsciiString("s");
317 if(aFormV->IsSameString(aStr, aCaseSens))
319 aFound = Standard_True;
320 theFV = XCAFDimTolObjects_DimensionFormVariance_S;
323 aStr = new TCollection_HAsciiString("t");
324 if(aFormV->IsSameString(aStr, aCaseSens))
326 aFound = Standard_True;
327 theFV = XCAFDimTolObjects_DimensionFormVariance_T;
330 aStr = new TCollection_HAsciiString("u");
331 if(aFormV->IsSameString(aStr, aCaseSens))
333 aFound = Standard_True;
334 theFV = XCAFDimTolObjects_DimensionFormVariance_U;
337 aStr = new TCollection_HAsciiString("v");
338 if(aFormV->IsSameString(aStr, aCaseSens))
340 aFound = Standard_True;
341 theFV = XCAFDimTolObjects_DimensionFormVariance_V;
344 aStr = new TCollection_HAsciiString("x");
345 if(aFormV->IsSameString(aStr, aCaseSens))
347 aFound = Standard_True;
348 theFV = XCAFDimTolObjects_DimensionFormVariance_X;
351 aStr = new TCollection_HAsciiString("y");
352 if(aFormV->IsSameString(aStr, aCaseSens))
354 aFound = Standard_True;
355 theFV = XCAFDimTolObjects_DimensionFormVariance_Y;
358 aStr = new TCollection_HAsciiString("b");
359 if(aFormV->IsSameString(aStr, aCaseSens))
361 aFound = Standard_True;
362 theFV = XCAFDimTolObjects_DimensionFormVariance_B;
365 aStr = new TCollection_HAsciiString("z");
366 if(aFormV->IsSameString(aStr, aCaseSens))
368 aFound = Standard_True;
369 theFV = XCAFDimTolObjects_DimensionFormVariance_Z;
372 aStr = new TCollection_HAsciiString("za");
373 if(aFormV->IsSameString(aStr, aCaseSens))
375 aFound = Standard_True;
376 theFV = XCAFDimTolObjects_DimensionFormVariance_ZA;
379 aStr = new TCollection_HAsciiString("zb");
380 if(aFormV->IsSameString(aStr, aCaseSens))
382 aFound = Standard_True;
383 theFV = XCAFDimTolObjects_DimensionFormVariance_ZB;
386 aStr = new TCollection_HAsciiString("zc");
387 if(aFormV->IsSameString(aStr, aCaseSens))
389 aFound = Standard_True;
390 theFV = XCAFDimTolObjects_DimensionFormVariance_ZC;
394 if (c == 1 && !aFound)
395 theHolle = Standard_True;
397 Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString("01");
398 if(aGrade->IsSameString(aStr))
400 theG = XCAFDimTolObjects_DimensionGrade_IT01;
404 theG = (XCAFDimTolObjects_DimensionGrade)(aGrade->IntegerValue()+1);
408 //=======================================================================
409 //function : getDimType
411 //=======================================================================
412 Standard_Boolean STEPConstruct_GDTProperty::GetDimType(const Handle(TCollection_HAsciiString)& theName,
413 XCAFDimTolObjects_DimensionType& theType)
415 TCollection_AsciiString aName = theName->String();
417 theType = XCAFDimTolObjects_DimensionType_Location_None;
418 if(aName.IsEqual("curve length"))
420 theType = XCAFDimTolObjects_DimensionType_Size_CurveLength;
422 else if(aName.IsEqual("diameter"))
424 theType = XCAFDimTolObjects_DimensionType_Size_Diameter;
426 else if(aName.IsEqual("spherical diameter"))
428 theType = XCAFDimTolObjects_DimensionType_Size_SphericalDiameter;
430 else if(aName.IsEqual("radius"))
432 theType = XCAFDimTolObjects_DimensionType_Size_Radius;
434 else if(aName.IsEqual("spherical radius"))
436 theType = XCAFDimTolObjects_DimensionType_Size_SphericalRadius;
438 else if(aName.IsEqual("toroidal minor diameter"))
440 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter;
442 else if(aName.IsEqual("toroidal major diameter"))
444 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter;
446 else if(aName.IsEqual("toroidal minor radius"))
448 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius;
450 else if(aName.IsEqual("toroidal major radius"))
452 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius;
454 else if(aName.IsEqual("toroidal high major diameter"))
456 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter;
458 else if(aName.IsEqual("toroidal low major diameter"))
460 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter;
462 else if(aName.IsEqual("toroidal high major radius"))
464 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius;
466 else if(aName.IsEqual("toroidal low major radius"))
468 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius;
470 else if(aName.IsEqual("thickness"))
472 theType = XCAFDimTolObjects_DimensionType_Size_Thickness;
474 else if(aName.IsEqual("curved distance"))
476 theType = XCAFDimTolObjects_DimensionType_Location_CurvedDistance;
478 else if(aName.IsEqual("linear distance"))
480 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance;
482 else if(aName.IsEqual("linear distance centre outer"))
484 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter;
486 else if(aName.IsEqual("linear distance centre inner"))
488 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner;
490 else if(aName.IsEqual("linear distance outer centre"))
492 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter;
494 else if(aName.IsEqual("linear distance outer outer"))
496 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter;
498 else if(aName.IsEqual("linear distance outer inner"))
500 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner;
502 else if(aName.IsEqual("linear distance inner centre"))
504 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter;
506 else if(aName.IsEqual("linear distance inner outer"))
508 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter;
510 else if(aName.IsEqual("linear distance inner inner"))
512 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner;
515 if(theType != XCAFDimTolObjects_DimensionType_Location_None)
517 return Standard_True;
519 return Standard_False;
523 //=======================================================================
524 //function : DatumTargetType
526 //=======================================================================
527 Standard_Boolean STEPConstruct_GDTProperty::GetDatumTargetType(const Handle(TCollection_HAsciiString)& theDescription,
528 XCAFDimTolObjects_DatumTargetType& theType)
530 TCollection_AsciiString aName = theDescription->String();
532 if(aName.IsEqual("area"))
534 theType = XCAFDimTolObjects_DatumTargetType_Area;
535 return Standard_True;
537 else if(aName.IsEqual("line"))
539 theType = XCAFDimTolObjects_DatumTargetType_Line;
540 return Standard_True;
542 else if(aName.IsEqual("circle"))
544 theType = XCAFDimTolObjects_DatumTargetType_Circle;
545 return Standard_True;
547 else if(aName.IsEqual("rectangle"))
549 theType = XCAFDimTolObjects_DatumTargetType_Rectangle;
550 return Standard_True;
552 else if(aName.IsEqual("point"))
554 theType = XCAFDimTolObjects_DatumTargetType_Point;
555 return Standard_True;
557 return Standard_False;
560 //=======================================================================
561 //function : GetDimQualifierType
563 //=======================================================================
564 Standard_Boolean STEPConstruct_GDTProperty::GetDimQualifierType(const Handle(TCollection_HAsciiString)& theDescription,
565 XCAFDimTolObjects_DimensionQualifier& theType)
567 TCollection_AsciiString aName = theDescription->String();
569 theType = XCAFDimTolObjects_DimensionQualifier_None;
570 if(aName.IsEqual("maximum"))
572 theType = XCAFDimTolObjects_DimensionQualifier_Max;
574 else if(aName.IsEqual("minimum"))
576 theType = XCAFDimTolObjects_DimensionQualifier_Min;
578 else if(aName.IsEqual("average"))
580 theType = XCAFDimTolObjects_DimensionQualifier_Avg;
582 if(theType != XCAFDimTolObjects_DimensionQualifier_None)
584 return Standard_True;
586 return Standard_False;
589 //=======================================================================
590 //function : GetTolValueType
592 //=======================================================================
593 Standard_Boolean STEPConstruct_GDTProperty::GetTolValueType(const Handle(TCollection_HAsciiString)& theDescription,
594 XCAFDimTolObjects_GeomToleranceTypeValue& theType)
596 TCollection_AsciiString aName = theDescription->String();
598 theType = XCAFDimTolObjects_GeomToleranceTypeValue_None;
599 if(aName.IsEqual("cylindrical or circular"))
601 theType = XCAFDimTolObjects_GeomToleranceTypeValue_Diameter;
603 else if(aName.IsEqual("spherical"))
605 theType = XCAFDimTolObjects_GeomToleranceTypeValue_SphericalDiameter;
607 if(theType != XCAFDimTolObjects_GeomToleranceTypeValue_None)
609 return Standard_True;
611 return Standard_False;
615 //=======================================================================
616 //function : GetDimTypeName
618 //=======================================================================
619 Handle(TCollection_HAsciiString) STEPConstruct_GDTProperty::GetDimTypeName(const XCAFDimTolObjects_DimensionType theType)
621 Handle(TCollection_HAsciiString) aName;
623 // Dimensional_Location
624 case XCAFDimTolObjects_DimensionType_Location_CurvedDistance:
625 aName = new TCollection_HAsciiString("curved distance");
627 case XCAFDimTolObjects_DimensionType_Location_LinearDistance:
628 aName = new TCollection_HAsciiString("linear distance");
630 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter:
631 aName = new TCollection_HAsciiString("linear distance centre outer");
633 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner:
634 aName = new TCollection_HAsciiString("linear distance centre inner");
636 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter:
637 aName = new TCollection_HAsciiString("linear distance outer centre");
639 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter:
640 aName = new TCollection_HAsciiString("linear distance outer outer");
642 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner:
643 aName = new TCollection_HAsciiString("linear distance outer inner");
645 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter:
646 aName = new TCollection_HAsciiString("linear distance inner centre");
648 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter:
649 aName = new TCollection_HAsciiString("linear distance inner outer");
651 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner:
652 aName = new TCollection_HAsciiString("linear distance inner inner");
655 case XCAFDimTolObjects_DimensionType_Size_CurveLength:
656 aName = new TCollection_HAsciiString("curve length");
658 case XCAFDimTolObjects_DimensionType_Size_Diameter:
659 aName = new TCollection_HAsciiString("diameter");
661 case XCAFDimTolObjects_DimensionType_Size_SphericalDiameter:
662 aName = new TCollection_HAsciiString("spherical diameter");
664 case XCAFDimTolObjects_DimensionType_Size_Radius:
665 aName = new TCollection_HAsciiString("radius");
667 case XCAFDimTolObjects_DimensionType_Size_SphericalRadius:
668 aName = new TCollection_HAsciiString("spherical radius");
670 case XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter:
671 aName = new TCollection_HAsciiString("toroidal minor diameter");
673 case XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter:
674 aName = new TCollection_HAsciiString("toroidal major diameter");
676 case XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius:
677 aName = new TCollection_HAsciiString("toroidal minor radius");
679 case XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius:
680 aName = new TCollection_HAsciiString("toroidal major radius");
682 case XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter:
683 aName = new TCollection_HAsciiString("toroidal high major diameter");
685 case XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter:
686 aName = new TCollection_HAsciiString("toroidal low major diameter");
688 case XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius:
689 aName = new TCollection_HAsciiString("toroidal high major radius");
691 case XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius:
692 aName = new TCollection_HAsciiString("toroidal low major radius");
694 case XCAFDimTolObjects_DimensionType_Size_Thickness:
695 aName = new TCollection_HAsciiString("thickness");
699 aName = new TCollection_HAsciiString();
704 //=======================================================================
705 //function : GetDimQualifierName
707 //=======================================================================
708 Handle(TCollection_HAsciiString) STEPConstruct_GDTProperty::GetDimQualifierName(const XCAFDimTolObjects_DimensionQualifier theQualifier)
710 Handle(TCollection_HAsciiString) aName;
711 switch (theQualifier) {
712 case XCAFDimTolObjects_DimensionQualifier_Min:
713 aName = new TCollection_HAsciiString("minimum");
715 case XCAFDimTolObjects_DimensionQualifier_Avg:
716 aName = new TCollection_HAsciiString("average");
718 case XCAFDimTolObjects_DimensionQualifier_Max:
719 aName = new TCollection_HAsciiString("maximum");
722 aName = new TCollection_HAsciiString();
727 //=======================================================================
728 //function : GetDimModifierName
730 //=======================================================================
731 Handle(TCollection_HAsciiString) STEPConstruct_GDTProperty::GetDimModifierName(const XCAFDimTolObjects_DimensionModif theModifier)
733 Handle(TCollection_HAsciiString) aName;
734 switch (theModifier) {
735 case XCAFDimTolObjects_DimensionModif_ControlledRadius:
736 aName = new TCollection_HAsciiString("controlled radius");
738 case XCAFDimTolObjects_DimensionModif_Square:
739 aName = new TCollection_HAsciiString("square");
741 case XCAFDimTolObjects_DimensionModif_StatisticalTolerance:
742 aName = new TCollection_HAsciiString("statistical");
744 case XCAFDimTolObjects_DimensionModif_ContinuousFeature:
745 aName = new TCollection_HAsciiString("continuous feature");
747 case XCAFDimTolObjects_DimensionModif_TwoPointSize:
748 aName = new TCollection_HAsciiString("two point size");
750 case XCAFDimTolObjects_DimensionModif_LocalSizeDefinedBySphere:
751 aName = new TCollection_HAsciiString("local size defined by a sphere");
753 case XCAFDimTolObjects_DimensionModif_LeastSquaresAssociationCriterion:
754 aName = new TCollection_HAsciiString("least squares association criteria");
756 case XCAFDimTolObjects_DimensionModif_MaximumInscribedAssociation:
757 aName = new TCollection_HAsciiString("maximum inscribed association criteria");
759 case XCAFDimTolObjects_DimensionModif_MinimumCircumscribedAssociation:
760 aName = new TCollection_HAsciiString("minimum circumscribed association criteria");
762 case XCAFDimTolObjects_DimensionModif_CircumferenceDiameter:
763 aName = new TCollection_HAsciiString("circumference diameter calculated size");
765 case XCAFDimTolObjects_DimensionModif_AreaDiameter:
766 aName = new TCollection_HAsciiString("area diameter calculated size");
768 case XCAFDimTolObjects_DimensionModif_VolumeDiameter:
769 aName = new TCollection_HAsciiString("volume diameter calculated size");
771 case XCAFDimTolObjects_DimensionModif_MaximumSize:
772 aName = new TCollection_HAsciiString("maximum rank order size");
774 case XCAFDimTolObjects_DimensionModif_MinimumSize:
775 aName = new TCollection_HAsciiString("minimum rank order size");
777 case XCAFDimTolObjects_DimensionModif_AverageSize:
778 aName = new TCollection_HAsciiString("average rank order size");
780 case XCAFDimTolObjects_DimensionModif_MedianSize:
781 aName = new TCollection_HAsciiString("median rank order size");
783 case XCAFDimTolObjects_DimensionModif_MidRangeSize:
784 aName = new TCollection_HAsciiString("mid range rank order size");
786 case XCAFDimTolObjects_DimensionModif_RangeOfSizes:
787 aName = new TCollection_HAsciiString("range rank order size");
789 case XCAFDimTolObjects_DimensionModif_AnyRestrictedPortionOfFeature:
790 aName = new TCollection_HAsciiString("any part of the feature");
792 case XCAFDimTolObjects_DimensionModif_AnyCrossSection:
793 aName = new TCollection_HAsciiString("any cross section");
795 case XCAFDimTolObjects_DimensionModif_SpecificFixedCrossSection:
796 aName = new TCollection_HAsciiString("specific fixed cross section");
798 case XCAFDimTolObjects_DimensionModif_CommonTolerance:
799 aName = new TCollection_HAsciiString("common tolerance");
801 case XCAFDimTolObjects_DimensionModif_FreeStateCondition:
802 aName = new TCollection_HAsciiString("free state condition");
804 default: aName = new TCollection_HAsciiString();
809 //=======================================================================
810 //function : GetLimitsAndFits
812 //=======================================================================
813 Handle(StepShape_LimitsAndFits) STEPConstruct_GDTProperty::GetLimitsAndFits(Standard_Boolean theHole,
814 XCAFDimTolObjects_DimensionFormVariance theFormVariance,
815 XCAFDimTolObjects_DimensionGrade theGrade)
817 Handle(StepShape_LimitsAndFits) aLAF = new StepShape_LimitsAndFits();
818 Handle(TCollection_HAsciiString) aGradeStr, aFormStr, aHoleStr;
820 if (theGrade == XCAFDimTolObjects_DimensionGrade_IT01)
821 aGradeStr = new TCollection_HAsciiString("01");
823 aGradeStr = new TCollection_HAsciiString((Standard_Integer)theGrade + 1);
825 switch (theFormVariance) {
826 case XCAFDimTolObjects_DimensionFormVariance_None:
827 aFormStr = new TCollection_HAsciiString("");
829 case XCAFDimTolObjects_DimensionFormVariance_A:
830 aFormStr = new TCollection_HAsciiString("A");
832 case XCAFDimTolObjects_DimensionFormVariance_B:
833 aFormStr = new TCollection_HAsciiString("B");
835 case XCAFDimTolObjects_DimensionFormVariance_C:
836 aFormStr = new TCollection_HAsciiString("C");
838 case XCAFDimTolObjects_DimensionFormVariance_CD:
839 aFormStr = new TCollection_HAsciiString("CD");
841 case XCAFDimTolObjects_DimensionFormVariance_D:
842 aFormStr = new TCollection_HAsciiString("D");
844 case XCAFDimTolObjects_DimensionFormVariance_E:
845 aFormStr = new TCollection_HAsciiString("E");
847 case XCAFDimTolObjects_DimensionFormVariance_EF:
848 aFormStr = new TCollection_HAsciiString("EF");
850 case XCAFDimTolObjects_DimensionFormVariance_F:
851 aFormStr = new TCollection_HAsciiString("F");
853 case XCAFDimTolObjects_DimensionFormVariance_FG:
854 aFormStr = new TCollection_HAsciiString("FG");
856 case XCAFDimTolObjects_DimensionFormVariance_G:
857 aFormStr = new TCollection_HAsciiString("G");
859 case XCAFDimTolObjects_DimensionFormVariance_H:
860 aFormStr = new TCollection_HAsciiString("H");
862 case XCAFDimTolObjects_DimensionFormVariance_JS:
863 aFormStr = new TCollection_HAsciiString("JS");
865 case XCAFDimTolObjects_DimensionFormVariance_J:
866 aFormStr = new TCollection_HAsciiString("J");
868 case XCAFDimTolObjects_DimensionFormVariance_K:
869 aFormStr = new TCollection_HAsciiString("K");
871 case XCAFDimTolObjects_DimensionFormVariance_M:
872 aFormStr = new TCollection_HAsciiString("M");
874 case XCAFDimTolObjects_DimensionFormVariance_N:
875 aFormStr = new TCollection_HAsciiString("N");
877 case XCAFDimTolObjects_DimensionFormVariance_P:
878 aFormStr = new TCollection_HAsciiString("P");
880 case XCAFDimTolObjects_DimensionFormVariance_R:
881 aFormStr = new TCollection_HAsciiString("R");
883 case XCAFDimTolObjects_DimensionFormVariance_S:
884 aFormStr = new TCollection_HAsciiString("S");
886 case XCAFDimTolObjects_DimensionFormVariance_T:
887 aFormStr = new TCollection_HAsciiString("T");
889 case XCAFDimTolObjects_DimensionFormVariance_U:
890 aFormStr = new TCollection_HAsciiString("U");
892 case XCAFDimTolObjects_DimensionFormVariance_V:
893 aFormStr = new TCollection_HAsciiString("V");
895 case XCAFDimTolObjects_DimensionFormVariance_X:
896 aFormStr = new TCollection_HAsciiString("X");
898 case XCAFDimTolObjects_DimensionFormVariance_Y:
899 aFormStr = new TCollection_HAsciiString("Y");
901 case XCAFDimTolObjects_DimensionFormVariance_Z:
902 aFormStr = new TCollection_HAsciiString("Z");
904 case XCAFDimTolObjects_DimensionFormVariance_ZA:
905 aFormStr = new TCollection_HAsciiString("ZA");
907 case XCAFDimTolObjects_DimensionFormVariance_ZB:
908 aFormStr = new TCollection_HAsciiString("ZB");
910 case XCAFDimTolObjects_DimensionFormVariance_ZC:
911 aFormStr = new TCollection_HAsciiString("ZC");
916 aHoleStr = new TCollection_HAsciiString("hole");
919 aHoleStr = new TCollection_HAsciiString("shaft");
920 aFormStr->LowerCase();
922 aLAF->Init(aFormStr, aHoleStr, aGradeStr, new TCollection_HAsciiString);
926 //=======================================================================
927 //function : GetDatumTargetName
929 //=======================================================================
930 Handle(TCollection_HAsciiString) STEPConstruct_GDTProperty::GetDatumTargetName(const XCAFDimTolObjects_DatumTargetType theDatumType)
932 Handle(TCollection_HAsciiString) aName;
933 switch (theDatumType) {
934 case XCAFDimTolObjects_DatumTargetType_Point:
935 aName = new TCollection_HAsciiString("point");
937 case XCAFDimTolObjects_DatumTargetType_Line:
938 aName = new TCollection_HAsciiString("line");
940 case XCAFDimTolObjects_DatumTargetType_Rectangle:
941 aName = new TCollection_HAsciiString("rectangle");
943 case XCAFDimTolObjects_DatumTargetType_Circle:
944 aName = new TCollection_HAsciiString("circle");
946 case XCAFDimTolObjects_DatumTargetType_Area:
947 aName = new TCollection_HAsciiString("area");
949 default: aName = new TCollection_HAsciiString();
954 //=======================================================================
955 //function : GetAxis2Placement3D
957 //=======================================================================
958 Handle(StepGeom_Axis2Placement3d) STEPConstruct_GDTProperty::GetAxis2Placement3D(const gp_Ax2 theAxis)
960 Handle(StepGeom_Axis2Placement3d) anA2P3D = new StepGeom_Axis2Placement3d();
961 Handle(StepGeom_CartesianPoint) aPoint = new StepGeom_CartesianPoint();
962 Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
963 for (Standard_Integer i = 1; i <= 3; i++)
964 aCoords->SetValue(i, theAxis.Location().Coord(i));
965 aPoint->Init(new TCollection_HAsciiString(), aCoords);
966 Handle(StepGeom_Direction) anAxis, aRefDirection;
967 Handle(TColStd_HArray1OfReal) anAxisCoords = new TColStd_HArray1OfReal(1, 3);
968 for (Standard_Integer i = 1; i <= 3; i++)
969 anAxisCoords->SetValue(i, theAxis.Direction().Coord(i));
970 anAxis = new StepGeom_Direction();
971 anAxis->Init(new TCollection_HAsciiString(), anAxisCoords);
972 Handle(TColStd_HArray1OfReal) aDirCoords = new TColStd_HArray1OfReal(1, 3);
973 for (Standard_Integer i = 1; i <= 3; i++)
974 aDirCoords->SetValue(i, theAxis.XDirection().Coord(i));
975 aRefDirection = new StepGeom_Direction();
976 aRefDirection->Init(new TCollection_HAsciiString(), aDirCoords);
977 anA2P3D->Init(new TCollection_HAsciiString("orientation"), aPoint, Standard_True, anAxis, Standard_True, aRefDirection);
981 //=======================================================================
982 //function : IsDimensionalSize
984 //=======================================================================
985 Standard_Boolean STEPConstruct_GDTProperty::IsDimensionalLocation(const XCAFDimTolObjects_DimensionType theType)
987 if (theType == XCAFDimTolObjects_DimensionType_Location_None ||
988 theType == XCAFDimTolObjects_DimensionType_Location_CurvedDistance ||
989 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance ||
990 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter ||
991 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner ||
992 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter ||
993 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter ||
994 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner ||
995 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter ||
996 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter ||
997 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner ||
998 theType == XCAFDimTolObjects_DimensionType_Location_Oriented)
999 return Standard_True;
1000 return Standard_False;
1003 //=======================================================================
1004 //function : IsDimensionalSize
1006 //=======================================================================
1007 Standard_Boolean STEPConstruct_GDTProperty::IsDimensionalSize(const XCAFDimTolObjects_DimensionType theType)
1009 if (theType == XCAFDimTolObjects_DimensionType_Size_CurveLength ||
1010 theType == XCAFDimTolObjects_DimensionType_Size_Diameter ||
1011 theType == XCAFDimTolObjects_DimensionType_Size_SphericalDiameter ||
1012 theType == XCAFDimTolObjects_DimensionType_Size_Radius ||
1013 theType == XCAFDimTolObjects_DimensionType_Size_SphericalRadius ||
1014 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter ||
1015 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter ||
1016 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius ||
1017 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius ||
1018 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter ||
1019 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter ||
1020 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius ||
1021 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius ||
1022 theType == XCAFDimTolObjects_DimensionType_Size_Thickness)
1023 return Standard_True;
1024 return Standard_False;
1027 //=======================================================================
1028 //function : GetGeomToleranceType
1030 //=======================================================================
1031 StepDimTol_GeometricToleranceType STEPConstruct_GDTProperty::GetGeomToleranceType(const XCAFDimTolObjects_GeomToleranceType theType)
1034 case XCAFDimTolObjects_GeomToleranceType_Angularity:
1035 return StepDimTol_GTTAngularityTolerance;
1036 case XCAFDimTolObjects_GeomToleranceType_CircularRunout:
1037 return StepDimTol_GTTCircularRunoutTolerance;
1038 case XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness:
1039 return StepDimTol_GTTRoundnessTolerance;
1040 case XCAFDimTolObjects_GeomToleranceType_Coaxiality:
1041 return StepDimTol_GTTCoaxialityTolerance;
1042 case XCAFDimTolObjects_GeomToleranceType_Concentricity:
1043 return StepDimTol_GTTConcentricityTolerance;
1044 case XCAFDimTolObjects_GeomToleranceType_Cylindricity:
1045 return StepDimTol_GTTCylindricityTolerance;
1046 case XCAFDimTolObjects_GeomToleranceType_Flatness:
1047 return StepDimTol_GTTFlatnessTolerance;
1048 case XCAFDimTolObjects_GeomToleranceType_Parallelism:
1049 return StepDimTol_GTTParallelismTolerance;
1050 case XCAFDimTolObjects_GeomToleranceType_Perpendicularity:
1051 return StepDimTol_GTTPerpendicularityTolerance;
1052 case XCAFDimTolObjects_GeomToleranceType_Position:
1053 return StepDimTol_GTTPositionTolerance;
1054 case XCAFDimTolObjects_GeomToleranceType_ProfileOfLine:
1055 return StepDimTol_GTTLineProfileTolerance;
1056 case XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface:
1057 return StepDimTol_GTTSurfaceProfileTolerance;
1058 case XCAFDimTolObjects_GeomToleranceType_Straightness:
1059 return StepDimTol_GTTStraightnessTolerance;
1060 case XCAFDimTolObjects_GeomToleranceType_Symmetry:
1061 return StepDimTol_GTTSymmetryTolerance;
1062 case XCAFDimTolObjects_GeomToleranceType_TotalRunout:
1063 return StepDimTol_GTTTotalRunoutTolerance;
1065 return StepDimTol_GTTPositionTolerance;
1069 //=======================================================================
1070 //function : GetGeomToleranceType
1072 //=======================================================================
1073 XCAFDimTolObjects_GeomToleranceType STEPConstruct_GDTProperty::GetGeomToleranceType(const StepDimTol_GeometricToleranceType theType)
1076 case StepDimTol_GTTAngularityTolerance:
1077 return XCAFDimTolObjects_GeomToleranceType_Angularity;
1078 case StepDimTol_GTTCircularRunoutTolerance:
1079 return XCAFDimTolObjects_GeomToleranceType_CircularRunout;
1080 case StepDimTol_GTTRoundnessTolerance:
1081 return XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness;
1082 case StepDimTol_GTTCoaxialityTolerance:
1083 return XCAFDimTolObjects_GeomToleranceType_Coaxiality;
1084 case StepDimTol_GTTConcentricityTolerance:
1085 return XCAFDimTolObjects_GeomToleranceType_Concentricity;
1086 case StepDimTol_GTTCylindricityTolerance:
1087 return XCAFDimTolObjects_GeomToleranceType_Cylindricity;
1088 case StepDimTol_GTTFlatnessTolerance:
1089 return XCAFDimTolObjects_GeomToleranceType_Flatness;
1090 case StepDimTol_GTTParallelismTolerance:
1091 return XCAFDimTolObjects_GeomToleranceType_Parallelism;
1092 case StepDimTol_GTTPerpendicularityTolerance:
1093 return XCAFDimTolObjects_GeomToleranceType_Perpendicularity;
1094 case StepDimTol_GTTPositionTolerance:
1095 return XCAFDimTolObjects_GeomToleranceType_Position;
1096 case StepDimTol_GTTLineProfileTolerance:
1097 return XCAFDimTolObjects_GeomToleranceType_ProfileOfLine;
1098 case StepDimTol_GTTSurfaceProfileTolerance:
1099 return XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface;
1100 case StepDimTol_GTTStraightnessTolerance:
1101 return XCAFDimTolObjects_GeomToleranceType_Straightness;
1102 case StepDimTol_GTTSymmetryTolerance:
1103 return XCAFDimTolObjects_GeomToleranceType_Symmetry;
1104 case StepDimTol_GTTTotalRunoutTolerance:
1105 return XCAFDimTolObjects_GeomToleranceType_TotalRunout;
1107 return XCAFDimTolObjects_GeomToleranceType_Position;
1111 //=======================================================================
1112 //function : GetGeomTolerance
1114 //=======================================================================
1115 Handle(StepDimTol_GeometricTolerance) STEPConstruct_GDTProperty::
1116 GetGeomTolerance(const XCAFDimTolObjects_GeomToleranceType theType)
1119 case XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness:
1120 return new StepDimTol_RoundnessTolerance();
1121 case XCAFDimTolObjects_GeomToleranceType_Cylindricity:
1122 return new StepDimTol_CylindricityTolerance();
1123 case XCAFDimTolObjects_GeomToleranceType_Flatness:
1124 return new StepDimTol_FlatnessTolerance();
1125 case XCAFDimTolObjects_GeomToleranceType_Position:
1126 return new StepDimTol_PositionTolerance();
1127 case XCAFDimTolObjects_GeomToleranceType_ProfileOfLine:
1128 return new StepDimTol_LineProfileTolerance();
1129 case XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface:
1130 return new StepDimTol_SurfaceProfileTolerance();
1131 case XCAFDimTolObjects_GeomToleranceType_Straightness:
1132 return new StepDimTol_StraightnessTolerance();
1138 //=======================================================================
1139 //function : GetGeomToleranceModifier
1141 //=======================================================================
1142 StepDimTol_GeometricToleranceModifier STEPConstruct_GDTProperty::
1143 GetGeomToleranceModifier(const XCAFDimTolObjects_GeomToleranceModif theModifier)
1145 switch (theModifier) {
1146 case XCAFDimTolObjects_GeomToleranceModif_Any_Cross_Section:
1147 return StepDimTol_GTMAnyCrossSection;
1148 case XCAFDimTolObjects_GeomToleranceModif_Common_Zone:
1149 return StepDimTol_GTMCommonZone;
1150 case XCAFDimTolObjects_GeomToleranceModif_Each_Radial_Element:
1151 return StepDimTol_GTMEachRadialElement;
1152 case XCAFDimTolObjects_GeomToleranceModif_Free_State:
1153 return StepDimTol_GTMFreeState;
1154 case XCAFDimTolObjects_GeomToleranceModif_Least_Material_Requirement:
1155 return StepDimTol_GTMLeastMaterialRequirement;
1156 case XCAFDimTolObjects_GeomToleranceModif_Line_Element:
1157 return StepDimTol_GTMLineElement;
1158 case XCAFDimTolObjects_GeomToleranceModif_Major_Diameter:
1159 return StepDimTol_GTMMajorDiameter;
1160 case XCAFDimTolObjects_GeomToleranceModif_Maximum_Material_Requirement:
1161 return StepDimTol_GTMMaximumMaterialRequirement;
1162 case XCAFDimTolObjects_GeomToleranceModif_Minor_Diameter:
1163 return StepDimTol_GTMMinorDiameter;
1164 case XCAFDimTolObjects_GeomToleranceModif_Not_Convex:
1165 return StepDimTol_GTMNotConvex;
1166 case XCAFDimTolObjects_GeomToleranceModif_Pitch_Diameter:
1167 return StepDimTol_GTMPitchDiameter;
1168 case XCAFDimTolObjects_GeomToleranceModif_Reciprocity_Requirement:
1169 return StepDimTol_GTMReciprocityRequirement;
1170 case XCAFDimTolObjects_GeomToleranceModif_Separate_Requirement:
1171 return StepDimTol_GTMSeparateRequirement;
1172 case XCAFDimTolObjects_GeomToleranceModif_Statistical_Tolerance:
1173 return StepDimTol_GTMStatisticalTolerance;
1174 case XCAFDimTolObjects_GeomToleranceModif_Tangent_Plane:
1175 return StepDimTol_GTMTangentPlane;
1177 return StepDimTol_GTMMaximumMaterialRequirement;
1181 //=======================================================================
1182 //function : GetDatumRefModifiers
1183 //purpose : Note: this function does not add anything to model
1184 //=======================================================================
1185 Handle(StepDimTol_HArray1OfDatumReferenceModifier) STEPConstruct_GDTProperty::
1186 GetDatumRefModifiers(const XCAFDimTolObjects_DatumModifiersSequence theModifiers,
1187 const XCAFDimTolObjects_DatumModifWithValue theModifWithVal,
1188 const Standard_Real theValue,
1189 const StepBasic_Unit theUnit)
1191 if ((theModifiers.Length() == 0) && (theModifWithVal == XCAFDimTolObjects_DatumModifWithValue_None))
1193 Standard_Integer aModifNb = theModifiers.Length();
1194 if (theModifWithVal != XCAFDimTolObjects_DatumModifWithValue_None)
1196 Handle(StepDimTol_HArray1OfDatumReferenceModifier) aModifiers =
1197 new StepDimTol_HArray1OfDatumReferenceModifier(1, aModifNb);
1199 // Modifier with value
1200 if (theModifWithVal != XCAFDimTolObjects_DatumModifWithValue_None) {
1201 StepDimTol_DatumReferenceModifierType aType;
1202 switch (theModifWithVal) {
1203 case XCAFDimTolObjects_DatumModifWithValue_CircularOrCylindrical:
1204 aType = StepDimTol_CircularOrCylindrical;
1206 case XCAFDimTolObjects_DatumModifWithValue_Distance:
1207 aType = StepDimTol_Distance;
1209 case XCAFDimTolObjects_DatumModifWithValue_Projected:
1210 aType = StepDimTol_Projected;
1212 case XCAFDimTolObjects_DatumModifWithValue_Spherical:
1213 aType = StepDimTol_Spherical;
1216 aType = StepDimTol_Distance;
1218 Handle(StepBasic_LengthMeasureWithUnit) aLMWU = new StepBasic_LengthMeasureWithUnit();
1219 Handle(StepBasic_MeasureValueMember) aValueMember = new StepBasic_MeasureValueMember();
1220 aValueMember->SetName("LENGTH_MEASURE");
1221 aValueMember->SetReal(theValue);
1222 aLMWU->Init(aValueMember, theUnit);
1223 Handle(StepDimTol_DatumReferenceModifierWithValue) aModifWithVal = new StepDimTol_DatumReferenceModifierWithValue();
1224 aModifWithVal->Init(aType, aLMWU);
1225 StepDimTol_DatumReferenceModifier aModif;
1226 aModif.SetValue(aModifWithVal);
1227 aModifiers->SetValue(aModifNb, aModif);
1231 for (Standard_Integer i = 1; i <= theModifiers.Length(); i++) {
1232 Handle(StepDimTol_SimpleDatumReferenceModifierMember) aSimpleModifMember =
1233 new StepDimTol_SimpleDatumReferenceModifierMember();
1234 switch (theModifiers.Value(i)) {
1235 case XCAFDimTolObjects_DatumSingleModif_AnyCrossSection:
1236 aSimpleModifMember->SetEnumText(0, ".ANY_CROSS_SECTION.");
1238 case XCAFDimTolObjects_DatumSingleModif_Any_LongitudinalSection:
1239 aSimpleModifMember->SetEnumText(0, ".ANY_LONGITUDINAL_SECTION.");
1241 case XCAFDimTolObjects_DatumSingleModif_Basic:
1242 aSimpleModifMember->SetEnumText(0, ".BASIC.");
1244 case XCAFDimTolObjects_DatumSingleModif_ContactingFeature:
1245 aSimpleModifMember->SetEnumText(0, ".CONTACTING_FEATURE.");
1247 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintU:
1248 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_U.");
1250 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintV:
1251 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_V.");
1253 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintW:
1254 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_W.");
1256 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintX:
1257 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_X.");
1259 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintY:
1260 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_Y.");
1262 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintZ:
1263 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_Z.");
1265 case XCAFDimTolObjects_DatumSingleModif_DistanceVariable:
1266 aSimpleModifMember->SetEnumText(0, ".DISTANCE_VARIABLE.");
1268 case XCAFDimTolObjects_DatumSingleModif_FreeState:
1269 aSimpleModifMember->SetEnumText(0, ".FREE_STATE.");
1271 case XCAFDimTolObjects_DatumSingleModif_LeastMaterialRequirement:
1272 aSimpleModifMember->SetEnumText(0, ".LEAST_MATERIAL_REQUIREMENT.");
1274 case XCAFDimTolObjects_DatumSingleModif_Line:
1275 aSimpleModifMember->SetEnumText(0, ".LINE.");
1277 case XCAFDimTolObjects_DatumSingleModif_MajorDiameter:
1278 aSimpleModifMember->SetEnumText(0, ".MAJOR_DIAMETER.");
1280 case XCAFDimTolObjects_DatumSingleModif_MaximumMaterialRequirement:
1281 aSimpleModifMember->SetEnumText(0, ".MAXIMUM_MATERIAL_REQUIREMENT.");
1283 case XCAFDimTolObjects_DatumSingleModif_MinorDiameter:
1284 aSimpleModifMember->SetEnumText(0, ".MINOR_DIAMETER.");
1286 case XCAFDimTolObjects_DatumSingleModif_Orientation:
1287 aSimpleModifMember->SetEnumText(0, ".ORIENTATION.");
1289 case XCAFDimTolObjects_DatumSingleModif_PitchDiameter:
1290 aSimpleModifMember->SetEnumText(0, ".PITCH_DIAMETER.");
1292 case XCAFDimTolObjects_DatumSingleModif_Plane:
1293 aSimpleModifMember->SetEnumText(0, ".PLANE.");
1295 case XCAFDimTolObjects_DatumSingleModif_Point:
1296 aSimpleModifMember->SetEnumText(0, ".POINT.");
1298 case XCAFDimTolObjects_DatumSingleModif_Translation:
1299 aSimpleModifMember->SetEnumText(0, ".TRANSLATION.");
1302 StepDimTol_DatumReferenceModifier aModif;
1303 aModif.SetValue(aSimpleModifMember);
1304 aModifiers->SetValue(i, aModif);
1310 //=======================================================================
1311 //function : GetTolValueType
1313 //=======================================================================
1314 Handle(TCollection_HAsciiString) STEPConstruct_GDTProperty::GetTolValueType(const XCAFDimTolObjects_GeomToleranceTypeValue& theType)
1317 case XCAFDimTolObjects_GeomToleranceTypeValue_Diameter:
1318 return new TCollection_HAsciiString("cylindrical or circular");
1319 case XCAFDimTolObjects_GeomToleranceTypeValue_SphericalDiameter:
1320 return new TCollection_HAsciiString("spherical");
1322 return new TCollection_HAsciiString("unknown");