diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc4.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc4.ifc new file mode 100644 index 0000000000..9bfa144c2e --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc4.ifc @@ -0,0 +1,16 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCCARTESIANPOINT((0.,0.)); +#2=IFCAXIS2PLACEMENT2D(#1,$); +#3=IFCRECTANGLEPROFILEDEF(.AREA.,$,#2,1.,1.); +#4=IFCCARTESIANPOINT((0.,0.,0.)); +#5=IFCAXIS2PLACEMENT3D(#4,$,$); +#6=IFCDIRECTION((0.,0.,0.)); +#7=IFCEXTRUDEDAREASOLID(#3,#5,#6,1.); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-1.0-0.0-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-1.0-0.0-ifc2x3.ifc index 7c12d81f39..8ee91bd55a 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-1.0-0.0-ifc2x3.ifc +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-1.0-0.0-ifc2x3.ifc @@ -1,7 +1,7 @@ ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); -FILE_NAME('','2022-12-20T12:05:46',(),(),'IfcOpenShell v0.7.0-fa6bbf2d','IfcOpenShell v0.7.0-fa6bbf2d',''); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_11.py b/src/ifcopenshell-python/test/fixtures/rules/generate_11.py index 9e31608608..908a4297e4 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/generate_11.py +++ b/src/ifcopenshell-python/test/fixtures/rules/generate_11.py @@ -2,18 +2,33 @@ import ifcopenshell depth = 1.0 for (dir_x, dir_z) in ((0., -1.), (0., 0.), (1., 0.), (1., 0.001), (0., 1.)): - f = ifcopenshell.file(schema="IFC2X3") - f.createIfcExtrudedAreaSolid( - f.createIfcRectangleProfileDef( - "AREA", None, - f.createIfcAxis2Placement2D( - f.createIfcCartesianPoint((0., 0.)) - ), 1., 1. - ), - f.createIfcAxis2Placement3D( - f.createIfcCartesianPoint((0., 0., 0.)) - ), - f.createIfcDirection((dir_x, 0., dir_z)), - depth - ) - f.write(f"{'pass' if dir_z != 0. else 'fail'}-extrusion-dir-{dir_x}-{dir_z}-ifc2x3.ifc") + + schemas = ['IFC2X3'] + if (dir_x, dir_z) == (0., 0.): + schemas.append('IFC4') + + for schema in schemas: + f = ifcopenshell.file(schema=schema) + f.createIfcExtrudedAreaSolid( + f.createIfcRectangleProfileDef( + "AREA", None, + f.createIfcAxis2Placement2D( + f.createIfcCartesianPoint((0., 0.)) + ), 1., 1. + ), + f.createIfcAxis2Placement3D( + f.createIfcCartesianPoint((0., 0., 0.)) + ), + f.createIfcDirection((dir_x, 0., dir_z)), + depth + ) + + # Due to the way IfcDotProduct and IfcNormalise interact, (0 0 0) actually + # results into indeterminate. But in IFC4 onwars there is a rule in IfcDirection + # for non-zero magnitude + + valid = dir_z != 0. + if f.schema == 'IFC2X3' and (dir_x, dir_z) == (0., 0.): + valid = True + + f.write(f"{'pass' if valid else 'fail'}-extrusion-dir-{dir_x}-{dir_z}-{f.schema.lower()}.ifc") diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0--1.0-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0--1.0-ifc2x3.ifc index 2512ed2505..fb03efb5c2 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0--1.0-ifc2x3.ifc +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0--1.0-ifc2x3.ifc @@ -1,7 +1,7 @@ ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); -FILE_NAME('','2022-12-20T12:05:46',(),(),'IfcOpenShell v0.7.0-fa6bbf2d','IfcOpenShell v0.7.0-fa6bbf2d',''); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-0.0-ifc2x3.ifc similarity index 78% rename from src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc2x3.ifc rename to src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-0.0-ifc2x3.ifc index 330ab3d3ec..e70f189674 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/fail-extrusion-dir-0.0-0.0-ifc2x3.ifc +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-0.0-ifc2x3.ifc @@ -1,7 +1,7 @@ ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); -FILE_NAME('','2022-12-20T12:05:46',(),(),'IfcOpenShell v0.7.0-fa6bbf2d','IfcOpenShell v0.7.0-fa6bbf2d',''); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-1.0-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-1.0-ifc2x3.ifc index dd541dab44..441879e207 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-1.0-ifc2x3.ifc +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-0.0-1.0-ifc2x3.ifc @@ -1,7 +1,7 @@ ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); -FILE_NAME('','2022-12-20T12:05:46',(),(),'IfcOpenShell v0.7.0-fa6bbf2d','IfcOpenShell v0.7.0-fa6bbf2d',''); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-1.0-0.001-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-1.0-0.001-ifc2x3.ifc index 6eaa068357..3b62ed9967 100644 --- a/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-1.0-0.001-ifc2x3.ifc +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-extrusion-dir-1.0-0.001-ifc2x3.ifc @@ -1,7 +1,7 @@ ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); -FILE_NAME('','2022-12-20T12:05:46',(),(),'IfcOpenShell v0.7.0-fa6bbf2d','IfcOpenShell v0.7.0-fa6bbf2d',''); +FILE_NAME('','2023-02-13T13:31:19',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA;