1 // Created on: 2015-09-10
2 // Created by: Irina Krylova
3 // Copyright (c) 1999-2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <BRep_Tool.hxx>
17 #include <Geom_BSplineCurve.hxx>
18 #include <Geom_Curve.hxx>
19 #include <Geom_Line.hxx>
20 #include <ShapeConstruct_Curve.hxx>
21 #include <STEPCAFControl_GDTProperty.hxx>
22 #include <StepBasic_MeasureValueMember.hxx>
23 #include <StepGeom_CartesianPoint.hxx>
24 #include <StepGeom_Direction.hxx>
25 #include <StepDimTol_CylindricityTolerance.hxx>
26 #include <StepDimTol_FlatnessTolerance.hxx>
27 #include <StepDimTol_LineProfileTolerance.hxx>
28 #include <StepDimTol_PositionTolerance.hxx>
29 #include <StepDimTol_RoundnessTolerance.hxx>
30 #include <StepDimTol_StraightnessTolerance.hxx>
31 #include <StepDimTol_SurfaceProfileTolerance.hxx>
32 #include <StepRepr_DescriptiveRepresentationItem.hxx>
33 #include <StepVisual_CoordinatesList.hxx>
34 #include <StepVisual_TessellatedCurveSet.hxx>
35 #include <TopExp_Explorer.hxx>
37 #include <TopoDS_Shape.hxx>
38 #include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
39 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
41 //=======================================================================
42 //function : STEPCAFControl_GDTProperty
44 //=======================================================================
46 STEPCAFControl_GDTProperty::STEPCAFControl_GDTProperty ()
50 //=======================================================================
51 //function : getDimModifiers
53 //=======================================================================
54 void STEPCAFControl_GDTProperty::GetDimModifiers(const Handle(StepRepr_CompoundRepresentationItem)& theCRI,
55 XCAFDimTolObjects_DimensionModifiersSequence& theModifiers)
57 for (Standard_Integer l = 1; l <= theCRI->ItemElement()->Length(); l++)
59 Handle(StepRepr_DescriptiveRepresentationItem) aDRI =
60 Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(theCRI->ItemElement()->Value(l));
61 if(aDRI.IsNull()) continue;
62 XCAFDimTolObjects_DimensionModif aModifier = XCAFDimTolObjects_DimensionModif_ControlledRadius;
63 const TCollection_AsciiString aModifStr = aDRI->Description()->String();
64 Standard_Boolean aFound = Standard_False;
65 if(aModifStr.IsEqual("controlled radius"))
67 aFound = Standard_True;
68 aModifier = XCAFDimTolObjects_DimensionModif_ControlledRadius;
70 else if(aModifStr.IsEqual("square"))
72 aFound = Standard_True;
73 aModifier = XCAFDimTolObjects_DimensionModif_Square;
75 else if(aModifStr.IsEqual("statistical"))
77 aFound = Standard_True;
78 aModifier = XCAFDimTolObjects_DimensionModif_StatisticalTolerance;
80 else if(aModifStr.IsEqual("continuous feature"))
82 aFound = Standard_True;
83 aModifier = XCAFDimTolObjects_DimensionModif_ContinuousFeature;
85 else if(aModifStr.IsEqual("two point size"))
87 aFound = Standard_True;
88 aModifier = XCAFDimTolObjects_DimensionModif_TwoPointSize;
90 else if(aModifStr.IsEqual("local size defined by a sphere"))
92 aFound = Standard_True;
93 aModifier = XCAFDimTolObjects_DimensionModif_LocalSizeDefinedBySphere;
95 else if(aModifStr.IsEqual("least squares association criteria"))
97 aFound = Standard_True;
98 aModifier = XCAFDimTolObjects_DimensionModif_LeastSquaresAssociationCriterion;
100 else if(aModifStr.IsEqual("maximum inscribed association criteria"))
102 aFound = Standard_True;
103 aModifier = XCAFDimTolObjects_DimensionModif_MaximumInscribedAssociation;
105 else if(aModifStr.IsEqual("minimum circumscribed association criteria"))
107 aFound = Standard_True;
108 aModifier = XCAFDimTolObjects_DimensionModif_MinimumCircumscribedAssociation;
110 else if(aModifStr.IsEqual("circumference diameter calculated size"))
112 aFound = Standard_True;
113 aModifier = XCAFDimTolObjects_DimensionModif_CircumferenceDiameter;
115 else if(aModifStr.IsEqual("area diameter calculated size"))
117 aFound = Standard_True;
118 aModifier = XCAFDimTolObjects_DimensionModif_AreaDiameter;
120 else if(aModifStr.IsEqual("volume diameter calculated size"))
122 aFound = Standard_True;
123 aModifier = XCAFDimTolObjects_DimensionModif_VolumeDiameter;
125 else if(aModifStr.IsEqual("maximum rank order size"))
127 aFound = Standard_True;
128 aModifier = XCAFDimTolObjects_DimensionModif_MaximumSize;
130 else if(aModifStr.IsEqual("minimum rank order size"))
132 aFound = Standard_True;
133 aModifier = XCAFDimTolObjects_DimensionModif_MinimumSize;
135 else if(aModifStr.IsEqual("average rank order size"))
137 aFound = Standard_True;
138 aModifier = XCAFDimTolObjects_DimensionModif_AverageSize;
140 else if(aModifStr.IsEqual("median rank order size"))
142 aFound = Standard_True;
143 aModifier = XCAFDimTolObjects_DimensionModif_MedianSize;
145 else if(aModifStr.IsEqual("mid range rank order size"))
147 aFound = Standard_True;
148 aModifier = XCAFDimTolObjects_DimensionModif_MidRangeSize;
150 else if(aModifStr.IsEqual("range rank order size"))
152 aFound = Standard_True;
153 aModifier = XCAFDimTolObjects_DimensionModif_RangeOfSizes;
155 else if(aModifStr.IsEqual("any part of the feature"))
157 aFound = Standard_True;
158 aModifier = XCAFDimTolObjects_DimensionModif_AnyRestrictedPortionOfFeature;
160 else if(aModifStr.IsEqual("any cross section"))
162 aFound = Standard_True;
163 aModifier = XCAFDimTolObjects_DimensionModif_AnyCrossSection;
165 else if(aModifStr.IsEqual("specific fixed cross section"))
167 aFound = Standard_True;
168 aModifier = XCAFDimTolObjects_DimensionModif_SpecificFixedCrossSection;
170 else if(aModifStr.IsEqual("common tolerance"))
172 aFound = Standard_True;
173 aModifier = XCAFDimTolObjects_DimensionModif_CommonTolerance;
175 else if(aModifStr.IsEqual("free state condition"))
177 aFound = Standard_True;
178 aModifier = XCAFDimTolObjects_DimensionModif_FreeStateCondition;
181 theModifiers.Append(aModifier);
185 //=======================================================================
186 //function : getClassOfTolerance
188 //=======================================================================
189 void STEPCAFControl_GDTProperty::GetDimClassOfTolerance(const Handle(StepShape_LimitsAndFits)& theLAF,
190 Standard_Boolean& theHolle,
191 XCAFDimTolObjects_DimensionFormVariance& theFV,
192 XCAFDimTolObjects_DimensionGrade& theG)
194 Handle(TCollection_HAsciiString) aFormV = theLAF->FormVariance();
195 Handle(TCollection_HAsciiString) aGrade = theLAF->Grade();
196 theFV = XCAFDimTolObjects_DimensionFormVariance_None;
197 Standard_Boolean aFound;
198 theHolle = Standard_False;
199 //it is not verified information
200 for(Standard_Integer c = 0; c <= 1; c++)
202 aFound = Standard_False;
203 Standard_Boolean aCaseSens = Standard_False;
205 aCaseSens = Standard_True;
206 Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString("a");
207 if(aFormV->IsSameString(aStr, aCaseSens))
209 aFound = Standard_True;
210 theFV = XCAFDimTolObjects_DimensionFormVariance_A;
213 aStr = new TCollection_HAsciiString("b");
214 if(aFormV->IsSameString(aStr, aCaseSens))
216 aFound = Standard_True;
217 theFV = XCAFDimTolObjects_DimensionFormVariance_B;
220 aStr = new TCollection_HAsciiString("c");
221 if(aFormV->IsSameString(aStr, aCaseSens))
223 aFound = Standard_True;
224 theFV = XCAFDimTolObjects_DimensionFormVariance_C;
227 aStr = new TCollection_HAsciiString("cd");
228 if(aFormV->IsSameString(aStr, aCaseSens))
230 aFound = Standard_True;
231 theFV = XCAFDimTolObjects_DimensionFormVariance_CD;
234 aStr = new TCollection_HAsciiString("d");
235 if(aFormV->IsSameString(aStr, aCaseSens))
237 aFound = Standard_True;
238 theFV = XCAFDimTolObjects_DimensionFormVariance_D;
241 aStr = new TCollection_HAsciiString("e");
242 if(aFormV->IsSameString(aStr, aCaseSens))
244 aFound = Standard_True;
245 theFV = XCAFDimTolObjects_DimensionFormVariance_E;
248 aStr = new TCollection_HAsciiString("ef");
249 if(aFormV->IsSameString(aStr, aCaseSens))
251 aFound = Standard_True;
252 theFV = XCAFDimTolObjects_DimensionFormVariance_EF;
255 aStr = new TCollection_HAsciiString("f");
256 if(aFormV->IsSameString(aStr, aCaseSens))
258 aFound = Standard_True;
259 theFV = XCAFDimTolObjects_DimensionFormVariance_F;
262 aStr = new TCollection_HAsciiString("fg");
263 if(aFormV->IsSameString(aStr, aCaseSens))
265 aFound = Standard_True;
266 theFV = XCAFDimTolObjects_DimensionFormVariance_FG;
269 aStr = new TCollection_HAsciiString("g");
270 if(aFormV->IsSameString(aStr, aCaseSens))
272 aFound = Standard_True;
273 theFV = XCAFDimTolObjects_DimensionFormVariance_G;
276 aStr = new TCollection_HAsciiString("h");
277 if(aFormV->IsSameString(aStr, aCaseSens))
279 aFound = Standard_True;
280 theFV = XCAFDimTolObjects_DimensionFormVariance_H;
283 aStr = new TCollection_HAsciiString("js");
284 if(aFormV->IsSameString(aStr, aCaseSens))
286 aFound = Standard_True;
287 theFV = XCAFDimTolObjects_DimensionFormVariance_JS;
290 aStr = new TCollection_HAsciiString("k");
291 if(aFormV->IsSameString(aStr, aCaseSens))
293 aFound = Standard_True;
294 theFV = XCAFDimTolObjects_DimensionFormVariance_K;
297 aStr = new TCollection_HAsciiString("m");
298 if(aFormV->IsSameString(aStr, aCaseSens))
300 aFound = Standard_True;
301 theFV = XCAFDimTolObjects_DimensionFormVariance_M;
304 aStr = new TCollection_HAsciiString("n");
305 if(aFormV->IsSameString(aStr, aCaseSens))
307 aFound = Standard_True;
308 theFV = XCAFDimTolObjects_DimensionFormVariance_N;
311 aStr = new TCollection_HAsciiString("p");
312 if(aFormV->IsSameString(aStr, aCaseSens))
314 aFound = Standard_True;
315 theFV = XCAFDimTolObjects_DimensionFormVariance_P;
318 aStr = new TCollection_HAsciiString("r");
319 if(aFormV->IsSameString(aStr, aCaseSens))
321 aFound = Standard_True;
322 theFV = XCAFDimTolObjects_DimensionFormVariance_R;
325 aStr = new TCollection_HAsciiString("s");
326 if(aFormV->IsSameString(aStr, aCaseSens))
328 aFound = Standard_True;
329 theFV = XCAFDimTolObjects_DimensionFormVariance_S;
332 aStr = new TCollection_HAsciiString("t");
333 if(aFormV->IsSameString(aStr, aCaseSens))
335 aFound = Standard_True;
336 theFV = XCAFDimTolObjects_DimensionFormVariance_T;
339 aStr = new TCollection_HAsciiString("u");
340 if(aFormV->IsSameString(aStr, aCaseSens))
342 aFound = Standard_True;
343 theFV = XCAFDimTolObjects_DimensionFormVariance_U;
346 aStr = new TCollection_HAsciiString("v");
347 if(aFormV->IsSameString(aStr, aCaseSens))
349 aFound = Standard_True;
350 theFV = XCAFDimTolObjects_DimensionFormVariance_V;
353 aStr = new TCollection_HAsciiString("x");
354 if(aFormV->IsSameString(aStr, aCaseSens))
356 aFound = Standard_True;
357 theFV = XCAFDimTolObjects_DimensionFormVariance_X;
360 aStr = new TCollection_HAsciiString("y");
361 if(aFormV->IsSameString(aStr, aCaseSens))
363 aFound = Standard_True;
364 theFV = XCAFDimTolObjects_DimensionFormVariance_Y;
367 aStr = new TCollection_HAsciiString("b");
368 if(aFormV->IsSameString(aStr, aCaseSens))
370 aFound = Standard_True;
371 theFV = XCAFDimTolObjects_DimensionFormVariance_B;
374 aStr = new TCollection_HAsciiString("z");
375 if(aFormV->IsSameString(aStr, aCaseSens))
377 aFound = Standard_True;
378 theFV = XCAFDimTolObjects_DimensionFormVariance_Z;
381 aStr = new TCollection_HAsciiString("za");
382 if(aFormV->IsSameString(aStr, aCaseSens))
384 aFound = Standard_True;
385 theFV = XCAFDimTolObjects_DimensionFormVariance_ZA;
388 aStr = new TCollection_HAsciiString("zb");
389 if(aFormV->IsSameString(aStr, aCaseSens))
391 aFound = Standard_True;
392 theFV = XCAFDimTolObjects_DimensionFormVariance_ZB;
395 aStr = new TCollection_HAsciiString("zc");
396 if(aFormV->IsSameString(aStr, aCaseSens))
398 aFound = Standard_True;
399 theFV = XCAFDimTolObjects_DimensionFormVariance_ZC;
403 if (c == 1 && !aFound)
404 theHolle = Standard_True;
406 Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString("01");
407 if(aGrade->IsSameString(aStr))
409 theG = XCAFDimTolObjects_DimensionGrade_IT01;
413 theG = (XCAFDimTolObjects_DimensionGrade)(aGrade->IntegerValue()+1);
417 //=======================================================================
418 //function : getDimType
420 //=======================================================================
421 Standard_Boolean STEPCAFControl_GDTProperty::GetDimType(const Handle(TCollection_HAsciiString)& theName,
422 XCAFDimTolObjects_DimensionType& theType)
424 TCollection_AsciiString aName = theName->String();
426 theType = XCAFDimTolObjects_DimensionType_Location_None;
427 if(aName.IsEqual("curve length"))
429 theType = XCAFDimTolObjects_DimensionType_Size_CurveLength;
431 else if(aName.IsEqual("diameter"))
433 theType = XCAFDimTolObjects_DimensionType_Size_Diameter;
435 else if(aName.IsEqual("spherical diameter"))
437 theType = XCAFDimTolObjects_DimensionType_Size_SphericalDiameter;
439 else if(aName.IsEqual("radius"))
441 theType = XCAFDimTolObjects_DimensionType_Size_Radius;
443 else if(aName.IsEqual("spherical radius"))
445 theType = XCAFDimTolObjects_DimensionType_Size_SphericalRadius;
447 else if(aName.IsEqual("toroidal minor diameter"))
449 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter;
451 else if(aName.IsEqual("toroidal major diameter"))
453 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter;
455 else if(aName.IsEqual("toroidal minor radius"))
457 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius;
459 else if(aName.IsEqual("toroidal major radius"))
461 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius;
463 else if(aName.IsEqual("toroidal high major diameter"))
465 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter;
467 else if(aName.IsEqual("toroidal low major diameter"))
469 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter;
471 else if(aName.IsEqual("toroidal high major radius"))
473 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius;
475 else if(aName.IsEqual("toroidal low major radius"))
477 theType = XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius;
479 else if(aName.IsEqual("thickness"))
481 theType = XCAFDimTolObjects_DimensionType_Size_Thickness;
483 else if(aName.IsEqual("curved distance"))
485 theType = XCAFDimTolObjects_DimensionType_Location_CurvedDistance;
487 else if(aName.IsEqual("linear distance"))
489 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance;
491 else if(aName.IsEqual("linear distance centre outer"))
493 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter;
495 else if(aName.IsEqual("linear distance centre inner"))
497 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner;
499 else if(aName.IsEqual("linear distance outer centre"))
501 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter;
503 else if(aName.IsEqual("linear distance outer outer"))
505 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter;
507 else if(aName.IsEqual("linear distance outer inner"))
509 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner;
511 else if(aName.IsEqual("linear distance inner centre"))
513 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter;
515 else if(aName.IsEqual("linear distance inner outer"))
517 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter;
519 else if(aName.IsEqual("linear distance inner inner"))
521 theType = XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner;
524 if(theType != XCAFDimTolObjects_DimensionType_Location_None &&
525 theType != XCAFDimTolObjects_DimensionType_CommonLabel)
527 return Standard_True;
529 return Standard_False;
533 //=======================================================================
534 //function : DatumTargetType
536 //=======================================================================
537 Standard_Boolean STEPCAFControl_GDTProperty::GetDatumTargetType(const Handle(TCollection_HAsciiString)& theDescription,
538 XCAFDimTolObjects_DatumTargetType& theType)
540 TCollection_AsciiString aName = theDescription->String();
542 if(aName.IsEqual("area"))
544 theType = XCAFDimTolObjects_DatumTargetType_Area;
545 return Standard_True;
547 else if(aName.IsEqual("line"))
549 theType = XCAFDimTolObjects_DatumTargetType_Line;
550 return Standard_True;
552 else if(aName.IsEqual("circle"))
554 theType = XCAFDimTolObjects_DatumTargetType_Circle;
555 return Standard_True;
557 else if(aName.IsEqual("rectangle"))
559 theType = XCAFDimTolObjects_DatumTargetType_Rectangle;
560 return Standard_True;
562 else if(aName.IsEqual("point"))
564 theType = XCAFDimTolObjects_DatumTargetType_Point;
565 return Standard_True;
567 return Standard_False;
570 //=======================================================================
571 //function : GetDimQualifierType
573 //=======================================================================
574 Standard_Boolean STEPCAFControl_GDTProperty::GetDimQualifierType(const Handle(TCollection_HAsciiString)& theDescription,
575 XCAFDimTolObjects_DimensionQualifier& theType)
577 TCollection_AsciiString aName = theDescription->String();
579 theType = XCAFDimTolObjects_DimensionQualifier_None;
580 if(aName.IsEqual("maximum"))
582 theType = XCAFDimTolObjects_DimensionQualifier_Max;
584 else if(aName.IsEqual("minimum"))
586 theType = XCAFDimTolObjects_DimensionQualifier_Min;
588 else if(aName.IsEqual("average"))
590 theType = XCAFDimTolObjects_DimensionQualifier_Avg;
592 if(theType != XCAFDimTolObjects_DimensionQualifier_None)
594 return Standard_True;
596 return Standard_False;
599 //=======================================================================
600 //function : GetTolValueType
602 //=======================================================================
603 Standard_Boolean STEPCAFControl_GDTProperty::GetTolValueType(const Handle(TCollection_HAsciiString)& theDescription,
604 XCAFDimTolObjects_GeomToleranceTypeValue& theType)
606 TCollection_AsciiString aName = theDescription->String();
608 theType = XCAFDimTolObjects_GeomToleranceTypeValue_None;
609 if(aName.IsEqual("cylindrical or circular"))
611 theType = XCAFDimTolObjects_GeomToleranceTypeValue_Diameter;
613 else if(aName.IsEqual("spherical"))
615 theType = XCAFDimTolObjects_GeomToleranceTypeValue_SphericalDiameter;
617 if(theType != XCAFDimTolObjects_GeomToleranceTypeValue_None)
619 return Standard_True;
621 return Standard_False;
625 //=======================================================================
626 //function : GetDimTypeName
628 //=======================================================================
629 Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetDimTypeName(const XCAFDimTolObjects_DimensionType theType)
631 Handle(TCollection_HAsciiString) aName;
633 // Dimensional_Location
634 case XCAFDimTolObjects_DimensionType_Location_CurvedDistance:
635 aName = new TCollection_HAsciiString("curved distance");
637 case XCAFDimTolObjects_DimensionType_Location_LinearDistance:
638 aName = new TCollection_HAsciiString("linear distance");
640 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter:
641 aName = new TCollection_HAsciiString("linear distance centre outer");
643 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner:
644 aName = new TCollection_HAsciiString("linear distance centre inner");
646 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter:
647 aName = new TCollection_HAsciiString("linear distance outer centre");
649 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter:
650 aName = new TCollection_HAsciiString("linear distance outer outer");
652 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner:
653 aName = new TCollection_HAsciiString("linear distance outer inner");
655 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter:
656 aName = new TCollection_HAsciiString("linear distance inner centre");
658 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter:
659 aName = new TCollection_HAsciiString("linear distance inner outer");
661 case XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner:
662 aName = new TCollection_HAsciiString("linear distance inner inner");
665 case XCAFDimTolObjects_DimensionType_Size_CurveLength:
666 aName = new TCollection_HAsciiString("curve length");
668 case XCAFDimTolObjects_DimensionType_Size_Diameter:
669 aName = new TCollection_HAsciiString("diameter");
671 case XCAFDimTolObjects_DimensionType_Size_SphericalDiameter:
672 aName = new TCollection_HAsciiString("spherical diameter");
674 case XCAFDimTolObjects_DimensionType_Size_Radius:
675 aName = new TCollection_HAsciiString("radius");
677 case XCAFDimTolObjects_DimensionType_Size_SphericalRadius:
678 aName = new TCollection_HAsciiString("spherical radius");
680 case XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter:
681 aName = new TCollection_HAsciiString("toroidal minor diameter");
683 case XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter:
684 aName = new TCollection_HAsciiString("toroidal major diameter");
686 case XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius:
687 aName = new TCollection_HAsciiString("toroidal minor radius");
689 case XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius:
690 aName = new TCollection_HAsciiString("toroidal major radius");
692 case XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter:
693 aName = new TCollection_HAsciiString("toroidal high major diameter");
695 case XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter:
696 aName = new TCollection_HAsciiString("toroidal low major diameter");
698 case XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius:
699 aName = new TCollection_HAsciiString("toroidal high major radius");
701 case XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius:
702 aName = new TCollection_HAsciiString("toroidal low major radius");
704 case XCAFDimTolObjects_DimensionType_Size_Thickness:
705 aName = new TCollection_HAsciiString("thickness");
709 aName = new TCollection_HAsciiString();
714 //=======================================================================
715 //function : GetDimQualifierName
717 //=======================================================================
718 Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetDimQualifierName(const XCAFDimTolObjects_DimensionQualifier theQualifier)
720 Handle(TCollection_HAsciiString) aName;
721 switch (theQualifier) {
722 case XCAFDimTolObjects_DimensionQualifier_Min:
723 aName = new TCollection_HAsciiString("minimum");
725 case XCAFDimTolObjects_DimensionQualifier_Avg:
726 aName = new TCollection_HAsciiString("average");
728 case XCAFDimTolObjects_DimensionQualifier_Max:
729 aName = new TCollection_HAsciiString("maximum");
732 aName = new TCollection_HAsciiString();
737 //=======================================================================
738 //function : GetDimModifierName
740 //=======================================================================
741 Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetDimModifierName(const XCAFDimTolObjects_DimensionModif theModifier)
743 Handle(TCollection_HAsciiString) aName;
744 switch (theModifier) {
745 case XCAFDimTolObjects_DimensionModif_ControlledRadius:
746 aName = new TCollection_HAsciiString("controlled radius");
748 case XCAFDimTolObjects_DimensionModif_Square:
749 aName = new TCollection_HAsciiString("square");
751 case XCAFDimTolObjects_DimensionModif_StatisticalTolerance:
752 aName = new TCollection_HAsciiString("statistical");
754 case XCAFDimTolObjects_DimensionModif_ContinuousFeature:
755 aName = new TCollection_HAsciiString("continuous feature");
757 case XCAFDimTolObjects_DimensionModif_TwoPointSize:
758 aName = new TCollection_HAsciiString("two point size");
760 case XCAFDimTolObjects_DimensionModif_LocalSizeDefinedBySphere:
761 aName = new TCollection_HAsciiString("local size defined by a sphere");
763 case XCAFDimTolObjects_DimensionModif_LeastSquaresAssociationCriterion:
764 aName = new TCollection_HAsciiString("least squares association criteria");
766 case XCAFDimTolObjects_DimensionModif_MaximumInscribedAssociation:
767 aName = new TCollection_HAsciiString("maximum inscribed association criteria");
769 case XCAFDimTolObjects_DimensionModif_MinimumCircumscribedAssociation:
770 aName = new TCollection_HAsciiString("minimum circumscribed association criteria");
772 case XCAFDimTolObjects_DimensionModif_CircumferenceDiameter:
773 aName = new TCollection_HAsciiString("circumference diameter calculated size");
775 case XCAFDimTolObjects_DimensionModif_AreaDiameter:
776 aName = new TCollection_HAsciiString("area diameter calculated size");
778 case XCAFDimTolObjects_DimensionModif_VolumeDiameter:
779 aName = new TCollection_HAsciiString("volume diameter calculated size");
781 case XCAFDimTolObjects_DimensionModif_MaximumSize:
782 aName = new TCollection_HAsciiString("maximum rank order size");
784 case XCAFDimTolObjects_DimensionModif_MinimumSize:
785 aName = new TCollection_HAsciiString("minimum rank order size");
787 case XCAFDimTolObjects_DimensionModif_AverageSize:
788 aName = new TCollection_HAsciiString("average rank order size");
790 case XCAFDimTolObjects_DimensionModif_MedianSize:
791 aName = new TCollection_HAsciiString("median rank order size");
793 case XCAFDimTolObjects_DimensionModif_MidRangeSize:
794 aName = new TCollection_HAsciiString("mid range rank order size");
796 case XCAFDimTolObjects_DimensionModif_RangeOfSizes:
797 aName = new TCollection_HAsciiString("range rank order size");
799 case XCAFDimTolObjects_DimensionModif_AnyRestrictedPortionOfFeature:
800 aName = new TCollection_HAsciiString("any part of the feature");
802 case XCAFDimTolObjects_DimensionModif_AnyCrossSection:
803 aName = new TCollection_HAsciiString("any cross section");
805 case XCAFDimTolObjects_DimensionModif_SpecificFixedCrossSection:
806 aName = new TCollection_HAsciiString("specific fixed cross section");
808 case XCAFDimTolObjects_DimensionModif_CommonTolerance:
809 aName = new TCollection_HAsciiString("common tolerance");
811 case XCAFDimTolObjects_DimensionModif_FreeStateCondition:
812 aName = new TCollection_HAsciiString("free state condition");
814 default: aName = new TCollection_HAsciiString();
819 //=======================================================================
820 //function : GetLimitsAndFits
822 //=======================================================================
823 Handle(StepShape_LimitsAndFits) STEPCAFControl_GDTProperty::GetLimitsAndFits(Standard_Boolean theHole,
824 XCAFDimTolObjects_DimensionFormVariance theFormVariance,
825 XCAFDimTolObjects_DimensionGrade theGrade)
827 Handle(StepShape_LimitsAndFits) aLAF = new StepShape_LimitsAndFits();
828 Handle(TCollection_HAsciiString) aGradeStr, aFormStr, aHoleStr;
830 if (theGrade == XCAFDimTolObjects_DimensionGrade_IT01)
831 aGradeStr = new TCollection_HAsciiString("01");
833 aGradeStr = new TCollection_HAsciiString((Standard_Integer)theGrade + 1);
835 switch (theFormVariance) {
836 case XCAFDimTolObjects_DimensionFormVariance_None:
837 aFormStr = new TCollection_HAsciiString("");
839 case XCAFDimTolObjects_DimensionFormVariance_A:
840 aFormStr = new TCollection_HAsciiString("A");
842 case XCAFDimTolObjects_DimensionFormVariance_B:
843 aFormStr = new TCollection_HAsciiString("B");
845 case XCAFDimTolObjects_DimensionFormVariance_C:
846 aFormStr = new TCollection_HAsciiString("C");
848 case XCAFDimTolObjects_DimensionFormVariance_CD:
849 aFormStr = new TCollection_HAsciiString("CD");
851 case XCAFDimTolObjects_DimensionFormVariance_D:
852 aFormStr = new TCollection_HAsciiString("D");
854 case XCAFDimTolObjects_DimensionFormVariance_E:
855 aFormStr = new TCollection_HAsciiString("E");
857 case XCAFDimTolObjects_DimensionFormVariance_EF:
858 aFormStr = new TCollection_HAsciiString("EF");
860 case XCAFDimTolObjects_DimensionFormVariance_F:
861 aFormStr = new TCollection_HAsciiString("F");
863 case XCAFDimTolObjects_DimensionFormVariance_FG:
864 aFormStr = new TCollection_HAsciiString("FG");
866 case XCAFDimTolObjects_DimensionFormVariance_G:
867 aFormStr = new TCollection_HAsciiString("G");
869 case XCAFDimTolObjects_DimensionFormVariance_H:
870 aFormStr = new TCollection_HAsciiString("H");
872 case XCAFDimTolObjects_DimensionFormVariance_JS:
873 aFormStr = new TCollection_HAsciiString("JS");
875 case XCAFDimTolObjects_DimensionFormVariance_J:
876 aFormStr = new TCollection_HAsciiString("J");
878 case XCAFDimTolObjects_DimensionFormVariance_K:
879 aFormStr = new TCollection_HAsciiString("K");
881 case XCAFDimTolObjects_DimensionFormVariance_M:
882 aFormStr = new TCollection_HAsciiString("M");
884 case XCAFDimTolObjects_DimensionFormVariance_N:
885 aFormStr = new TCollection_HAsciiString("N");
887 case XCAFDimTolObjects_DimensionFormVariance_P:
888 aFormStr = new TCollection_HAsciiString("P");
890 case XCAFDimTolObjects_DimensionFormVariance_R:
891 aFormStr = new TCollection_HAsciiString("R");
893 case XCAFDimTolObjects_DimensionFormVariance_S:
894 aFormStr = new TCollection_HAsciiString("S");
896 case XCAFDimTolObjects_DimensionFormVariance_T:
897 aFormStr = new TCollection_HAsciiString("T");
899 case XCAFDimTolObjects_DimensionFormVariance_U:
900 aFormStr = new TCollection_HAsciiString("U");
902 case XCAFDimTolObjects_DimensionFormVariance_V:
903 aFormStr = new TCollection_HAsciiString("V");
905 case XCAFDimTolObjects_DimensionFormVariance_X:
906 aFormStr = new TCollection_HAsciiString("X");
908 case XCAFDimTolObjects_DimensionFormVariance_Y:
909 aFormStr = new TCollection_HAsciiString("Y");
911 case XCAFDimTolObjects_DimensionFormVariance_Z:
912 aFormStr = new TCollection_HAsciiString("Z");
914 case XCAFDimTolObjects_DimensionFormVariance_ZA:
915 aFormStr = new TCollection_HAsciiString("ZA");
917 case XCAFDimTolObjects_DimensionFormVariance_ZB:
918 aFormStr = new TCollection_HAsciiString("ZB");
920 case XCAFDimTolObjects_DimensionFormVariance_ZC:
921 aFormStr = new TCollection_HAsciiString("ZC");
926 aHoleStr = new TCollection_HAsciiString("hole");
929 aHoleStr = new TCollection_HAsciiString("shaft");
930 aFormStr->LowerCase();
932 aLAF->Init(aFormStr, aHoleStr, aGradeStr, new TCollection_HAsciiString);
936 //=======================================================================
937 //function : GetDatumTargetName
939 //=======================================================================
940 Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetDatumTargetName(const XCAFDimTolObjects_DatumTargetType theDatumType)
942 Handle(TCollection_HAsciiString) aName;
943 switch (theDatumType) {
944 case XCAFDimTolObjects_DatumTargetType_Point:
945 aName = new TCollection_HAsciiString("point");
947 case XCAFDimTolObjects_DatumTargetType_Line:
948 aName = new TCollection_HAsciiString("line");
950 case XCAFDimTolObjects_DatumTargetType_Rectangle:
951 aName = new TCollection_HAsciiString("rectangle");
953 case XCAFDimTolObjects_DatumTargetType_Circle:
954 aName = new TCollection_HAsciiString("circle");
956 case XCAFDimTolObjects_DatumTargetType_Area:
957 aName = new TCollection_HAsciiString("area");
959 default: aName = new TCollection_HAsciiString();
964 //=======================================================================
965 //function : IsDimensionalSize
967 //=======================================================================
968 Standard_Boolean STEPCAFControl_GDTProperty::IsDimensionalLocation(const XCAFDimTolObjects_DimensionType theType)
970 if (theType == XCAFDimTolObjects_DimensionType_Location_None ||
971 theType == XCAFDimTolObjects_DimensionType_Location_CurvedDistance ||
972 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance ||
973 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter ||
974 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner ||
975 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter ||
976 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter ||
977 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner ||
978 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter ||
979 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter ||
980 theType == XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner ||
981 theType == XCAFDimTolObjects_DimensionType_Location_Oriented)
982 return Standard_True;
983 return Standard_False;
986 //=======================================================================
987 //function : IsDimensionalSize
989 //=======================================================================
990 Standard_Boolean STEPCAFControl_GDTProperty::IsDimensionalSize(const XCAFDimTolObjects_DimensionType theType)
992 if (theType == XCAFDimTolObjects_DimensionType_Size_CurveLength ||
993 theType == XCAFDimTolObjects_DimensionType_Size_Diameter ||
994 theType == XCAFDimTolObjects_DimensionType_Size_SphericalDiameter ||
995 theType == XCAFDimTolObjects_DimensionType_Size_Radius ||
996 theType == XCAFDimTolObjects_DimensionType_Size_SphericalRadius ||
997 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter ||
998 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter ||
999 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius ||
1000 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius ||
1001 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter ||
1002 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter ||
1003 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius ||
1004 theType == XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius ||
1005 theType == XCAFDimTolObjects_DimensionType_Size_Thickness)
1006 return Standard_True;
1007 return Standard_False;
1010 //=======================================================================
1011 //function : GetGeomToleranceType
1013 //=======================================================================
1014 StepDimTol_GeometricToleranceType STEPCAFControl_GDTProperty::GetGeomToleranceType(const XCAFDimTolObjects_GeomToleranceType theType)
1017 case XCAFDimTolObjects_GeomToleranceType_Angularity:
1018 return StepDimTol_GTTAngularityTolerance;
1019 case XCAFDimTolObjects_GeomToleranceType_CircularRunout:
1020 return StepDimTol_GTTCircularRunoutTolerance;
1021 case XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness:
1022 return StepDimTol_GTTRoundnessTolerance;
1023 case XCAFDimTolObjects_GeomToleranceType_Coaxiality:
1024 return StepDimTol_GTTCoaxialityTolerance;
1025 case XCAFDimTolObjects_GeomToleranceType_Concentricity:
1026 return StepDimTol_GTTConcentricityTolerance;
1027 case XCAFDimTolObjects_GeomToleranceType_Cylindricity:
1028 return StepDimTol_GTTCylindricityTolerance;
1029 case XCAFDimTolObjects_GeomToleranceType_Flatness:
1030 return StepDimTol_GTTFlatnessTolerance;
1031 case XCAFDimTolObjects_GeomToleranceType_Parallelism:
1032 return StepDimTol_GTTParallelismTolerance;
1033 case XCAFDimTolObjects_GeomToleranceType_Perpendicularity:
1034 return StepDimTol_GTTPerpendicularityTolerance;
1035 case XCAFDimTolObjects_GeomToleranceType_Position:
1036 return StepDimTol_GTTPositionTolerance;
1037 case XCAFDimTolObjects_GeomToleranceType_ProfileOfLine:
1038 return StepDimTol_GTTLineProfileTolerance;
1039 case XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface:
1040 return StepDimTol_GTTSurfaceProfileTolerance;
1041 case XCAFDimTolObjects_GeomToleranceType_Straightness:
1042 return StepDimTol_GTTStraightnessTolerance;
1043 case XCAFDimTolObjects_GeomToleranceType_Symmetry:
1044 return StepDimTol_GTTSymmetryTolerance;
1045 case XCAFDimTolObjects_GeomToleranceType_TotalRunout:
1046 return StepDimTol_GTTTotalRunoutTolerance;
1048 return StepDimTol_GTTPositionTolerance;
1052 //=======================================================================
1053 //function : GetGeomToleranceType
1055 //=======================================================================
1056 XCAFDimTolObjects_GeomToleranceType STEPCAFControl_GDTProperty::GetGeomToleranceType(const StepDimTol_GeometricToleranceType theType)
1059 case StepDimTol_GTTAngularityTolerance:
1060 return XCAFDimTolObjects_GeomToleranceType_Angularity;
1061 case StepDimTol_GTTCircularRunoutTolerance:
1062 return XCAFDimTolObjects_GeomToleranceType_CircularRunout;
1063 case StepDimTol_GTTRoundnessTolerance:
1064 return XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness;
1065 case StepDimTol_GTTCoaxialityTolerance:
1066 return XCAFDimTolObjects_GeomToleranceType_Coaxiality;
1067 case StepDimTol_GTTConcentricityTolerance:
1068 return XCAFDimTolObjects_GeomToleranceType_Concentricity;
1069 case StepDimTol_GTTCylindricityTolerance:
1070 return XCAFDimTolObjects_GeomToleranceType_Cylindricity;
1071 case StepDimTol_GTTFlatnessTolerance:
1072 return XCAFDimTolObjects_GeomToleranceType_Flatness;
1073 case StepDimTol_GTTParallelismTolerance:
1074 return XCAFDimTolObjects_GeomToleranceType_Parallelism;
1075 case StepDimTol_GTTPerpendicularityTolerance:
1076 return XCAFDimTolObjects_GeomToleranceType_Perpendicularity;
1077 case StepDimTol_GTTPositionTolerance:
1078 return XCAFDimTolObjects_GeomToleranceType_Position;
1079 case StepDimTol_GTTLineProfileTolerance:
1080 return XCAFDimTolObjects_GeomToleranceType_ProfileOfLine;
1081 case StepDimTol_GTTSurfaceProfileTolerance:
1082 return XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface;
1083 case StepDimTol_GTTStraightnessTolerance:
1084 return XCAFDimTolObjects_GeomToleranceType_Straightness;
1085 case StepDimTol_GTTSymmetryTolerance:
1086 return XCAFDimTolObjects_GeomToleranceType_Symmetry;
1087 case StepDimTol_GTTTotalRunoutTolerance:
1088 return XCAFDimTolObjects_GeomToleranceType_TotalRunout;
1090 return XCAFDimTolObjects_GeomToleranceType_Position;
1094 //=======================================================================
1095 //function : GetGeomTolerance
1097 //=======================================================================
1098 Handle(StepDimTol_GeometricTolerance) STEPCAFControl_GDTProperty::
1099 GetGeomTolerance(const XCAFDimTolObjects_GeomToleranceType theType)
1102 case XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness:
1103 return new StepDimTol_RoundnessTolerance();
1104 case XCAFDimTolObjects_GeomToleranceType_Cylindricity:
1105 return new StepDimTol_CylindricityTolerance();
1106 case XCAFDimTolObjects_GeomToleranceType_Flatness:
1107 return new StepDimTol_FlatnessTolerance();
1108 case XCAFDimTolObjects_GeomToleranceType_Position:
1109 return new StepDimTol_PositionTolerance();
1110 case XCAFDimTolObjects_GeomToleranceType_ProfileOfLine:
1111 return new StepDimTol_LineProfileTolerance();
1112 case XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface:
1113 return new StepDimTol_SurfaceProfileTolerance();
1114 case XCAFDimTolObjects_GeomToleranceType_Straightness:
1115 return new StepDimTol_StraightnessTolerance();
1121 //=======================================================================
1122 //function : GetGeomToleranceModifier
1124 //=======================================================================
1125 StepDimTol_GeometricToleranceModifier STEPCAFControl_GDTProperty::
1126 GetGeomToleranceModifier(const XCAFDimTolObjects_GeomToleranceModif theModifier)
1128 switch (theModifier) {
1129 case XCAFDimTolObjects_GeomToleranceModif_Any_Cross_Section:
1130 return StepDimTol_GTMAnyCrossSection;
1131 case XCAFDimTolObjects_GeomToleranceModif_Common_Zone:
1132 return StepDimTol_GTMCommonZone;
1133 case XCAFDimTolObjects_GeomToleranceModif_Each_Radial_Element:
1134 return StepDimTol_GTMEachRadialElement;
1135 case XCAFDimTolObjects_GeomToleranceModif_Free_State:
1136 return StepDimTol_GTMFreeState;
1137 case XCAFDimTolObjects_GeomToleranceModif_Least_Material_Requirement:
1138 return StepDimTol_GTMLeastMaterialRequirement;
1139 case XCAFDimTolObjects_GeomToleranceModif_Line_Element:
1140 return StepDimTol_GTMLineElement;
1141 case XCAFDimTolObjects_GeomToleranceModif_Major_Diameter:
1142 return StepDimTol_GTMMajorDiameter;
1143 case XCAFDimTolObjects_GeomToleranceModif_Maximum_Material_Requirement:
1144 return StepDimTol_GTMMaximumMaterialRequirement;
1145 case XCAFDimTolObjects_GeomToleranceModif_Minor_Diameter:
1146 return StepDimTol_GTMMinorDiameter;
1147 case XCAFDimTolObjects_GeomToleranceModif_Not_Convex:
1148 return StepDimTol_GTMNotConvex;
1149 case XCAFDimTolObjects_GeomToleranceModif_Pitch_Diameter:
1150 return StepDimTol_GTMPitchDiameter;
1151 case XCAFDimTolObjects_GeomToleranceModif_Reciprocity_Requirement:
1152 return StepDimTol_GTMReciprocityRequirement;
1153 case XCAFDimTolObjects_GeomToleranceModif_Separate_Requirement:
1154 return StepDimTol_GTMSeparateRequirement;
1155 case XCAFDimTolObjects_GeomToleranceModif_Statistical_Tolerance:
1156 return StepDimTol_GTMStatisticalTolerance;
1157 case XCAFDimTolObjects_GeomToleranceModif_Tangent_Plane:
1158 return StepDimTol_GTMTangentPlane;
1160 return StepDimTol_GTMMaximumMaterialRequirement;
1164 //=======================================================================
1165 //function : GetDatumRefModifiers
1166 //purpose : Note: this function does not add anything to model
1167 //=======================================================================
1168 Handle(StepDimTol_HArray1OfDatumReferenceModifier) STEPCAFControl_GDTProperty::
1169 GetDatumRefModifiers(const XCAFDimTolObjects_DatumModifiersSequence theModifiers,
1170 const XCAFDimTolObjects_DatumModifWithValue theModifWithVal,
1171 const Standard_Real theValue,
1172 const StepBasic_Unit theUnit)
1174 if ((theModifiers.Length() == 0) && (theModifWithVal == XCAFDimTolObjects_DatumModifWithValue_None))
1176 Standard_Integer aModifNb = theModifiers.Length();
1177 if (theModifWithVal != XCAFDimTolObjects_DatumModifWithValue_None)
1179 Handle(StepDimTol_HArray1OfDatumReferenceModifier) aModifiers =
1180 new StepDimTol_HArray1OfDatumReferenceModifier(1, aModifNb);
1182 // Modifier with value
1183 if (theModifWithVal != XCAFDimTolObjects_DatumModifWithValue_None) {
1184 StepDimTol_DatumReferenceModifierType aType;
1185 switch (theModifWithVal) {
1186 case XCAFDimTolObjects_DatumModifWithValue_CircularOrCylindrical:
1187 aType = StepDimTol_CircularOrCylindrical;
1189 case XCAFDimTolObjects_DatumModifWithValue_Distance:
1190 aType = StepDimTol_Distance;
1192 case XCAFDimTolObjects_DatumModifWithValue_Projected:
1193 aType = StepDimTol_Projected;
1195 case XCAFDimTolObjects_DatumModifWithValue_Spherical:
1196 aType = StepDimTol_Spherical;
1199 aType = StepDimTol_Distance;
1201 Handle(StepBasic_LengthMeasureWithUnit) aLMWU = new StepBasic_LengthMeasureWithUnit();
1202 Handle(StepBasic_MeasureValueMember) aValueMember = new StepBasic_MeasureValueMember();
1203 aValueMember->SetName("LENGTH_MEASURE");
1204 aValueMember->SetReal(theValue);
1205 aLMWU->Init(aValueMember, theUnit);
1206 Handle(StepDimTol_DatumReferenceModifierWithValue) aModifWithVal = new StepDimTol_DatumReferenceModifierWithValue();
1207 aModifWithVal->Init(aType, aLMWU);
1208 StepDimTol_DatumReferenceModifier aModif;
1209 aModif.SetValue(aModifWithVal);
1210 aModifiers->SetValue(aModifNb, aModif);
1214 for (Standard_Integer i = 1; i <= theModifiers.Length(); i++) {
1215 Handle(StepDimTol_SimpleDatumReferenceModifierMember) aSimpleModifMember =
1216 new StepDimTol_SimpleDatumReferenceModifierMember();
1217 switch (theModifiers.Value(i)) {
1218 case XCAFDimTolObjects_DatumSingleModif_AnyCrossSection:
1219 aSimpleModifMember->SetEnumText(0, ".ANY_CROSS_SECTION.");
1221 case XCAFDimTolObjects_DatumSingleModif_Any_LongitudinalSection:
1222 aSimpleModifMember->SetEnumText(0, ".ANY_LONGITUDINAL_SECTION.");
1224 case XCAFDimTolObjects_DatumSingleModif_Basic:
1225 aSimpleModifMember->SetEnumText(0, ".BASIC.");
1227 case XCAFDimTolObjects_DatumSingleModif_ContactingFeature:
1228 aSimpleModifMember->SetEnumText(0, ".CONTACTING_FEATURE.");
1230 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintU:
1231 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_U.");
1233 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintV:
1234 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_V.");
1236 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintW:
1237 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_W.");
1239 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintX:
1240 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_X.");
1242 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintY:
1243 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_Y.");
1245 case XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintZ:
1246 aSimpleModifMember->SetEnumText(0, ".DEGREE_OF_FREEDOM_CONSTRAINT_Z.");
1248 case XCAFDimTolObjects_DatumSingleModif_DistanceVariable:
1249 aSimpleModifMember->SetEnumText(0, ".DISTANCE_VARIABLE.");
1251 case XCAFDimTolObjects_DatumSingleModif_FreeState:
1252 aSimpleModifMember->SetEnumText(0, ".FREE_STATE.");
1254 case XCAFDimTolObjects_DatumSingleModif_LeastMaterialRequirement:
1255 aSimpleModifMember->SetEnumText(0, ".LEAST_MATERIAL_REQUIREMENT.");
1257 case XCAFDimTolObjects_DatumSingleModif_Line:
1258 aSimpleModifMember->SetEnumText(0, ".LINE.");
1260 case XCAFDimTolObjects_DatumSingleModif_MajorDiameter:
1261 aSimpleModifMember->SetEnumText(0, ".MAJOR_DIAMETER.");
1263 case XCAFDimTolObjects_DatumSingleModif_MaximumMaterialRequirement:
1264 aSimpleModifMember->SetEnumText(0, ".MAXIMUM_MATERIAL_REQUIREMENT.");
1266 case XCAFDimTolObjects_DatumSingleModif_MinorDiameter:
1267 aSimpleModifMember->SetEnumText(0, ".MINOR_DIAMETER.");
1269 case XCAFDimTolObjects_DatumSingleModif_Orientation:
1270 aSimpleModifMember->SetEnumText(0, ".ORIENTATION.");
1272 case XCAFDimTolObjects_DatumSingleModif_PitchDiameter:
1273 aSimpleModifMember->SetEnumText(0, ".PITCH_DIAMETER.");
1275 case XCAFDimTolObjects_DatumSingleModif_Plane:
1276 aSimpleModifMember->SetEnumText(0, ".PLANE.");
1278 case XCAFDimTolObjects_DatumSingleModif_Point:
1279 aSimpleModifMember->SetEnumText(0, ".POINT.");
1281 case XCAFDimTolObjects_DatumSingleModif_Translation:
1282 aSimpleModifMember->SetEnumText(0, ".TRANSLATION.");
1285 StepDimTol_DatumReferenceModifier aModif;
1286 aModif.SetValue(aSimpleModifMember);
1287 aModifiers->SetValue(i, aModif);
1293 //=======================================================================
1294 //function : GetTolValueType
1296 //=======================================================================
1297 Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetTolValueType(const XCAFDimTolObjects_GeomToleranceTypeValue& theType)
1300 case XCAFDimTolObjects_GeomToleranceTypeValue_Diameter:
1301 return new TCollection_HAsciiString("cylindrical or circular");
1302 case XCAFDimTolObjects_GeomToleranceTypeValue_SphericalDiameter:
1303 return new TCollection_HAsciiString("spherical");
1305 return new TCollection_HAsciiString("unknown");
1309 //=======================================================================
1310 //function : GetTessellation
1312 //=======================================================================
1313 Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape theShape)
1315 // Build coordinate list and curves
1316 NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger;
1317 NCollection_Vector<gp_XYZ> aCoords;
1318 Standard_Integer aPntNb = 1;
1319 for (TopExp_Explorer aCurveIt(theShape, TopAbs_EDGE); aCurveIt.More(); aCurveIt.Next()) {
1320 Handle(TColStd_HSequenceOfInteger) aCurve = new TColStd_HSequenceOfInteger;
1321 // Find out type of edge curve
1322 Standard_Real aFirst = 0, aLast = 0;
1323 Handle(Geom_Curve) anEdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aCurveIt.Current()), aFirst, aLast);
1324 if (anEdgeCurve.IsNull())
1327 if (anEdgeCurve->IsKind(STANDARD_TYPE(Geom_Line))) {
1328 for (TopExp_Explorer aVertIt(aCurveIt.Current(), TopAbs_VERTEX); aVertIt.More(); aVertIt.Next()) {
1329 aCoords.Append(BRep_Tool::Pnt(TopoDS::Vertex(aVertIt.Current())).XYZ());
1330 aCurve->Append(aPntNb);
1336 ShapeConstruct_Curve aSCC;
1337 Handle(Geom_BSplineCurve) aBSCurve = aSCC.ConvertToBSpline(anEdgeCurve,
1338 aFirst, aLast, Precision::Confusion());
1339 for (Standard_Integer i = 1; i <= aBSCurve->NbPoles(); i++) {
1340 aCoords.Append(aBSCurve->Pole(i).XYZ());
1341 aCurve->Append(aPntNb);
1345 aCurves->Append(aCurve);
1348 Handle(TColgp_HArray1OfXYZ) aPoints = new TColgp_HArray1OfXYZ(1, aCoords.Length());
1349 for (Standard_Integer i = 1; i <= aPoints->Length(); i++) {
1350 aPoints->SetValue(i, aCoords.Value(i - 1));
1353 Handle(StepVisual_CoordinatesList) aCoordList = new StepVisual_CoordinatesList();
1354 aCoordList->Init(new TCollection_HAsciiString(), aPoints);
1355 Handle(StepVisual_TessellatedCurveSet) aCurveSet = new StepVisual_TessellatedCurveSet();
1356 aCurveSet->Init(new TCollection_HAsciiString(), aCoordList, aCurves);
1357 NCollection_Handle<StepVisual_Array1OfTessellatedItem> aTessItems = new StepVisual_Array1OfTessellatedItem(1, 1);
1358 aTessItems->SetValue(1, aCurveSet);
1359 Handle(StepVisual_TessellatedGeometricSet) aGeomSet = new StepVisual_TessellatedGeometricSet();
1360 aGeomSet->Init(new TCollection_HAsciiString(), aTessItems);