diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index ed6444d425..cdd20cb327 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -229,6 +230,7 @@ #include #include #include +#include #include #include #include @@ -253,6 +255,8 @@ #include #include #include +#include +#include #include #include #include @@ -1621,104 +1625,6 @@ Standard_Boolean STEPCAFControl_Reader::ReadSHUOs (const Handle(XSControl_WorkSe return Standard_True; } - -//======================================================================= -//function : GetLengthConversionFactor -//purpose : -//======================================================================= -static Standard_Boolean GetLengthConversionFactor(const Handle(StepBasic_NamedUnit)& NU, - Standard_Real& afact) -{ - afact=1.; - if( !NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ) return Standard_False; - Handle(StepBasic_ConversionBasedUnitAndLengthUnit) CBULU = - Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(NU); - Handle(StepBasic_MeasureWithUnit) MWUCBU = CBULU->ConversionFactor(); - afact = MWUCBU->ValueComponent(); - StepBasic_Unit anUnit2 = MWUCBU->UnitComponent(); - if(anUnit2.CaseNum(anUnit2.Value())==1) { - Handle(StepBasic_NamedUnit) NU2 = anUnit2.NamedUnit(); - if(NU2->IsKind(STANDARD_TYPE(StepBasic_SiUnit))) { - Handle(StepBasic_SiUnit) SU = Handle(StepBasic_SiUnit)::DownCast(NU2); - if(SU->Name()==StepBasic_sunMetre) { - if(SU->HasPrefix()) - afact *= STEPConstruct_UnitContext::ConvertSiPrefix (SU->Prefix()); - // convert m to mm - afact *= 1000.; - } - } - } - return Standard_True; -} - -//======================================================================= -//function : GetLengthConversionFactorFromContext -//purpose : -//======================================================================= -static Standard_Boolean GetLengthConversionFactorFromContext(const Handle(StepRepr_RepresentationContext)& theRC, - Standard_Real& theFact) -{ - theFact = 1; - if (theRC.IsNull()) - return Standard_False; - Handle(StepBasic_ConversionBasedUnitAndLengthUnit) aSiLU; - Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) aCtx = - Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext)::DownCast(theRC); - if (!aCtx.IsNull()) { - for (Standard_Integer j = 1; j <= aCtx->NbUnits(); j++) { - if (aCtx->UnitsValue(j)->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) { - aSiLU = Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(aCtx->UnitsValue(j)); - break; - } - } - } - if (aSiLU.IsNull()) { - Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx) aCtx1 = - Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx)::DownCast(theRC); - if (!aCtx1.IsNull()) { - for (Standard_Integer j = 1; j <= aCtx1->NbUnits(); j++) { - if (aCtx1->UnitsValue(j)->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) { - aSiLU = Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(aCtx1->UnitsValue(j)); - break; - } - } - } - } - if (aSiLU.IsNull()) - return Standard_False; - return GetLengthConversionFactor(aSiLU, theFact); - -} - -//======================================================================= -//function : GetAngleConversionFactor -//purpose : -//======================================================================= -static Standard_Boolean GetAngleConversionFactor(Handle(StepBasic_NamedUnit)& NU, - Standard_Real& afact) -{ - afact=1.; - if( !NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)) ) return Standard_False; - Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit) CBULU = - Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)::DownCast(NU); - Handle(StepBasic_MeasureWithUnit) MWUCBU = CBULU->ConversionFactor(); - afact = MWUCBU->ValueComponent(); - StepBasic_Unit anUnit2 = MWUCBU->UnitComponent(); - if(anUnit2.CaseNum(anUnit2.Value())==1) { - Handle(StepBasic_NamedUnit) NU2 = anUnit2.NamedUnit(); - if(NU2->IsKind(STANDARD_TYPE(StepBasic_SiUnit))) { - Handle(StepBasic_SiUnit) SU = Handle(StepBasic_SiUnit)::DownCast(NU2); - if(SU->Name()==StepBasic_sunRadian) { - if(SU->HasPrefix()) - afact *= STEPConstruct_UnitContext::ConvertSiPrefix (SU->Prefix()); - // convert radian to deg - afact *= 180/M_PI; - } - } - } - return Standard_True; -} - //======================================================================= //function : GetMassConversionFactor //purpose : @@ -1893,7 +1799,6 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen //purpose : read annotation plane //======================================================================= Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) theAnnotationPlane, - const Standard_Real theFact, gp_Ax2& thePlane) { if (theAnnotationPlane.IsNull()) @@ -1914,13 +1819,8 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th if (aA2P3D.IsNull()) return Standard_False; - gp_Ax2 aPlaneAxes; Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D); - aPlaneAxes = anAxis->Ax2(); - gp_XYZ aLocPos = aPlaneAxes.Location().XYZ(); - aLocPos *= theFact; - aPlaneAxes.SetLocation(aLocPos); - thePlane = aPlaneAxes; + thePlane = anAxis->Ax2(); return Standard_True; } @@ -1958,9 +1858,10 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR, // calculate units Handle(StepVisual_DraughtingModel) aDModel = Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation()); - Standard_Real aFact = 1; - if (!aDModel.IsNull()) - GetLengthConversionFactorFromContext(aDModel->ContextOfItems(), aFact); + XSAlgo::AlgoContainer()->PrepareForTransfer(); + STEPControl_ActorRead anActor; + anActor.PrepareUnits(aDModel, aTP); + Standard_Real aFact = UnitsMethods::LengthFactor(); // retrieve AnnotationPlane Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1); @@ -1972,7 +1873,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR, for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) { anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value()); } - Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aFact, aPlaneAxes); + Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes); // set plane axes to XCAF if (isHasPlane) { @@ -2052,14 +1953,15 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR, const Interface_Graph& aGraph = aTP->Graph(); //calculate units - Standard_Real aFact = 1; Handle(StepShape_ShapeDimensionRepresentation) aSDR = NULL; for (Interface_EntityIterator anIt = aGraph.Sharings(theGDT); aSDR.IsNull() && anIt.More(); anIt.Next()) { aSDR = Handle(StepShape_ShapeDimensionRepresentation)::DownCast(anIt.Value()); } - if (!aSDR.IsNull()) - GetLengthConversionFactorFromContext(aSDR->ContextOfItems(), aFact); - + XSAlgo::AlgoContainer()->PrepareForTransfer(); + STEPControl_ActorRead anActor; + anActor.PrepareUnits(aSDR, aTP); + Standard_Real aFact = UnitsMethods::LengthFactor(); + if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) { // retrieve derived geometry Handle(StepShape_DimensionalSize) aDim = Handle(StepShape_DimensionalSize)::DownCast(theGDT); @@ -2459,6 +2361,9 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D { Handle(StepGeom_Axis2Placement3d) anAx = Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j)); + XSAlgo::AlgoContainer()->PrepareForTransfer(); + STEPControl_ActorRead anActor; + anActor.PrepareUnits(aSRWP, aTP); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx); aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2()); } @@ -2468,14 +2373,14 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(aSRWP->ItemsValue(j)); Standard_Real aVal = aM->GetMeasureWithUnit()->ValueComponent(); StepBasic_Unit anUnit = aM->GetMeasureWithUnit()->UnitComponent(); - Standard_Real aFact = 1.; if (anUnit.IsNull()) continue; Handle(StepBasic_NamedUnit) aNU = anUnit.NamedUnit(); if (aNU.IsNull()) continue; - if (GetLengthConversionFactor(aNU, aFact)) - aVal = aVal * aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(aNU); + aVal = aVal * anUnitCtx.LengthFactor(); if (aM->Name()->String().IsEqual("target length") || aM->Name()->String().IsEqual("target diameter")) aDatTargetObj->SetDatumTargetLength(aVal); @@ -2626,12 +2531,12 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModif->Value(m).DatumReferenceModifierWithValue()->ModifierType() + 1); Standard_Real aVal = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent(); StepBasic_Unit anUnit = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact; - aModifValue = aVal; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + aModifValue = aVal * anUnitCtx.LengthFactor(); } } } @@ -2663,12 +2568,12 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierType() + 1); Standard_Real aVal = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent(); StepBasic_Unit anUnit = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact; - aModifValue = aVal; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + aModifValue = aVal * anUnitCtx.LengthFactor(); } } } @@ -2863,11 +2768,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI1); dim1 = RILMWU->GetMeasureWithUnit()->ValueComponent(); StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent(); - Standard_Real afact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,afact)) dim1=dim1*afact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + dim1 = dim1 * anUnitCtx.LengthFactor(); } } if(HARI->Length()>1) { @@ -2878,11 +2784,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI2); dim2 = RILMWU->GetMeasureWithUnit()->ValueComponent(); StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent(); - Standard_Real afact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,afact)) dim2 = dim2*afact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + dim2 = dim2 * anUnitCtx.LengthFactor(); } } } @@ -2918,11 +2825,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra if(dim3.IsNull()) continue; Standard_Real dim = dim3->ValueComponent(); StepBasic_Unit anUnit = GT->Magnitude()->UnitComponent(); - Standard_Real afact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,afact)) dim = dim*afact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + dim = dim * anUnitCtx.LengthFactor(); //cout<<"GeometricTolerance: Magnitude = "<SetValue(1,dim); @@ -3146,6 +3054,25 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra return aGDTL; } +//======================================================================= +//function : convertAngleValue +//purpose : auxilary +//======================================================================= +void convertAngleValue( + const STEPConstruct_UnitContext& anUnitCtx, + Standard_Real& aVal) +{ + // convert radian to deg + Standard_Real aFact = anUnitCtx.PlaneAngleFactor() * 180 / M_PI; + // in order to avoid inaccuracy of calculation perform conversion + // only if aFact not eqaul 1 with some precision + if (fabs(1. - aFact) > Precision::Confusion()) + { + aVal = aVal * aFact; + } +} + + //======================================================================= //function : setDimObjectToXCAF //purpose : @@ -3212,20 +3139,19 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, Handle(StepRepr_ReprItemAndMeasureWithUnit)::DownCast(aDRI); Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent(); StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent(); - Standard_Real aFact = 1.; if (anUnit.IsNull()) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) { - if (GetLengthConversionFactor(NU, aFact)) - aVal = aVal * aFact; + aVal = aVal * anUnitCtx.LengthFactor(); } else if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit))) { - if (GetAngleConversionFactor(NU, aFact)) - aVal = aVal * aFact; + convertAngleValue(anUnitCtx, aVal); } Handle(TCollection_HAsciiString) aName = aMWU->Name(); if (aName->Search("upper") > 0) // upper limit @@ -3239,20 +3165,19 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, Handle(StepRepr_ReprItemAndMeasureWithUnitAndQRI)::DownCast(aDRI); Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent(); StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent(); - Standard_Real aFact = 1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value()) == 1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) { - if (GetLengthConversionFactor(NU, aFact)) - aVal = aVal * aFact; + aVal = aVal * anUnitCtx.LengthFactor(); } else if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) { - if (GetAngleConversionFactor(NU, aFact)) - aVal = aVal * aFact; + convertAngleValue(anUnitCtx, aVal); } Handle(StepShape_QualifiedRepresentationItem) aQRI = aMWU->GetQualifiedRepresentationItem(); if (aQRI->Qualifiers()->Length() == 0) { @@ -3305,22 +3230,43 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, aTV = aTMD.ToleranceValue(); if (aTV.IsNull()) continue; + Handle(StepBasic_MeasureWithUnit) aMWU = aTV->UpperBound(); Standard_Real aVal = aTV->UpperBound()->ValueComponent(); StepBasic_Unit anUnit = aTV->UpperBound()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) || + aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) + { + aVal = aVal * anUnitCtx.LengthFactor(); + } + else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) || + aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) + { + convertAngleValue(anUnitCtx, aVal); + } aDim3 = aVal; + aMWU = aTV->LowerBound(); aVal = aTV->LowerBound()->ValueComponent(); anUnit = aTV->LowerBound()->UnitComponent(); - aFact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact; + anUnitCtx.ComputeFactors(NU); + if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) || + aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) + { + aVal = aVal * anUnitCtx.LengthFactor(); + } + else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) || + aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) + { + convertAngleValue(anUnitCtx, aVal); + } aDim2 = Abs(aVal); } else @@ -3664,12 +3610,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, //get value Standard_Real aVal = aTolEnt->Magnitude()->ValueComponent(); StepBasic_Unit anUnit = aTolEnt->Magnitude()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) return; if( !(anUnit.CaseNum(anUnit.Value())==1) ) return; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) - aVal=aVal*aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + aVal = aVal * anUnitCtx.LengthFactor(); aTolObj->SetValue(aVal); } //get modifiers @@ -3689,12 +3635,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, { Standard_Real aVal = aPZone->ProjectionLength()->ValueComponent(); StepBasic_Unit anUnit = aPZone->ProjectionLength()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) return; if( !(anUnit.CaseNum(anUnit.Value())==1) ) return; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetLengthConversionFactor(NU,aFact)) - aVal=aVal*aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + aVal = aVal * anUnitCtx.LengthFactor(); aTolObj->SetValueOfZoneModifier(aVal); aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected); } @@ -3707,11 +3653,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, { Standard_Real aVal = aRZone->Orientation()->Angle()->ValueComponent(); StepBasic_Unit anUnit = aRZone->Orientation()->Angle()->UnitComponent(); - Standard_Real aFact=1.; if(anUnit.IsNull()) continue; if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetAngleConversionFactor(NU,aFact)) aVal=aVal*aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + convertAngleValue(anUnitCtx, aVal); aTolObj->SetValueOfZoneModifier(aVal); aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout); } @@ -3781,9 +3728,10 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, } if (!anUnit.IsNull() && (anUnit.CaseNum(anUnit.Value()) == 1)) { - Standard_Real aFact=1.; Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); - if(GetAngleConversionFactor(NU,aFact)) aVal=aVal*aFact; + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + convertAngleValue(anUnitCtx, aVal); aTolObj->SetMaxValueModifier(aVal); } @@ -3910,8 +3858,14 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess // Calculate unit Standard_Real aFact = 1.0; - if (!aDMIA.IsNull() && !aDMIA->UsedRepresentation().IsNull()) - GetLengthConversionFactorFromContext(aDMIA->UsedRepresentation()->ContextOfItems(), aFact); + if (!aDMIA.IsNull()) + { + XSAlgo::AlgoContainer()->PrepareForTransfer(); + STEPControl_ActorRead anActor; + Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP); + aFact = UnitsMethods::LengthFactor(); + } // Presentation TopoDS_Shape aPresentation; @@ -3944,7 +3898,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL); gp_Ax2 aPlaneAxes; if (!anAnPlane.IsNull()) { - if (readAnnotationPlane(anAnPlane, aFact, aPlaneAxes)) + if (readAnnotationPlane(anAnPlane, aPlaneAxes)) aDimObj->SetPlane(aPlaneAxes); } aDimObj->SetPresentation(aPresentation, aPresentName); @@ -4064,15 +4018,23 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor for(Standard_Integer idu=1; idu<=DU->NbElements(); idu++) { Handle(StepBasic_DerivedUnitElement) DUE = DU->ElementsValue(idu); Handle(StepBasic_NamedUnit) NU = DUE->Unit(); - Standard_Real afact=1.; - if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) { - if(GetLengthConversionFactor(NU,afact)) aDensity = aDensity/(afact*afact*afact); + if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) || + NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit))) + { + STEPConstruct_UnitContext anUnitCtx; + anUnitCtx.ComputeFactors(NU); + aDensity = aDensity / (anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()); // transfer length value for Density from millimeter to santimeter // in order to result density has dimension gram/(sm*sm*sm) - aDensity = aDensity*1000.; + aDensity = aDensity*1000. / (UnitsMethods::GetCasCadeLengthUnit() + * UnitsMethods::GetCasCadeLengthUnit() * UnitsMethods::GetCasCadeLengthUnit()); } if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) { - if(GetMassConversionFactor(NU,afact)) aDensity=aDensity*afact; + Standard_Real afact = 1.; + if (GetMassConversionFactor(NU, afact)) + { + aDensity = aDensity*afact; + } } } } @@ -4226,6 +4188,28 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes Handle(XCAFView_Object) anObj = new XCAFView_Object(); // Import attributes of view Handle(StepVisual_CameraModelD3) aCameraModel = Handle(StepVisual_CameraModelD3)::DownCast(anEnt); + + const Handle(XSControl_TransferReader)& aTR = theWS->TransferReader(); + Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Interface_Graph& aGraph = aTP->Graph(); + // find the proper DraughtingModel + Interface_EntityIterator subs = aGraph.Sharings(aCameraModel); + Handle(StepVisual_DraughtingModel) aDModel; + for (subs.Start(); subs.More() && aDModel.IsNull(); subs.Next()) + { + if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingModel))) + { + continue; + } + aDModel = Handle(StepVisual_DraughtingModel)::DownCast(subs.Value()); + } + if (!aDModel.IsNull()) + { + XSAlgo::AlgoContainer()->PrepareForTransfer(); + STEPControl_ActorRead anActor; + anActor.PrepareUnits(aDModel, aTP); + } + anObj->SetName(aCameraModel->Name()); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem()); anObj->SetViewDirection(anAxis->Direction()); @@ -4257,20 +4241,12 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool); anObj->SetClippingExpression(aClippingExpression); } + // Collect shapes and GDTs - TDF_LabelSequence aShapes, aGDTs; - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); - Handle(StepVisual_DraughtingModel) aDModel; - Interface_EntityIterator anIter = aGraph.Sharings(aCameraModel); - for (; anIter.More() && aDModel.IsNull(); anIter.Next()) { - aDModel = Handle(StepVisual_DraughtingModel)::DownCast(anIter.Value()); - } if (aDModel.IsNull()) return Standard_False; - - anIter = aGraph.Shareds(aDModel); + TDF_LabelSequence aShapes, aGDTs; + Interface_EntityIterator anIter = aGraph.Shareds(aDModel); for (; anIter.More(); anIter.Next()) { if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) { Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value()); diff --git a/tests/gdt/import/A1 b/tests/gdt/import/A1 index 5c867ff0b4..61dc23cb14 100644 --- a/tests/gdt/import/A1 +++ b/tests/gdt/import/A1 @@ -79,9 +79,9 @@ set ref_data { 0:1:1:1:22 Shape.23 0:1:4:21 Dimension.23.1 ( N "diameter" T 15, V 20, VL 0.050000000000000003, VU 0.10000000000000001, P 0 ) 0:1:1:1:23 Shape.24 - 0:1:4:22 Dimension.24.1 ( N "angle" T 11, V 59.999999999851163, VL 0.5, VU 0.5, Q 3, P 0 ) + 0:1:4:22 Dimension.24.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, Q 3, P 0 ) 0:1:1:1:24 Shape.25 - 0:1:4:22 Dimension.25.1 ( N "angle" T 11, V 59.999999999851163, VL 0.5, VU 0.5, Q 3, P 0 ) + 0:1:4:22 Dimension.25.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, Q 3, P 0 ) 0:1:1:1:25 Shape.26 0:1:4:23 Dimension.26.1 ( N "diameter" T 15, LB 34.799999999999997, UB 35.200000000000003, P 0 ) 0:1:1:1:26 Shape.27 diff --git a/tests/gdt/import/A3 b/tests/gdt/import/A3 index 8274c76b3d..e222d568eb 100644 --- a/tests/gdt/import/A3 +++ b/tests/gdt/import/A3 @@ -12,45 +12,45 @@ set ref_data { 0:1:1:2:2 Shape.5 0:1:4:1 GeomTolerance.5.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 ) 0:1:1:2:7 Shape.10 - 0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 ) 0:1:1:2:19 Shape.22 - 0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:35 GeomTolerance.22.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:36 Datum.22.1.1 ( N "Feature Control Frame (40)" ) 0:1:4:37 Datum.22.1.2 ( N "Feature Control Frame (40)", M 15 ) 0:1:4:38 Datum.22.1.3 ( N "Feature Control Frame (40)", M 15 ) 0:1:1:2:20 Shape.23 - 0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:35 GeomTolerance.23.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:36 Datum.23.1.1 ( N "Feature Control Frame (40)" ) 0:1:4:37 Datum.23.1.2 ( N "Feature Control Frame (40)", M 15 ) 0:1:4:38 Datum.23.1.3 ( N "Feature Control Frame (40)", M 15 ) 0:1:1:2:21 Shape.24 - 0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:35 GeomTolerance.24.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:36 Datum.24.1.1 ( N "Feature Control Frame (40)" ) 0:1:4:37 Datum.24.1.2 ( N "Feature Control Frame (40)", M 15 ) 0:1:4:38 Datum.24.1.3 ( N "Feature Control Frame (40)", M 15 ) 0:1:1:2:22 Shape.25 - 0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:35 GeomTolerance.25.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:36 Datum.25.1.1 ( N "Feature Control Frame (40)" ) 0:1:4:37 Datum.25.1.2 ( N "Feature Control Frame (40)", M 15 ) 0:1:4:38 Datum.25.1.3 ( N "Feature Control Frame (40)", M 15 ) 0:1:1:2:28 Shape.31 - 0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 ) 0:1:4:2 GeomTolerance.31.1 ( N "Feature Control Frame (24)" T 12 TV 0, V 0.76200000000000001 ) 0:1:4:3 Datum.31.1.1 ( N "Feature Control Frame (24)" ) 0:1:4:4 Datum.31.1.2 ( N "Feature Control Frame (24)" ) 0:1:4:5 Datum.31.1.3 ( N "Feature Control Frame (24)" ) 0:1:1:2:39 Shape.42 - 0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 ) 0:1:4:15 GeomTolerance.42.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 ) 0:1:4:16 Datum.42.1.1 ( N "Feature Control Frame (16)" ) 0:1:4:17 Datum.42.1.2 ( N "Feature Control Frame (16)" ) 0:1:4:18 Datum.42.1.3 ( N "Feature Control Frame (16)" ) 0:1:1:2:40 Shape.43 - 0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 ) 0:1:4:15 GeomTolerance.43.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 ) 0:1:4:16 Datum.43.1.1 ( N "Feature Control Frame (16)" ) 0:1:4:17 Datum.43.1.2 ( N "Feature Control Frame (16)" ) @@ -58,7 +58,7 @@ set ref_data { 0:1:1:2:48 Shape.51 0:1:4:30 Dimension.51.1 ( N "linear distance" T 2, V 19.049999999999997, P 0 ) 0:1:1:2:49 Shape.52 - 0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 ) 0:1:4:20 GeomTolerance.52.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 ) 0:1:4:21 Datum.52.1.1 ( N "Feature Control Frame (18)" ) 0:1:4:22 Datum.52.1.2 ( N "Feature Control Frame (18)" ) @@ -68,7 +68,7 @@ set ref_data { 0:1:4:27 Datum.52.2.2 ( N "Feature Control Frame (20)" ) 0:1:4:28 Datum.52.2.3 ( N "Feature Control Frame (20)" ) 0:1:1:2:50 Shape.53 - 0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 ) 0:1:4:24 Dimension.53.2 ( N "linear distance" T 2, V 38.099999999999994, P 0 ) 0:1:4:20 GeomTolerance.53.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 ) 0:1:4:21 Datum.53.1.1 ( N "Feature Control Frame (18)" ) @@ -79,49 +79,49 @@ set ref_data { 0:1:4:27 Datum.53.2.2 ( N "Feature Control Frame (20)" ) 0:1:4:28 Datum.53.2.3 ( N "Feature Control Frame (20)" ) 0:1:1:2:51 Shape.54 - 0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.54.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.54.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.54.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.54.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:52 Shape.55 - 0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.55.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.55.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.55.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.55.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:53 Shape.56 - 0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.56.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.56.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.56.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.56.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:54 Shape.57 - 0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.57.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.57.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.57.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.57.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:55 Shape.58 - 0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.58.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.58.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.58.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.58.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:56 Shape.59 - 0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.59.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.59.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.59.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.59.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:57 Shape.60 - 0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.60.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.60.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.60.1.2 ( N "Feature Control Frame (36)" ) 0:1:4:34 Datum.60.1.3 ( N "Feature Control Frame (36)" ) 0:1:1:2:58 Shape.61 - 0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 ) 0:1:4:31 GeomTolerance.61.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 ) 0:1:4:32 Datum.61.1.1 ( N "Feature Control Frame (36)" ) 0:1:4:33 Datum.61.1.2 ( N "Feature Control Frame (36)" ) @@ -137,28 +137,28 @@ set ref_data { 0:1:1:2:129 Shape.132 0:1:4:1 GeomTolerance.132.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 ) 0:1:1:2:134 Shape.137 - 0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 ) 0:1:4:41 GeomTolerance.137.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 ) 0:1:4:42 Datum.137.1.1 ( N "Feature Control Frame (30)" ) 0:1:1:2:135 Shape.138 - 0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 ) 0:1:4:41 GeomTolerance.138.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 ) 0:1:4:42 Datum.138.1.1 ( N "Feature Control Frame (30)" ) 0:1:1:2:153 Shape.156 - 0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:9 GeomTolerance.156.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 ) 0:1:4:10 Datum.156.1.1 ( N "Feature Control Frame (10)" ) 0:1:1:2:154 Shape.157 - 0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:9 GeomTolerance.157.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 ) 0:1:4:10 Datum.157.1.1 ( N "Feature Control Frame (10)" ) 0:1:1:2:155 Shape.158 - 0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:11 GeomTolerance.158.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 ) 0:1:4:12 Datum.158.1.1 ( N "Feature Control Frame (11)" ) 0:1:4:13 Datum.158.1.2 ( N "Feature Control Frame (11)" ) 0:1:1:2:156 Shape.159 - 0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 ) 0:1:4:11 GeomTolerance.159.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 ) 0:1:4:12 Datum.159.1.1 ( N "Feature Control Frame (11)" ) 0:1:4:13 Datum.159.1.2 ( N "Feature Control Frame (11)" ) diff --git a/tests/gdt/import/A4 b/tests/gdt/import/A4 index e75887db51..8dff90ed4f 100644 --- a/tests/gdt/import/A4 +++ b/tests/gdt/import/A4 @@ -414,9 +414,9 @@ set ref_data { 0:1:1:2:157 Shape.160 0:1:4:32 Dimension.160.1 ( N "diameter" T 15, V 20, VL 0.29999999999999999, VU 0.29999999999999999, P 0 ) 0:1:1:2:158 Shape.161 - 0:1:4:33 Dimension.161.1 ( N "angle" T 11, V 89.999999999776747, VL 1, VU 1, Q 3, P 0 ) + 0:1:4:33 Dimension.161.1 ( N "angle" T 11, V 90, VL 1, VU 1, Q 3, P 0 ) 0:1:1:2:159 Shape.162 - 0:1:4:33 Dimension.162.1 ( N "angle" T 11, V 89.999999999776747, VL 1, VU 1, Q 3, P 0 ) + 0:1:4:33 Dimension.162.1 ( N "angle" T 11, V 90, VL 1, VU 1, Q 3, P 0 ) 0:1:1:3:1 Shape.163 0:1:4:19 GeomTolerance.163.1 ( N "Position surface profile.4" T 12 TV 0, V 0.5 ) 0:1:4:20 Datum.163.1.1 ( N "Position surface profile.4" ) diff --git a/tests/gdt/import/A5 b/tests/gdt/import/A5 index 6b689aa0ab..f27f3ac388 100644 --- a/tests/gdt/import/A5 +++ b/tests/gdt/import/A5 @@ -10,9 +10,9 @@ set ref_data { NbOfDatumTarget : 2 0:1:1:2:2 Shape.5 - 0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 ) 0:1:1:2:8 Shape.11 - 0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 ) 0:1:1:2:9 Shape.12 0:1:4:1 GeomTolerance.12.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 ) 0:1:1:2:66 Shape.69 @@ -57,9 +57,9 @@ set ref_data { 0:1:4:7 GeomTolerance.203.1 ( N "Feature Control Frame (4)" T 2 TV 0, V 0.050799999999999998 ) 0:1:4:8 Datum.203.1.1 ( N "Feature Control Frame (4)" ) 0:1:1:2:206 Shape.209 - 0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 ) 0:1:1:2:207 Shape.210 - 0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 ) + 0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 ) 0:1:1:3:1 Shape.211 0:1:4:1 GeomTolerance.211.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 ) } diff --git a/tests/gdt/view/A3 b/tests/gdt/view/A3 index 13d1b4cf53..9f1a7d0437 100644 --- a/tests/gdt/view/A3 +++ b/tests/gdt/view/A3 @@ -1,7 +1,7 @@ set filename bug27645_nist_ftc_06_asme1_cr3000_rd.prt.stp set ref_data { -D_First 0:1:7:1 2 18 0 MBD_A parallel 1003.2130229675 933.1983040089 -966.2677894877 -0.5983635664 -0.5566034856 0.5763276865 -0.34864265817483364 0.82851635272424506 0.43818825882182255 20.0 40.0 40.0 -D_First 0:1:7:2 2 3 0 MBD_B parallel -1003.2130229675 933.1983040089 966.2677894877 0.5983635664 -0.5566034856 -0.5763276865 0.34864265817483364 0.82851635272424506 -0.43818825882182255 20.0 40.0 40.0 -D_First 0:1:7:3 2 8 0 MBD_C parallel 0.0 1359.2608224096 -1359.2608224096 -0.0 -0.7071067812 0.7071067812 0 0.70710678118654757 0.70710678118654757 20.0 40.0 40.0 +D_First 0:1:7:1 2 18 0 MBD_A parallel 25481.6107833745 23703.2369218261 -24543.2018529876 -0.5983635664 -0.5566034856 0.5763276865 -0.34864265817483364 0.82851635272424506 0.43818825882182255 20.0 40.0 40.0 +D_First 0:1:7:2 2 3 0 MBD_B parallel -25481.6107833745 23703.2369218261 24543.2018529876 0.5983635664 -0.5566034856 -0.5763276865 0.34864265817483364 0.82851635272424506 -0.43818825882182255 20.0 40.0 40.0 +D_First 0:1:7:3 2 8 0 MBD_C parallel 0 34525.2248892038 -34525.22488920386 -0.0 -0.7071067812 0.7071067812 0 0.70710678118654757 0.70710678118654757 20.0 40.0 40.0 } diff --git a/tests/gdt/view/A4 b/tests/gdt/view/A4 index 7af57bb51e..59b20071d8 100644 --- a/tests/gdt/view/A4 +++ b/tests/gdt/view/A4 @@ -1,7 +1,7 @@ set filename bug27808_nist_ftc_06_asme1_ct5240_rd.stp set ref_data { -D_First 0:1:7:1 2 30 0 MBD_A parallel 30.8084683155 26.0037688008 -25.0004637711 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 -D_First 0:1:7:2 2 16 0 MBD_B central -31.9257504921 33.3287805272 27.9693987989 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 1349.3127441406 647.8826584485 647.8826584485 -D_First 0:1:7:3 2 24 0 MBD_C central -0.4196386262 31.1460383858 -33.088921975 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 +D_First 0:1:7:1 2 30 0 MBD_A parallel 782.5350952137 660.49572754032 -635.01177978594 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 +D_First 0:1:7:2 2 16 0 MBD_B central -810.91406249934 846.55102539088 710.42272949206 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 1349.3127441406 647.8826584485 647.8826584485 +D_First 0:1:7:3 2 24 0 MBD_C central -10.65882110548 791.10937499932 -840.45861816 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 } diff --git a/tests/gdt/view/A5 b/tests/gdt/view/A5 index e8ae8d6a99..c02eda4210 100644 --- a/tests/gdt/view/A5 +++ b/tests/gdt/view/A5 @@ -1,6 +1,6 @@ set filename bug27645_nist_ftc_06_asme1_ct5240_rd-1.stp set ref_data { -D_First 0:1:7:1 2 29 0 MBD_A parallel 782.5350952148 660.4957275391 -635.0117797852 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 -D_First 0:1:7:2 2 18 0 MBD_C central -10.658821106 791.109375 -840.4586181641 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 +D_First 0:1:7:1 2 29 0 MBD_A parallel 19876.3914184559 16776.5914794931 -16129.2992065441 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 +D_First 0:1:7:2 2 18 0 MBD_C central -270.7340560924 20094.178125 -21347.6489013681 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 } diff --git a/tests/gdt/view/A6 b/tests/gdt/view/A6 index 05ff109248..e36bd2fbe2 100644 --- a/tests/gdt/view/A6 +++ b/tests/gdt/view/A6 @@ -1,8 +1,8 @@ set filename bug27645_nist_ftc_08_asme1_cr3000_rc.prt.stp set ref_data { -D_First 0:1:7:1 3 8 0 MBD_A parallel 960.208198256 960.2081982559 -996.2072738181 -0.5701373455 -0.5701373455 0.5915123113 -0.41826236649918141 -0.41826236649918141 -0.80629596646703439 20.0 40.0 40.0 -D_First 0:1:7:2 3 6 0 MBD_B parallel 960.208198256 -960.2081982559 996.2072738181 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 -D_First 0:1:7:3 3 3 0 MBD_C parallel 960.208198256 -960.2081982559 996.2072738181 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 -D_First 0:1:7:4 3 8 0 MBD_D parallel 960.2081982559 960.2081982559 996.2072738181 -0.5701373455 -0.5701373455 -0.5915123113 -0.41826236649918141 -0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:1 3 8 0 MBD_A parallel 24389.2882357024 24389.2882356999 -25303.6647549797 -0.5701373455 -0.5701373455 0.5915123113 -0.41826236649918141 -0.41826236649918141 -0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:2 3 6 0 MBD_B parallel 24389.2882357024 -24389.2882356999 25303.6647549797 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:3 3 3 0 MBD_C parallel 24389.2882357024 -24389.2882356999 25303.664754979 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:4 3 8 0 MBD_D parallel 24389.2882356999 24389.2882356999 25303.6647549797 -0.5701373455 -0.5701373455 -0.5915123113 -0.41826236649918141 -0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 } diff --git a/tests/gdt/view/A7 b/tests/gdt/view/A7 index 4b714335de..0b024fc66e 100644 --- a/tests/gdt/view/A7 +++ b/tests/gdt/view/A7 @@ -1,8 +1,8 @@ set filename bug27808_nist_ftc_08_asme1_ct5240_rc.stp set ref_data { -D_First 0:1:7:1 3 15 0 MBD_A parallel 20.6276528666 24.7090209 -21.2968288632 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386302 -0.40824829046386302 -0.81649658092772603 1133.0983886719 544.065710136 544.065710136 -D_First 0:1:7:2 3 18 0 MBD_B parallel 21.6691096749 -22.3932077002 22.6894396684 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 -D_First 0:1:7:3 3 6 0 MBD_C central 22.5691379337 -20.4109059732 21.0932597964 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 856.7503051758 411.3751002162 411.3751002162 -D_First 0:1:7:4 3 14 0 MBD_D parallel 23.6742659441 21.3498117041 22.1304297259 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386302 -0.40824829046386302 0.81649658092772603 891.8790283203 428.2424207374 428.2424207374 +D_First 0:1:7:1 3 15 0 MBD_A parallel 523.94238281164 627.60913086 -540.93945312528 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386302 -0.40824829046386302 -0.81649658092772603 1133.0983886719 544.065710136 544.065710136 +D_First 0:1:7:2 3 18 0 MBD_B parallel 550.39538574246 -568.78747558508 576.31176757736 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 +D_First 0:1:7:3 3 6 0 MBD_C central 573.25610351598 -518.43701171928 535.76879882856 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 856.7503051758 411.3751002162 411.3751002162 +D_First 0:1:7:4 3 14 0 MBD_D parallel 601.32635498014 542.28521728414 562.11291503786 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386302 -0.40824829046386302 0.81649658092772603 891.8790283203 428.2424207374 428.2424207374 } diff --git a/tests/gdt/view/A8 b/tests/gdt/view/A8 index c578c299cf..9d5b54ff10 100644 --- a/tests/gdt/view/A8 +++ b/tests/gdt/view/A8 @@ -1,5 +1,5 @@ set filename bug27645_nist_ftc_08_asme1_ct5240_rc-1.stp set ref_data { -D_First 0:1:7:1 3 18 0 MBD_B parallel 550.3953857422 -568.7874755859 576.3117675781 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 +D_First 0:1:7:1 3 18 0 MBD_B parallel 13980.0427978519 -14447.2018798819 14638.318896483 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 } diff --git a/tests/gdt/view/A9 b/tests/gdt/view/A9 index 2d4630de8b..974abd3b47 100644 --- a/tests/gdt/view/A9 +++ b/tests/gdt/view/A9 @@ -1,8 +1,8 @@ set filename bug27645_nist_ftc_09_asme1_cr3000_rd.prt.stp set ref_data { -D_First 0:1:7:1 2 11 0 MBD_A parallel -1175.8873057482 925.9850617285 1405.1817250125 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 -D_First 0:1:7:2 2 8 0 MBD_B parallel -1175.8873057482 925.9850617285 1405.1817250125 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 -D_First 0:1:7:3 2 6 0 MBD_C parallel -951.665243989 749.4151823838 1137.2370486915 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 -D_First 0:1:7:4 2 8 0 MBD_D parallel 1052.959289197 925.9850617285 1499.5077096909 -0.5128950478 -0.4510460731 -0.7304081804 -0.25811895222709652 0.89249988325203511 -0.3698899361922266 20.0 40.0 40.0 +D_First 0:1:7:1 2 11 0 MBD_A parallel -29867.5375660043 23520.0205679039 35691.6158153175 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:2 2 8 0 MBD_B parallel -29867.5375660043 23520.0205679039 35691.6158153175 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:3 2 6 0 MBD_C parallel -24172.2971973206 19035.1456325485 28885.8210367641 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:4 2 8 0 MBD_D parallel 26745.1659456038 23520.0205679039 38087.4958261489 -0.5128950478 -0.4510460731 -0.7304081804 -0.25811895222709652 0.89249988325203511 -0.3698899361922266 20.0 40.0 40.0 } diff --git a/tests/gdt/view/B1 b/tests/gdt/view/B1 index bb99c3bfa2..b69cd89a00 100644 --- a/tests/gdt/view/B1 +++ b/tests/gdt/view/B1 @@ -1,8 +1,8 @@ set filename bug27808_nist_ftc_09_asme1_ct5240_rd.stp set ref_data { -D_First 0:1:7:1 2 21 0 MBD_A central -20.8553716705 19.0487334484 16.8668443575 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 -D_First 0:1:7:2 2 10 0 MBD_B parallel -16.8234421137 16.8832385446 16.8234313004 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 -D_First 0:1:7:3 2 16 0 MBD_C central -10.8134556568 14.3968068521 12.8345579613 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 -D_First 0:1:7:4 2 17 0 MBD_D central 16.8234325018 16.8832397461 16.8234373078 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:1 2 21 0 MBD_A central -529.7264404307 483.83782958936 428.417846680 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 +D_First 0:1:7:2 2 10 0 MBD_B parallel -427.31542968798 428.83425903284 427.3151550301 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:3 2 16 0 MBD_C central -274.66177368272 365.67889404334 325.99777221702 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 +D_First 0:1:7:4 2 17 0 MBD_D central 427.31518554572 428.83428955094 427.31530761812 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 } diff --git a/tests/gdt/view/B2 b/tests/gdt/view/B2 index 1f4004e8cf..d28bdebf7b 100644 --- a/tests/gdt/view/B2 +++ b/tests/gdt/view/B2 @@ -1,8 +1,8 @@ set filename bug27645_nist_ftc_09_asme1_ct5240_rd-1.stp set ref_data { -D_First 0:1:7:1 2 21 0 MBD_A central -529.7264404297 483.8378295898 428.4178466797 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 -D_First 0:1:7:2 2 10 0 MBD_B parallel -427.3154296875 428.8342590332 427.3151550293 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 -D_First 0:1:7:3 2 16 0 MBD_C central -274.6617736816 365.678894043 325.9977722168 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 -D_First 0:1:7:4 2 17 0 MBD_D central 427.3151855469 428.8342895508 427.3153076172 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:1 2 21 0 MBD_A central -13455.0515869144 12289.4808715809 10881.8133056644 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 +D_First 0:1:7:2 2 10 0 MBD_B parallel -10853.8119140625 10892.3901794433 10853.8049377442 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:3 2 16 0 MBD_C central -6976.40905151264 9288.2439086922 8280.34341430672 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 +D_First 0:1:7:4 2 17 0 MBD_D central 10853.8057128913 10892.3909545903 10853.8088134769 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 }