Skip to content

Commit 2ba07b5

Browse files
committed
fix logic and text of the reported outcome for correct interpretation of Scale attribute
1 parent 30f837f commit 2ba07b5

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

features/rules/GRF/GRF005_CRS-unit-type-differences.feature

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
@industry-practice
22
@GRF
3-
@version1
4-
@E00100
3+
@version2
54
Feature: GRF005 - CRS unit type differences
65
The rule verifies that the Scale attribute of IfcMapConversion is used when the units of the CRS are not identical to the units of the engineering coordinate system.
76
If omitted, the value of 1.0 is assumed.
87
If the units of the referenced source location engineering coordinate system are different from the units of the referenced target coordinate system,
9-
then this attribute must be included and must have the value of the scale from the source to the target units
8+
then this attribute must be included and must have the value of the scale from the project units to the target of the map coordinate units.
109

1110

12-
Scenario: In cases where the length unit of the local CRS differs from the length unit of the external CRS, the map conversion scale must reflect the factor between the two units.
11+
Scenario: IfcMapConversion Scale attribute
1312

1413
Given A model with Schema 'IFC4' or 'IFC4.3'
1514
Given An .IfcMapConversion.

features/steps/steps/crs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_horizontal_unit_factors(crs: CRS) -> set[float]:
5353
@gherkin_ifc.step("The map conversion scale must be the quotient of the project length units and the target CRS length units")
5454
def step_impl(context, inst):
5555
error_found = False
56-
proj_unit_factor = unit.calculate_unit_scale(context.model, unit_type='LENGTHUNIT')
56+
project_unit_factor = unit.calculate_unit_scale(context.model, unit_type='LENGTHUNIT')
5757
map_conversion_scale = getattr(inst, 'Scale', 1.)
5858
map_conversion_scale_factor = 1.0 if not map_conversion_scale else map_conversion_scale
5959

@@ -75,19 +75,19 @@ def step_impl(context, inst):
7575
# Relative tolerance of 1E-9 corresponds to 1 part per billion.
7676
# This is appropriate for imperial projects using Northing and Easting coordinates
7777
# that are often in the range 1E6 or even 1E7.
78-
if not isclose(crs_unit_factor, proj_unit_factor, abs_tol=0., rel_tol=1E-9):
78+
if not isclose(crs_unit_factor, project_unit_factor, abs_tol=0., rel_tol=1E-9):
7979
error_found = True
8080
yield ValidationOutcome(inst=inst,
81-
observed=f"map conversion scale {map_conversion_scale} does not reflect mismatch of target CRS unit conversion factor {crs_unit_factor} and project length unit scale {proj_unit_factor}",
81+
observed=f"map conversion scale {map_conversion_scale} does not reflect mismatch of target CRS unit conversion factor {crs_unit_factor} and project length unit scale {project_unit_factor}",
8282
severity=OutcomeSeverity.ERROR)
8383
else:
8484
# Scale factor provided for IfcMapConversion.
8585
# Confirm that it matches the expected value.
86-
quotient = crs_unit_factor / proj_unit_factor
86+
quotient = project_unit_factor / crs_unit_factor
8787

8888
if not isclose(quotient, map_conversion_scale_factor, abs_tol=0., rel_tol=1E-9):
8989
error_found = True
90-
yield ValidationOutcome(inst=inst, observed=f"map conversion scale {map_conversion_scale} does not reflect the quotient of the target CRS unit conversion factor {crs_unit_factor} divided by the project length unit scale {proj_unit_factor}", severity=OutcomeSeverity.ERROR)
90+
yield ValidationOutcome(inst=inst, observed=f"map conversion scale {map_conversion_scale} does not reflect the value of the project length unit factor of the project unit factor {project_unit_factor} divided by the target CRS unit factor {crs_unit_factor}", severity=OutcomeSeverity.ERROR)
9191

9292
if not error_found:
9393
yield ValidationOutcome(inst=inst, severity=OutcomeSeverity.PASSED)

test/files/GRF/grf005/pass-grf005-scaled_foot_to_metre.ifc renamed to test/files/GRF/grf005/pass-grf005-scaled_metre_to_US_survey_foot.ifc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ISO-10303-21;
22
/* IFC units are in metres, ESPG:2277 uses survey foot and the map conversion reflects this */
33
HEADER;
44
FILE_DESCRIPTION(('ViewDefinition [ReferenceView]'),'2;1');
5-
FILE_NAME('pass-grf005-scaled_foot_to_metre.ifc','2023-01-25T18:40:40',(''),(''),'','IfcOpenShell contributors - IfcOpenShell - v0.7.0+6180d73f','');
5+
FILE_NAME('pass-grf005-scaled_metre_to_US_survey_foot.ifc','2023-01-25T18:40:40',(''),(''),'','IfcOpenShell contributors - IfcOpenShell - v0.7.0+6180d73f','');
66
FILE_SCHEMA(('IFC4X3_ADD2'));
77
ENDSEC;
88
DATA;
@@ -27,6 +27,6 @@ DATA;
2727
#19=IFCUNITASSIGNMENT((#13,#14,#15,#18));
2828
#20=IFCPROJECT('2X9wjf5oPB4PQjenCYrhHZ',#5,'',$,$,$,$,(#11),#19);
2929
#21=IFCPROJECTEDCRS('EPSG:2277',$,'NAD83',$,'','3',$);
30-
#22=IFCMAPCONVERSION(#11,#21,316131.64,5690966.11,1.,1.,0.,0.30480060960121924);
30+
#22=IFCMAPCONVERSION(#11,#21,316131.64,5690966.11,1.,1.,0.,3.2808333333333);
3131
ENDSEC;
3232
END-ISO-10303-21;

0 commit comments

Comments
 (0)