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

Alb999 rail alignment value constraints #37

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
887e60e
Initial commit of OJP001 rule
JTurbakiewicz Dec 11, 2022
bc748b1
initial commit
Ghesselink Dec 13, 2022
cca7b3a
incorporate discussion PR for both generating files and implementatio…
Ghesselink Dec 15, 2022
d1c1dfb
gherkin statements with stack frames
Ghesselink Dec 17, 2022
8a33377
add map_state, return values from stack with indices
Ghesselink Dec 21, 2022
50e65d8
Update features/GEM003_Unique-representation-identifier.feature
Ghesselink Dec 21, 2022
f1501a7
Changes and simplifications
JTurbakiewicz Dec 28, 2022
7df2ab7
shorten gherkin statement
Ghesselink Dec 28, 2022
a19d839
align with grf001
Ghesselink Jan 5, 2023
3044bad
remove random string
Ghesselink Jan 9, 2023
5272bcd
Merge branch 'main' into gem003_unique-representation-identifier
Ghesselink Jan 10, 2023
7563038
MR comments, added lookup table, changed the wording
JTurbakiewicz Jan 10, 2023
287a576
Changed relationships from dict to csv + MR comments
JTurbakiewicz Jan 11, 2023
d84ff3a
Parametrize rel direction
aothms Jan 22, 2023
5501255
Merge remote-tracking branch 'bsi/gem003_unique-representation-identi…
aothms Jan 22, 2023
58c942b
Generalize relationship stmt, value constraint
aothms Jan 22, 2023
ca8bf07
Merge remote-tracking branch 'bsi/main' into ALB999_rail_alignment_va…
aothms Jan 22, 2023
c3b4a2c
Fix path syntax
aothms Jan 22, 2023
e2d5cfa
Add feature
aothms Jan 22, 2023
0b67572
Test files
aothms Jan 25, 2023
08ae8d6
ALB999 IfcAlignment start station
aothms Jan 25, 2023
a488fe3
Clear stack frames in between features
aothms Jan 27, 2023
45690e3
ALB002 account for None
aothms Jan 27, 2023
427fbf0
ALB002 Complete schema version applicabilities
aothms Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install behave pytest tabulate pyparsing
pip install behave pytest tabulate pyparsing parse-type
wget -O /tmp/ifcopenshell_python.zip https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-`python3 -c 'import sys;print("".join(map(str, sys.version_info[0:2])))'`-v0.7.0-d1a40d1-linux64.zip
mkdir -p `python3 -c 'import site; print(site.getusersitepackages())'`
unzip -d `python3 -c 'import site; print(site.getusersitepackages())'` /tmp/ifcopenshell_python.zip
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__pycache__
/.vscode
/.vscode
4 changes: 2 additions & 2 deletions features/ALB002_Alignment-layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Feature: ALB002 - Alignment Layout

Scenario: Agreement on attributes being nested within a decomposition relationship

Given a file with Schema Identifier "IFC4X3"
Given a file with Schema Identifier "IFC4X3" or "IFC4X3_TC1" or "IFC4X3_ADD1"

Then Each IfcAlignmentHorizontal must nest only 1 instance(s) of IfcAlignment
And Each IfcAlignmentVertical must nest only 1 instance(s) of IfcAlignment
And Each IfcAlignmentCant must nest only 1 instance(s) of IfcAlignment

Scenario: Agreement of structure of alignments segments

Given a file with Schema Identifier "IFC4X3"
Given a file with Schema Identifier "IFC4X3" or "IFC4X3_TC1" or "IFC4X3_ADD1"

Then Each IfcAlignmentHorizontal is nested by a list of only instance(s) of IfcAlignmentSegment
Then Each IfcAlignmentVertical is nested by a list of only instance(s) of IfcAlignmentSegment
Expand Down
29 changes: 29 additions & 0 deletions features/ALB998_alignment_start_station.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@implementer-agreement
@ALB
Feature: IfcAlignment start station

An IfcAlignment must have a start station, which is instantiated as an IfcReferent
with PredefinedType set to REFERENCEMARKER or STATION. The IfcReferent must have the
property Pset_Stationing.Station.

Scenario: An alignment must nest at least one referent

Given An IfcAlignment
Then A relationship IfcRelNests exists from IfcAlignment to IfcReferent

Scenario: At least one of these referents must have type REFERENCEMARKER or STATION

Given An IfcAlignment
And A relationship IfcRelNests from IfcAlignment to IfcReferent and following that
And Its attribute PredefinedType

Then at least "1" value must be "REFERENCEMARKER" or "STATION"

Scenario: At least one of these referents typed REFERENCEMARKER or STATION must have a value for Pset_Stationing.Station

Given An IfcAlignment
And A relationship IfcRelNests from IfcAlignment to IfcReferent and following that
And PredefinedType = "REFERENCEMARKER" or "STATION"
And Its value for property Pset_Stationing.Station

Then at least "1" value must exist
17 changes: 17 additions & 0 deletions features/ALB999_rail_alignment_value_constraints.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@implementer-agreement
@ALB
Feature: Rail Alignment value constraints

Background: Rail alignment

Given An IfcAlignment
And A relationship IfcRelReferencedInSpatialStructure to IfcAlignment from IfcRail

Scenario: Agreement on allowed values for horizontal segment types

Given A relationship IfcRelNests from IfcAlignment to IfcAlignmentHorizontal and following that
Given A relationship IfcRelNests from IfcAlignmentHorizontal to IfcAlignmentSegment and following that
Comment on lines +12 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is and following that?

Copy link
Collaborator Author

@aothms aothms Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I've updated the PR description. You can find the answer under "traversal". In short it means that, in the first case without and following that the a relationship ... statement checks whether such a relationship exists, but keeps the context on the previously active node (alignment). In the second case we actually descend according to the nesting structure, so that the attribute DesignParameters is read from the IfcAlignmentSegment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes a lot of sense, nice to see that this approach is useful for more rules (also referring to your explanation in the top of this PR). For the 0.6 sprint we are encountering a rule (briefly discussed in a previous meeting) for which we will need attributes for both the previously activate node and the following elements. That seems to be possible this way. Or maybe we will need to make it more explicit.

