1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0033095: Data Exchange, Step Import - Wrong PMI values when loading a *.stp file in m

Fixed problem with dimension tolerance values (upper/lower)
 - Update supported type for tolerance measure unit, now we can handle base class
This commit is contained in:
dpasukhi 2022-08-10 15:17:13 +03:00
parent 81d569625e
commit 621ed3bc36
4 changed files with 78 additions and 45 deletions

View File

@ -3365,17 +3365,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
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(StepBasic_LengthMeasureWithUnit)) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
{
aVal = aVal * anUnitCtx.LengthFactor();
}
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
STEPConstruct_UnitContext anUnitCtxUpperBound;
anUnitCtxUpperBound.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
{
convertAngleValue(anUnitCtx, aVal);
convertAngleValue(anUnitCtxUpperBound, aVal);
}
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxUpperBound.LengthFactor() > 0.) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
{
aVal = aVal * anUnitCtxUpperBound.LengthFactor();
}
aDim3 = aVal;
@ -3401,16 +3401,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (anUnit.IsNull()) continue;
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
NU = anUnit.NamedUnit();
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)) ||
STEPConstruct_UnitContext anUnitCtxLowerBound;
anUnitCtxLowerBound.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
{
convertAngleValue(anUnitCtx, aVal);
convertAngleValue(anUnitCtxLowerBound, aVal);
}
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxLowerBound.LengthFactor() > 0.) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
{
aVal = aVal * anUnitCtxLowerBound.LengthFactor();
}
aDim2 = Abs(aVal);
}

32
tests/bugs/step/bug33095 Normal file
View File

@ -0,0 +1,32 @@
puts "======="
puts "0033095: Data Exchange, Step Import - Wrong PMI values when loading a *.stp file in m"
puts "======="
pload OCAF
catch { Close D_mm }
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]
# 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]
# Checking
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_m full lower_m upper_m
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_mm full lower_mm upper_mm
set lower_m_to_mm [expr {$lower_m * 1000}]
set upper_m_to_mm [expr {$upper_m * 1000}]
if {[expr {abs($lower_m_to_mm - $lower_mm)}] > 1e-2} {
puts "Error: incorrect scaling lower toleranse value"
}
if {[expr {abs($upper_m_to_mm - $upper_mm)}] > 1e-2} {
puts "Error: incorrect scaling upper toleranse value"
}

View File

@ -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 2.54, VU 2.54, P 0 )
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:1:2:19 Shape.22
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:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, 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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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 2.54, VU 2.54, P 0 )
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: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)" )

View File

@ -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 2.54, VU 2.54, P 0 )
0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:2:8 Shape.11
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 )
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, 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 2.54, VU 2.54, P 0 )
0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:2:207 Shape.210
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 )
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, 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 )
}