Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALS004_Alignment-segment-shape-representation #62

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions features/ALB002_Alignment-layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ This rule verifies that (a) alignment has a nesting relationship with its layout
Given an IfcAlignmentSegment
And The element nests an IfcAlignmentHorizontal

Then The type of attribute DesignParameters should be IfcAlignmentHorizontalSegment
Then The type of attribute DesignParameters must be IfcAlignmentHorizontalSegment

Scenario: Agreement of the segments of the vertical alignment

Given an IfcAlignmentSegment
And The element nests an IfcAlignmentVertical

Then The type of attribute DesignParameters should be IfcAlignmentVerticalSegment
Then The type of attribute DesignParameters must be IfcAlignmentVerticalSegment

Scenario: Agreement of the segments of the cant alignment

Given an IfcAlignmentSegment
And The element nests an IfcAlignmentCant

Then The type of attribute DesignParameters should be IfcAlignmentCantSegment
Then The type of attribute DesignParameters must be IfcAlignmentCantSegment
14 changes: 14 additions & 0 deletions features/RI009_Alignment-segment-shape-representation.feature
JTurbakiewicz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@implementer-agreement
@RI
Feature: RI009 - Alignment segment shape representation
JTurbakiewicz marked this conversation as resolved.
Show resolved Hide resolved
The rule verifies, that each IfcAlignmentSegment uses correct representation.
JTurbakiewicz marked this conversation as resolved.
Show resolved Hide resolved

Scenario: Agreement on each IfcAlignmentSegment using correct representation

Given A file with Schema Identifier "IFC4X3_TC1" or "IFC4X3_ADD1" or "IFC4X3"
And An IfcAlignmentSegment
And Its attribute Representation
And Its attribute Representations
Then The value of attribute RepresentationIdentifier must be Axis
And The value of attribute RepresentationType must be Segment
And The type of attribute Items must be IfcCurveSegment
19 changes: 17 additions & 2 deletions features/steps/thens/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,30 @@ def step_impl(context, entity, other_entity):
misc.handle_errors(context, errors)


@then('The type of attribute {attribute} should be {expected_entity_type}')
@then('The type of attribute {attribute} must be {expected_entity_type}')
def step_impl(context, attribute, expected_entity_type):

def _():
for inst in context.instances:
if isinstance(inst, (tuple, list)):
inst = inst[0]
related_entity = getattr(inst, attribute, [])
if not related_entity.is_a(expected_entity_type):
if isinstance(related_entity, (tuple, list)):
related_entity = related_entity[0]
if isinstance(related_entity, (tuple, list)) or (not related_entity.is_a(expected_entity_type)):
yield err.AttributeTypeError(inst, [related_entity], attribute, expected_entity_type)

misc.handle_errors(context, list(_()))

@then('The value of attribute {attribute} must be {value}')
def step_impl(context, attribute, value):
if getattr(context, 'applicable', True):
errors = []
for instance in context.instances:
while isinstance(instance, (tuple, list)):
instance = instance[0]
attribute_value = getattr(instance, attribute, 'Attribute not found')
if attribute_value != value:
errors.append(err.InvalidValueError(instance, attribute, attribute_value))
misc.handle_errors(context, errors)
JTurbakiewicz marked this conversation as resolved.
Show resolved Hide resolved

6 changes: 6 additions & 0 deletions test/files/ri009/README.MD
JTurbakiewicz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
| File name | Expected result | Error log | Description |
|------------------------------------------------------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| pass-ri009-alignment-segment-shape-representation | success | n.a. | |
| fail-ri009-scenario01-wrong-representationidentifier-value | fail | On instance #183=IfcShapeRepresentati...(#178)) the following invalid value for RepresentationIdentifier has been found: Curve2D | The expected RepresentationIdentifier value was Axis. |
| fail-ri009-scenario01-wrong-representationtype-value | fail | On instance #183=IfcShapeRepresentati...(#178)) the following invalid value for RepresentationType has been found: Brep | The expected RepresentationType value was Segment. |
| fail-ri009-scenario01-wrong-items-type | fail | The instance #183=IfcShapeRepresentation(#17,'Axis','Segment',(#187)) expected type 'IfcCurveSegment' for the attribute Items, but found [#187=IfcLine(#188,#189)] | The expected type of Items was IfcCurveSegment |
Loading