mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 00:46:36 +00:00
Run black on IOS-Python
This commit is contained in:
+43
-18
@@ -1,7 +1,18 @@
|
||||
import time
|
||||
import ifcopenshell
|
||||
|
||||
for ents in [('IfcWall',), ('IfcSpace',), ('IfcZone', 'IfcSpace',), ('IfcWall', 'IfcSpace',)]:
|
||||
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")
|
||||
@@ -9,24 +20,38 @@ for ents in [('IfcWall',), ('IfcSpace',), ('IfcZone', 'IfcSpace',), ('IfcWall',
|
||||
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.))),
|
||||
)
|
||||
])
|
||||
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.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)
|
||||
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'})
|
||||
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user