Skip to content

Commit

Permalink
checkpoint for passing tests
Browse files Browse the repository at this point in the history
(IVS-173)
  • Loading branch information
civilx64 committed Jan 23, 2025
1 parent 8f4b936 commit 691b550
Show file tree
Hide file tree
Showing 4 changed files with 71,014 additions and 3 deletions.
8 changes: 6 additions & 2 deletions features/LIP002_Linear-placement-fallback-coordinates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ Feature: LIP002 - Linear placement fallback coordinates
and that the provided values correspond to the calculated placement defined by the RelativePlacement attribute

Background:
Given A model with Schema "IFC4X3_ADD2"
Given A model with Schema "IFC4.3"
Given An IfcLinearPlacement
Given Its attribute CartesianPosition

Scenario: Confirm the presence of CartesianPosition

Given Its attribute CartesianPosition
Then Assert existence

Scenario: Confirm the values of CartesianPosition

Then .CartesianPosition. must be *equal to* "the calculated linear placement"

29 changes: 28 additions & 1 deletion features/steps/thens/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

import ifcopenshell.entity_instance
import ifcopenshell.util.unit
import ifcopenshell.geom

from utils import ifc43x_alignment_validation as ifc43
from utils.geometry import AlignmentSegmentContinuityCalculation
from utils.geometry import AlignmentSegmentContinuityCalculation, compare_with_precision
from utils import ifc
from validation_handling import gherkin_ifc
from . import ValidationOutcome, OutcomeSeverity

from parse_type import TypeBuilder


register_type(absence_or_presence=TypeBuilder.make_enum(dict(map(lambda x: (x, x), ("presence", "absence")))))


Expand Down Expand Up @@ -424,3 +426,28 @@ def step_impl(context, inst, continuity_type):
"continuity_details": continuity_calc.to_dict(),
},
severity=OutcomeSeverity.WARNING)


@gherkin_ifc.step('.{schema_construct}. must be *equal to* "the calculated linear placement"')
def step_impl(context, inst, schema_construct):
attribute_value = getattr(inst, schema_construct)
settings = ifcopenshell.geom.settings()
cartesian_position_matrix = ifcopenshell.geom.create_shape(settings, attribute_value).matrix
linear_placement_matrix = ifcopenshell.geom.create_shape(settings, inst).matrix
xcp, ycp = cartesian_position_matrix[12], cartesian_position_matrix[13]
xlp, ylp = linear_placement_matrix[12], linear_placement_matrix[13]

relative_placement = inst.PlacementRelTo
if relative_placement is not None:
relative_matrix = ifcopenshell.geom.create_shape(settings, relative_placement).matrix
xr, yr = relative_matrix[12], relative_matrix[13]
xcp += xr
ycp += yr

x_check = compare_with_precision(xcp, xlp, 1e-4, "equal to")
y_check = compare_with_precision(ycp, ylp, 1e-4, "equal to")
if not (x_check & y_check):
yield ValidationOutcome(
inst=inst,
severity=OutcomeSeverity.WARNING
)
Loading

0 comments on commit 691b550

Please sign in to comment.