diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-IfcSpace-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-IfcSpace-ifc2x3.ifc new file mode 100644 index 0000000000..bdbf8dfa4b --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-IfcSpace-ifc2x3.ifc @@ -0,0 +1,25 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-02-12T20:21:51',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); +FILE_SCHEMA(('IFC2X3')); +ENDSEC; +DATA; +#1=IFCPERSON('tfk',$,'Thomas',$,$,$,$,$); +#2=IFCORGANIZATION($,'AECgeeks',$,$,$); +#3=IFCPERSONANDORGANIZATION(#1,#2,$); +#4=IFCAPPLICATION(#2,'v0.7.0-07ee62eb9','IfcOpenShell','IfcOpenShell v0.7.0-07ee62eb9'); +#5=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); +#6=IFCUNITASSIGNMENT((#5)); +#7=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,$,$,1676229711); +#8=IFCCARTESIANPOINT((0.,0.,0.)); +#9=IFCAXIS2PLACEMENT3D(#8,$,$); +#10=IFCGEOMETRICREPRESENTATIONCONTEXT($,$,3,$,#9,$); +#11=IFCPROJECT('1H9tG2advDmQ_EAMG$r45x',#7,'My Project',$,$,$,$,(#10),#6); +#12=IFCZONE('3HHW8BH1r0fuzxFEsGo_r8',#7,$,$,$); +#13=IFCWALL('2Gji9puRXAW8VTWeCjY_cf',#7,$,$,$,$,$,$); +#14=IFCSPACE('0T2hQEuHH9e93TCh6b1$vn',#7,$,$,$,$,$,$,$,$,$); +#15=IFCRELASSIGNSTOGROUP('1IM2jWEW1CMAjysJOWbJox',#7,$,$,(#13,#14),$,#12); +#16=IFCRELAGGREGATES('0XSXh8axL1QR0GEJYOhdIU',#7,$,$,#11,(#14)); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-ifc2x3.ifc new file mode 100644 index 0000000000..092fc17b23 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/fail-zone-with-IfcWall-ifc2x3.ifc @@ -0,0 +1,24 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-02-12T20:21:51',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); +FILE_SCHEMA(('IFC2X3')); +ENDSEC; +DATA; +#1=IFCPERSON('tfk',$,'Thomas',$,$,$,$,$); +#2=IFCORGANIZATION($,'AECgeeks',$,$,$); +#3=IFCPERSONANDORGANIZATION(#1,#2,$); +#4=IFCAPPLICATION(#2,'v0.7.0-07ee62eb9','IfcOpenShell','IfcOpenShell v0.7.0-07ee62eb9'); +#5=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); +#6=IFCUNITASSIGNMENT((#5)); +#7=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,$,$,1676229711); +#8=IFCCARTESIANPOINT((0.,0.,0.)); +#9=IFCAXIS2PLACEMENT3D(#8,$,$); +#10=IFCGEOMETRICREPRESENTATIONCONTEXT($,$,3,$,#9,$); +#11=IFCPROJECT('0xCxhhQgT6pQHr6weFBb0$',#7,'My Project',$,$,$,$,(#10),#6); +#12=IFCZONE('38tOGE$EP0cuAlNQ3pJQQ5',#7,$,$,$); +#13=IFCWALL('0$go2uI5nCpuCTZWQA5ogk',#7,$,$,$,$,$,$); +#14=IFCRELASSIGNSTOGROUP('0u0QbS1MbAWuPmbF$1o_Sc',#7,$,$,(#13),$,#12); +#15=IFCRELAGGREGATES('1jWolXHqPC2AOXHDZZCI8I',#7,$,$,#11,()); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_24.py b/src/ifcopenshell-python/test/fixtures/rules/generate_24.py new file mode 100644 index 0000000000..312af62c94 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/generate_24.py @@ -0,0 +1,32 @@ +import time +import ifcopenshell + +for ents in [('IfcWall',), ('IfcSpace',), ('IfcZone', 'IfcSpace',), ('IfcWall', 'IfcSpace',)]: + f = ifcopenshell.file(schema="IFC2X3") + p = f.createIfcPerson(Id="tfk", GivenName="Thomas") + o = f.createIfcOrganization(Name="AECgeeks") + pando = f.createIfcPersonAndOrganization(p, o) + appl = f.createIfcApplication(o, ifcopenshell.version, "IfcOpenShell", f"IfcOpenShell {ifcopenshell.version}") + units = f.createIfcUnitAssignment(Units=[f.createIfcSIUnit(None, "LENGTHUNIT", None, "METRE")]) + ownerhist = f.createIfcOwnerHistory(pando, appl, ChangeAction="ADDED", CreationDate=int(time.time())) + proj = f.createIfcProject(ifcopenshell.guid.new(), ownerhist, 'My Project', UnitsInContext=units, RepresentationContexts=[ + f.createIfcGeometricRepresentationContext( + None, None, 3, None, + f.create_entity(f'IfcAxis2Placement3D', f.createIfcCartesianPoint((0., 0., 0.))), + ) + ]) + def elems(): + for ent in ents: + el = f.create_entity(ent, + ifcopenshell.guid.new(), + ownerhist + ) + if ent == 'IfcZone': + f.createIfcRelAssignsToGroup(ifcopenshell.guid.new(),ownerhist,RelatedObjects=[f.createIfcSpace(ifcopenshell.guid.new(), + ownerhist)],RelatingGroup=el) + yield el + zone = f.createIfcZone(ifcopenshell.guid.new(),ownerhist) + f.createIfcRelAssignsToGroup(ifcopenshell.guid.new(),ownerhist,RelatedObjects=list(elems()),RelatingGroup=zone) + f.createIfcRelAggregates(ifcopenshell.guid.new(),ownerhist,RelatingObject=proj,RelatedObjects=f.by_type('IfcSpace')) + valid = not (set(ents) - {'IfcZone', 'IfcSpace'}) + f.write(f"{'pass' if valid else 'fail'}-zone-with-{'-'.join(ents)}-{f.schema.lower()}.ifc") diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcSpace-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcSpace-ifc2x3.ifc new file mode 100644 index 0000000000..750b5dc462 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcSpace-ifc2x3.ifc @@ -0,0 +1,24 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-02-12T20:21:51',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); +FILE_SCHEMA(('IFC2X3')); +ENDSEC; +DATA; +#1=IFCPERSON('tfk',$,'Thomas',$,$,$,$,$); +#2=IFCORGANIZATION($,'AECgeeks',$,$,$); +#3=IFCPERSONANDORGANIZATION(#1,#2,$); +#4=IFCAPPLICATION(#2,'v0.7.0-07ee62eb9','IfcOpenShell','IfcOpenShell v0.7.0-07ee62eb9'); +#5=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); +#6=IFCUNITASSIGNMENT((#5)); +#7=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,$,$,1676229711); +#8=IFCCARTESIANPOINT((0.,0.,0.)); +#9=IFCAXIS2PLACEMENT3D(#8,$,$); +#10=IFCGEOMETRICREPRESENTATIONCONTEXT($,$,3,$,#9,$); +#11=IFCPROJECT('1pxfBQruPF7RcacoFFAcYS',#7,'My Project',$,$,$,$,(#10),#6); +#12=IFCZONE('2bgi3qwLv6gAADBOlH$1Es',#7,$,$,$); +#13=IFCSPACE('19D42MJpH7PwBsPnDYkYbK',#7,$,$,$,$,$,$,$,$,$); +#14=IFCRELASSIGNSTOGROUP('0q2WH61PX4MQT6PjonmWIP',#7,$,$,(#13),$,#12); +#15=IFCRELAGGREGATES('3mVlQv775FmAMDm5qIaK3i',#7,$,$,#11,(#13)); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcZone-IfcSpace-ifc2x3.ifc b/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcZone-IfcSpace-ifc2x3.ifc new file mode 100644 index 0000000000..1328376336 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/rules/pass-zone-with-IfcZone-IfcSpace-ifc2x3.ifc @@ -0,0 +1,27 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-02-12T20:21:51',(),(),'IfcOpenShell v0.7.0-07ee62eb9','IfcOpenShell v0.7.0-07ee62eb9',''); +FILE_SCHEMA(('IFC2X3')); +ENDSEC; +DATA; +#1=IFCPERSON('tfk',$,'Thomas',$,$,$,$,$); +#2=IFCORGANIZATION($,'AECgeeks',$,$,$); +#3=IFCPERSONANDORGANIZATION(#1,#2,$); +#4=IFCAPPLICATION(#2,'v0.7.0-07ee62eb9','IfcOpenShell','IfcOpenShell v0.7.0-07ee62eb9'); +#5=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.); +#6=IFCUNITASSIGNMENT((#5)); +#7=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,$,$,1676229711); +#8=IFCCARTESIANPOINT((0.,0.,0.)); +#9=IFCAXIS2PLACEMENT3D(#8,$,$); +#10=IFCGEOMETRICREPRESENTATIONCONTEXT($,$,3,$,#9,$); +#11=IFCPROJECT('2bOwvLMAz4Tfb2RfzKS25l',#7,'My Project',$,$,$,$,(#10),#6); +#12=IFCZONE('1g5XEeNib1WR56vNj66NG$',#7,$,$,$); +#13=IFCZONE('0ZlVvfiGb948fCUTLl_oJH',#7,$,$,$); +#14=IFCSPACE('2wKCe2jcD2p8lf3HAtkif1',#7,$,$,$,$,$,$,$,$,$); +#15=IFCRELASSIGNSTOGROUP('2IeqRCKt9CugF5FReNjXk8',#7,$,$,(#14),$,#13); +#16=IFCSPACE('15WZdfHTH92P7YgQBfAEtR',#7,$,$,$,$,$,$,$,$,$); +#17=IFCRELASSIGNSTOGROUP('0kQgwtAlT3NwBPjzuSqM7K',#7,$,$,(#13,#16),$,#12); +#18=IFCRELAGGREGATES('1J_GGWX8v9RR8tHrWBiqg6',#7,$,$,#11,(#14,#16)); +ENDSEC; +END-ISO-10303-21;