From 7a8bcbee33e7abd3a50652d8761eaae987b8a9aa Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 11 Mar 2023 20:44:59 +0100 Subject: [PATCH] #2685 poly curve test cases --- .../rules/fail-poly-curve-1-2-1-2-ifc4.ifc | 11 +++++++++++ .../rules/fail-poly-curve-1-2-1-2-ifc4x3_add1.ifc | 11 +++++++++++ .../test/fixtures/rules/generate_25.py | 14 ++++++++++++++ .../rules/pass-poly-curve-1-2-2-3-ifc4.ifc | 11 +++++++++++ .../rules/pass-poly-curve-1-2-2-3-ifc4x3_add1.ifc | 11 +++++++++++ .../rules/pass-poly-curve-no-segments-ifc4.ifc | 11 +++++++++++ .../pass-poly-curve-no-segments-ifc4x3_add1.ifc | 11 +++++++++++ 7 files changed, 80 insertions(+) create mode 100644 src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4.ifc create mode 100644 src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4x3_add1.ifc create mode 100644 src/ifcopenshell-python/test/fixtures/rules/generate_25.py create mode 100644 src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4.ifc create mode 100644 src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4x3_add1.ifc create mode 100644 src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4.ifc create mode 100644 src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4x3_add1.ifc diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4.ifc new file mode 100644 index 0000000000..6fa940ea24 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.))); +#2=IFCINDEXEDPOLYCURVE(#1,(IFCLINEINDEX((1,2)),IFCLINEINDEX((1,2))),$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4x3_add1.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4x3_add1.ifc new file mode 100644 index 0000000000..ce4d05ee1a --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-poly-curve-1-2-1-2-ifc4x3_add1.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4X3_ADD1')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.)),$); +#2=IFCINDEXEDPOLYCURVE(#1,(IFCLINEINDEX((1,2)),IFCLINEINDEX((1,2))),$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_25.py b/src/ifcopenshell-python/test/fixtures/rules/generate_25.py new file mode 100644 index 0000000000..4df6537293 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/generate_25.py @@ -0,0 +1,14 @@ +import ifcopenshell + +segs = [ + lambda _: None, + lambda f: [f.createIfcLineIndex((1,2)),f.createIfcLineIndex((2,3))], + lambda f: [f.createIfcLineIndex((1,2)),f.createIfcLineIndex((1,2))] +] + +for schema in ('ifc4', 'ifc4x3_add1'): + for i, seg in enumerate(segs): + f = ifcopenshell.file(schema=schema) + s = seg(f) + f.createIfcIndexedPolyCurve(f.createIfcCartesianPointList2D([(0.0, 0.0),(0.0, 1.0),(1.0, 1.0)]), s) + f.write(f'{"fail" if i == 2 else "pass"}-poly-curve-{"no-segments" if s is None else "-".join(["-".join(map(str, x[0])) for x in s])}-{schema}.ifc') diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4.ifc new file mode 100644 index 0000000000..1c15f53d0d --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.))); +#2=IFCINDEXEDPOLYCURVE(#1,(IFCLINEINDEX((1,2)),IFCLINEINDEX((2,3))),$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4x3_add1.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4x3_add1.ifc new file mode 100644 index 0000000000..bbf6bf9c6a --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-1-2-2-3-ifc4x3_add1.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4X3_ADD1')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.)),$); +#2=IFCINDEXEDPOLYCURVE(#1,(IFCLINEINDEX((1,2)),IFCLINEINDEX((2,3))),$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4.ifc new file mode 100644 index 0000000000..497973d5a5 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.))); +#2=IFCINDEXEDPOLYCURVE(#1,$,$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4x3_add1.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4x3_add1.ifc new file mode 100644 index 0000000000..63ce19a8f8 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-poly-curve-no-segments-ifc4x3_add1.ifc @@ -0,0 +1,11 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-03-11T14:53:24',(),(),'IfcOpenShell v0.7.0-c4b77c2a0','IfcOpenShell v0.7.0-c4b77c2a0',''); +FILE_SCHEMA(('IFC4X3_ADD1')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,1.),(1.,1.)),$); +#2=IFCINDEXEDPOLYCURVE(#1,$,$); +ENDSEC; +END-ISO-10303-21;