mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-07-31 18:50:02 +08:00
Data Exchange - Fix PMI measurument conversion factor (#1218)
- Extend STEPCAF dimension value conversion to recognize `StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI` and `StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI`. - Extend regression test `bug33095` to validate scaling of the nominal dimension value between `m` and `mm`.
This commit is contained in:
@@ -4078,11 +4078,15 @@ static void setDimObjectToXCAF(const occ::handle<Standard_Transient>& theEnt,
|
||||
occ::handle<StepBasic_NamedUnit> NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit)))
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))
|
||||
|| aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
else if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit)))
|
||||
else if (aMWU->IsKind(
|
||||
STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))
|
||||
|| aMWU->IsKind(
|
||||
STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit)))
|
||||
{
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,14 @@ catch { Close D_m }
|
||||
# Read file in mm
|
||||
ReadStep D_mm [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_mm [XGetDimensionPlusMinusTol D_mm 0:1:4:77]
|
||||
set dim_value_mm [XGetDimensionValue D_mm 0:1:4:77]
|
||||
|
||||
# Read file in m
|
||||
XNewDoc D_m
|
||||
XSetLengthUnit D_m m
|
||||
ReadStep D_m [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_m [XGetDimensionPlusMinusTol D_m 0:1:4:77]
|
||||
set dim_value_m [XGetDimensionValue D_m 0:1:4:77]
|
||||
|
||||
# Checking
|
||||
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_m full lower_m upper_m
|
||||
@@ -23,6 +25,7 @@ regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_mm full lower_
|
||||
|
||||
set lower_m_to_mm [expr {$lower_m * 1000}]
|
||||
set upper_m_to_mm [expr {$upper_m * 1000}]
|
||||
set value_m_to_mm [expr {$dim_value_m * 1000}]
|
||||
|
||||
if {[expr {abs($lower_m_to_mm - $lower_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling lower toleranse value"
|
||||
@@ -30,3 +33,6 @@ if {[expr {abs($lower_m_to_mm - $lower_mm)}] > 1e-2} {
|
||||
if {[expr {abs($upper_m_to_mm - $upper_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling upper toleranse value"
|
||||
}
|
||||
if {[expr {abs($value_m_to_mm - $dim_value_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling main dimension value"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user