Given Its attribute DesignParameters
Given Its attribute PredefinedType
Comment on lines +12 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you meant And in the last three lines? Or are all four conditions to be interpreted independently of one another?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no functional difference between that. and is just a shortcut for the previously used gherkin keyword. But I agree it should be used consistently (maybe it's actually clearer to never use and).


Then the value must be "LINE" or "CIRCULARARC" or "CLOTHOID"
12 changes: 12 additions & 0 deletions features/GEM003_Unique-representation-identifier.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@informal-proposition
@GEM
Feature: GEM003 - Unique Representation Identifier

Scenario: A Shape Representation identifier must not be used twice within the product representation of an IfcProduct element

Given An IfcProduct
And Its attribute Representation
And Its attribute Representations
And Its attribute RepresentationIdentifier

Then The values must be unique
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@implementer-agreement
@OJP
Feature: OJP001 - Relative placement for elements aggregated to another element

Scenario: Agreement on the relative placement of IfcElements being a part of another IfcElement through the relationship IfcRelAggregates

Given A file with Schema Identifier "IFC2X3"
And An IfcElement
And A relationship IfcRelAggregates from IfcElement to IfcElement
Then The relative placement of that IfcElement must be provided by an IfcLocalPlacement entity
Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which that does this sentence refer to? In the sentence above, there are two IfcElements ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to reply here, this feature shows up here, because my PR was based on two un-merged PRs. See #27.

And The PlacementRelTo attribute must point to the IfcLocalPlacement of the container element established with IfcRelAggregates relationship
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the container is placed by IfcGridPlacement? As the sentence reads right now, it is not allowed for IfcRelAggregates.RelatingObject to ever be placed by anything else as IfcLocalPlacement.

8 changes: 8 additions & 0 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
from behave.model import Scenario

def before_feature(context, feature):
# @tfk we have this strange issue between stack frames blending over
# between features so we need to preserve only the bottom two stack
# frames when beginning a new feature.
context._stack = context._stack[-2:]
Comment on lines 5 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah, that explains it .. I tried to add context._push() with at the 'Its values' statement to retrieve it later and run into exactly this (another feature somehow not working anymore ..).


context.model = ifcopenshell.open(context.config.userdata["input"])
Scenario.continue_after_failed_step = True

def before_step(context, step):
context.step = step
2 changes: 2 additions & 0 deletions features/resources/related_entity_attributes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IfcRelAssigns,IfcRelAssociates,IfcRelConnectsElements,IfcRelConnectsPortToElement,IfcRelConnectsPorts,IfcRelConnectsStructuralActivity,IfcRelConnectsStructuralMember,IfcRelContainedInSpatialStructure,IfcRelCoversBldgElements,IfcRelCoversSpaces,IfcRelFillsElement,IfcRelFlowControlElements,IfcRelInterferesElements,IfcRelReferencedInSpatialStructure,IfcRelSequence,IfcRelServicesBuildings,IfcRelSpaceBoundary,IfcRelDeclares,IfcRelAggregates,IfcRelNests,IfcRelProjectsElement,IfcRelVoidsElement,IfcRelDefinesByObject,IfcRelDefinesByProperties,IfcRelDefinesByTemplate,IfcRelDefinesByType
RelatedObjects,RelatedObjects,RelatedElement,RelatedElement,RelatedPort,RelatedStructuralActivity,RelatedStructuralConnection,RelatedElements,RelatedCoverings,RelatedCoverings,RelatedBuildingElement,RelatedControlElements,RelatedElement,RelatedElements,RelatedProcess,RelatedBuildings,RelatedBuildingElement,RelatedDefinitions,RelatedObjects,RelatedObjects,RelatedFeatureElement,RelatedOpeningElement,RelatedObjects,RelatedObjects,RelatedPropertySets,RelatedObjects
Expand Down
2 changes: 2 additions & 0 deletions features/resources/relating_entity_attributes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IfcRelAssignsToActor,IfcRelAssignsToControl,IfcRelAssignsToGroup,IfcRelAssignsToProcess,IfcRelAssignsToProduct,IfcRelAssignsToResource,IfcRelAssociatesApproval,IfcRelAssociatesClassification,IfcRelAssociatesConstraint,IfcRelAssociatesDocument,IfcRelAssociatesLibrary,IfcRelAssociatesMaterial,IfcRelConnectsElements,IfcRelConnectsPortToElement,IfcRelConnectsPorts,IfcRelConnectsStructuralActivity,IfcRelConnectsStructuralMember,IfcRelContainedInSpatialStructure,IfcRelCoversBldgElements,IfcRelCoversSpaces,IfcRelFillsElement,IfcRelFlowControlElements,IfcRelInterferesElements,IfcRelReferencedInSpatialStructure,IfcRelSequence,IfcRelServicesBuildings,IfcRelSpaceBoundary,IfcRelDeclares,IfcRelAggregates,IfcRelNests,IfcRelProjectsElement,IfcRelVoidsElement,IfcRelDefinesByObject,IfcRelDefinesByProperties,IfcRelDefinesByTemplate,IfcRelDefinesByType
RelatingActor,RelatingControl,RelatingGroup,RelatingProcess,RelatingProduct,RelatingResource,RelatingApproval,RelatingClassification,RelatingConstraint,RelatingDocument,RelatingLibrary,RelatingMaterial,RelatingElement,RelatingPort,RelatingPort,RelatingElement,RelatingStructuralMember,RelatingStructure,RelatingBuildingElement,RelatingSpace,RelatingOpeningElement,RelatingFlowElement,RelatingElement,RelatingStructure,RelatingProcess,RelatingSystem,RelatingSpace,RelatingContext,RelatingObject,RelatingObject,RelatingElement,RelatingBuildingElement,RelatingObject,RelatingPropertyDefinition,RelatingTemplate,RelatingType
Expand Down