-
Notifications
You must be signed in to change notification settings - Fork 18
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
GEM113 no colinear arcs (IVS-303) #335
Open
aothms
wants to merge
2
commits into
development
Choose a base branch
from
tfk-gem113-no-colinear-arcs
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+273
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
features/GEM113_Indexed-poly-curve-arcs-must-not-be-defined-using-colinear-points.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@implementer-agreement | ||
@GEM | ||
@version1 | ||
Feature: GEM113 - Indexed poly curve arcs must not be defined using colinear points | ||
The rule verifies, that all the three points of any IfcArcIndex segment of an IfcIndexedPolyCurve are not colinear after taking the Precision factor into account | ||
|
||
@E00050 | ||
Scenario: No poly curve arcs using colinear points | ||
|
||
Given An IfcIndexedPolyCurve | ||
Then It must have no arc segments that use colinear points after taking the Precision factor into account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,4 +231,21 @@ def step_impl(context, inst: ifcopenshell.entity_instance, clause: str): | |
if clause == 'including' or (clause == 'excluding' and (i, j) != (0, len(points_coordinates) - 1)): | ||
if math.dist(points_coordinates[i], points_coordinates[j]) < precision: | ||
yield ValidationOutcome(inst=inst, observed=(points_coordinates[i], points_coordinates[j]), | ||
severity=OutcomeSeverity.ERROR) | ||
severity=OutcomeSeverity.ERROR) | ||
|
||
@gherkin_ifc.step("It must have no arc segments that use colinear points after taking the Precision factor into account") | ||
def step_impl(context, inst: ifcopenshell.entity_instance): | ||
import mpmath as mp | ||
mp.prec = 128 | ||
|
||
representation_context = geometry.recurrently_get_entity_attr(context, inst, 'IfcRepresentation', 'ContextOfItems') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We continue to generate splinters in regards to how geometric precision is handled. It would be nice to consolidate this all in one spot, maybe in sth like /utils/precision.py. Does not need to be addressed immediately and possibly fits nicely with refactoring in IVS-306. |
||
precision = mp.mpf(geometry.get_precision_from_contexts(representation_context)) | ||
|
||
for seg in (inst.Segments or ()): | ||
ps = inst.Points.CoordList | ||
if seg.is_a('IfcArcIndex') and len(seg[0]) == 3 and all((i >= 1) and ((i - 1) < len(ps)) for i in seg[0]): | ||
a, b, c = (ps[i-1] for i in seg[0]) | ||
l = geometry.Line.from_points(a, c) | ||
if l.distance(b) < precision: | ||
yield ValidationOutcome(inst=inst, observed=str(seg), | ||
severity=OutcomeSeverity.ERROR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ISO-10303-21; | ||
HEADER; | ||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); | ||
FILE_NAME('','2024-12-28T14:43:26',(''),(''),'IfcOpenShell-0.8.0','IfcOpenShell-0.8.0',''); | ||
FILE_SCHEMA(('IFC4')); | ||
ENDSEC; | ||
DATA; | ||
#1=IFCPERSON($,$,'',$,$,$,$,$); | ||
#2=IFCORGANIZATION($,'',$,$,$); | ||
#3=IFCPERSONANDORGANIZATION(#1,#2,$); | ||
#4=IFCAPPLICATION(#2,'0.8.0','IfcOpenShell-0.8.0',''); | ||
#5=IFCOWNERHISTORY(#3,#4,$,.NOTDEFINED.,$,#3,#4,1735397006); | ||
#6=IFCDIRECTION((1.,0.,0.)); | ||
#7=IFCDIRECTION((0.,0.,1.)); | ||
#8=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#9=IFCAXIS2PLACEMENT3D(#8,#7,#6); | ||
#10=IFCDIRECTION((0.,1.)); | ||
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#9,#10); | ||
#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0); | ||
#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); | ||
#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.); | ||
#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.); | ||
#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.); | ||
#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.0174532925199433),#16); | ||
#18=IFCCONVERSIONBASEDUNIT(#12,.PLANEANGLEUNIT.,'DEGREE',#17); | ||
#19=IFCUNITASSIGNMENT((#13,#14,#15,#18)); | ||
#20=IFCPROJECT('24xp2u2Rr7uOpUKiXfPYXD',#5,'',$,$,$,$,(#11),#19); | ||
#21=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.5,1.E-06),(1.,0.))); | ||
#22=IFCINDEXEDPOLYCURVE(#21,(IFCARCINDEX((1,2,3)),IFCLINEINDEX((3,1))),$); | ||
#23=IFCSHAPEREPRESENTATION(#11,'FootPrint','Curve2D',(#22)); | ||
#24=IFCPRODUCTDEFINITIONSHAPE($,$,(#23)); | ||
#25=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#26=IFCAXIS2PLACEMENT3D(#25,$,$); | ||
#27=IFCLOCALPLACEMENT($,#26); | ||
#28=IFCSPACE('1vgt69T2bFTu4vLXNn24Y8',$,$,$,$,#27,#24,$,$,$,$); | ||
#29=IFCRELAGGREGATES('30p94qT6L2YQvAFbzZIwTk',$,$,$,#20,(#28)); | ||
ENDSEC; | ||
END-ISO-10303-21; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ISO-10303-21; | ||
HEADER; | ||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); | ||
FILE_NAME('','2024-12-28T14:43:26',(''),(''),'IfcOpenShell-0.8.0','IfcOpenShell-0.8.0',''); | ||
FILE_SCHEMA(('IFC4')); | ||
ENDSEC; | ||
DATA; | ||
#1=IFCPERSON($,$,'',$,$,$,$,$); | ||
#2=IFCORGANIZATION($,'',$,$,$); | ||
#3=IFCPERSONANDORGANIZATION(#1,#2,$); | ||
#4=IFCAPPLICATION(#2,'0.8.0','IfcOpenShell-0.8.0',''); | ||
#5=IFCOWNERHISTORY(#3,#4,$,.NOTDEFINED.,$,#3,#4,1735397006); | ||
#6=IFCDIRECTION((1.,0.,0.)); | ||
#7=IFCDIRECTION((0.,0.,1.)); | ||
#8=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#9=IFCAXIS2PLACEMENT3D(#8,#7,#6); | ||
#10=IFCDIRECTION((0.,1.)); | ||
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#9,#10); | ||
#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0); | ||
#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); | ||
#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.); | ||
#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.); | ||
#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.); | ||
#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.0174532925199433),#16); | ||
#18=IFCCONVERSIONBASEDUNIT(#12,.PLANEANGLEUNIT.,'DEGREE',#17); | ||
#19=IFCUNITASSIGNMENT((#13,#14,#15,#18)); | ||
#20=IFCPROJECT('1dV8LfekbEiPWnicWc56Kx',#5,'',$,$,$,$,(#11),#19); | ||
#21=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.5,0.),(1.,0.))); | ||
#22=IFCINDEXEDPOLYCURVE(#21,(IFCARCINDEX((1,2,3)),IFCLINEINDEX((3,1))),$); | ||
#23=IFCSHAPEREPRESENTATION(#11,'FootPrint','Curve2D',(#22)); | ||
#24=IFCPRODUCTDEFINITIONSHAPE($,$,(#23)); | ||
#25=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#26=IFCAXIS2PLACEMENT3D(#25,$,$); | ||
#27=IFCLOCALPLACEMENT($,#26); | ||
#28=IFCSPACE('0djY0fT75CuflGivoTukmi',$,$,$,$,#27,#24,$,$,$,$); | ||
#29=IFCRELAGGREGATES('3ZawqDx_j4$wdFp5nfgwyT',$,$,$,#20,(#28)); | ||
ENDSEC; | ||
END-ISO-10303-21; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import ifcopenshell | ||
import ifcopenshell.template | ||
from math import sqrt | ||
|
||
sqrt2 = sqrt(2.)/2. | ||
|
||
pass_arc = [ | ||
(1.0, 0.0), | ||
(sqrt2, sqrt2), | ||
(0.0, 1.0) | ||
],[ | ||
(1,2,3),(3,1) | ||
] | ||
|
||
fail_arc_colinear = [ | ||
(0.0, 0.0), | ||
(0.5, 0.0), | ||
(1.0, 0.0) | ||
],[ | ||
(1,2,3),(3,1) | ||
] | ||
|
||
fail_arc_almost_colinear = [ | ||
(0.0, 0.0), | ||
(0.5, 1.e-6), | ||
(1.0, 0.0) | ||
],[ | ||
(1,2,3),(3,1) | ||
] | ||
|
||
pass_arc_non_colinear_enough = [ | ||
(0.0, 0.0), | ||
(0.5, 1.e-4), | ||
(1.0, 0.0) | ||
],[ | ||
(1,2,3),(3,1) | ||
] | ||
|
||
cases = ['pass_arc', 'fail_arc_colinear', 'fail_arc_almost_colinear', 'pass_arc_non_colinear_enough'] | ||
for case in cases: | ||
pf, reason = case.split('_', 1) | ||
f = ifcopenshell.template.create() | ||
ctx = f.by_type('IfcGeometricRepresentationContext')[0] | ||
proj = f.by_type('IfcProject')[0] | ||
points, edges = globals()[case] | ||
plist = f.createIfcCartesianPointList2D(points) | ||
def create_segment(tup): | ||
if len(tup) == 2: | ||
return f.createIfcLineIndex((tup)) | ||
if len(tup) == 3: | ||
return f.createIfcArcIndex((tup)) | ||
segments = list(map(create_segment, edges)) if edges else edges | ||
crv = f.createIfcIndexedPolyCurve(plist, segments, None) | ||
rep = f.createIfcShapeRepresentation(ctx, 'FootPrint', 'Curve2D', [crv]) | ||
pds = f.createIfcProductDefinitionShape(Representations=[rep]) | ||
road = f.createIfcSpace( | ||
ifcopenshell.guid.new(), | ||
ObjectPlacement=f.createIfcLocalPlacement(RelativePlacement=f.createIfcAxis2Placement3D(f.createIfcCartesianPoint((0., 0., 0.)))), | ||
Representation=pds | ||
) | ||
f.createIfcRelAggregates( | ||
ifcopenshell.guid.new(), | ||
None, None, None, | ||
proj, | ||
[road] | ||
) | ||
f.write(f'{pf}-gem113-{reason}.ifc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ISO-10303-21; | ||
HEADER; | ||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); | ||
FILE_NAME('','2024-12-28T14:43:26',(''),(''),'IfcOpenShell-0.8.0','IfcOpenShell-0.8.0',''); | ||
FILE_SCHEMA(('IFC4')); | ||
ENDSEC; | ||
DATA; | ||
#1=IFCPERSON($,$,'',$,$,$,$,$); | ||
#2=IFCORGANIZATION($,'',$,$,$); | ||
#3=IFCPERSONANDORGANIZATION(#1,#2,$); | ||
#4=IFCAPPLICATION(#2,'0.8.0','IfcOpenShell-0.8.0',''); | ||
#5=IFCOWNERHISTORY(#3,#4,$,.NOTDEFINED.,$,#3,#4,1735397006); | ||
#6=IFCDIRECTION((1.,0.,0.)); | ||
#7=IFCDIRECTION((0.,0.,1.)); | ||
#8=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#9=IFCAXIS2PLACEMENT3D(#8,#7,#6); | ||
#10=IFCDIRECTION((0.,1.)); | ||
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#9,#10); | ||
#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0); | ||
#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); | ||
#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.); | ||
#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.); | ||
#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.); | ||
#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.0174532925199433),#16); | ||
#18=IFCCONVERSIONBASEDUNIT(#12,.PLANEANGLEUNIT.,'DEGREE',#17); | ||
#19=IFCUNITASSIGNMENT((#13,#14,#15,#18)); | ||
#20=IFCPROJECT('1lmEZwk0jCxu1UhV3YDklD',#5,'',$,$,$,$,(#11),#19); | ||
#21=IFCCARTESIANPOINTLIST2D(((1.,0.),(0.707106781186548,0.707106781186548),(0.,1.))); | ||
#22=IFCINDEXEDPOLYCURVE(#21,(IFCARCINDEX((1,2,3)),IFCLINEINDEX((3,1))),$); | ||
#23=IFCSHAPEREPRESENTATION(#11,'FootPrint','Curve2D',(#22)); | ||
#24=IFCPRODUCTDEFINITIONSHAPE($,$,(#23)); | ||
#25=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#26=IFCAXIS2PLACEMENT3D(#25,$,$); | ||
#27=IFCLOCALPLACEMENT($,#26); | ||
#28=IFCSPACE('1l6UMBjaL0Iu2SkTL0BXbm',$,$,$,$,#27,#24,$,$,$,$); | ||
#29=IFCRELAGGREGATES('33aK_7G8XC_uTta6bAcd86',$,$,$,#20,(#28)); | ||
ENDSEC; | ||
END-ISO-10303-21; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
ISO-10303-21; | ||
HEADER; | ||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); | ||
FILE_NAME('','2024-12-28T14:43:26',(''),(''),'IfcOpenShell-0.8.0','IfcOpenShell-0.8.0',''); | ||
FILE_SCHEMA(('IFC4')); | ||
ENDSEC; | ||
DATA; | ||
#1=IFCPERSON($,$,'',$,$,$,$,$); | ||
#2=IFCORGANIZATION($,'',$,$,$); | ||
#3=IFCPERSONANDORGANIZATION(#1,#2,$); | ||
#4=IFCAPPLICATION(#2,'0.8.0','IfcOpenShell-0.8.0',''); | ||
#5=IFCOWNERHISTORY(#3,#4,$,.NOTDEFINED.,$,#3,#4,1735397006); | ||
#6=IFCDIRECTION((1.,0.,0.)); | ||
#7=IFCDIRECTION((0.,0.,1.)); | ||
#8=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#9=IFCAXIS2PLACEMENT3D(#8,#7,#6); | ||
#10=IFCDIRECTION((0.,1.)); | ||
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#9,#10); | ||
#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0); | ||
#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); | ||
#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.); | ||
#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.); | ||
#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.); | ||
#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.0174532925199433),#16); | ||
#18=IFCCONVERSIONBASEDUNIT(#12,.PLANEANGLEUNIT.,'DEGREE',#17); | ||
#19=IFCUNITASSIGNMENT((#13,#14,#15,#18)); | ||
#20=IFCPROJECT('1mJ5LZpnD8yh32dfmevuI8',#5,'',$,$,$,$,(#11),#19); | ||
#21=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.5,0.0001),(1.,0.))); | ||
#22=IFCINDEXEDPOLYCURVE(#21,(IFCARCINDEX((1,2,3)),IFCLINEINDEX((3,1))),$); | ||
#23=IFCSHAPEREPRESENTATION(#11,'FootPrint','Curve2D',(#22)); | ||
#24=IFCPRODUCTDEFINITIONSHAPE($,$,(#23)); | ||
#25=IFCCARTESIANPOINT((0.,0.,0.)); | ||
#26=IFCAXIS2PLACEMENT3D(#25,$,$); | ||
#27=IFCLOCALPLACEMENT($,#26); | ||
#28=IFCSPACE('2m1MQwdaHFr9rxB4Y7O3_5',$,$,$,$,#27,#24,$,$,$,$); | ||
#29=IFCRELAGGREGATES('0J3nG9PyPEdgpUHCZII324',$,$,$,#20,(#28)); | ||
ENDSEC; | ||
END-ISO-10303-21; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.