mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
|
|
import time
|
||
|
|
import ifcopenshell
|
||
|
|
|
||
|
|
names = [
|
||
|
|
("Same", "Same"),
|
||
|
|
("Different", "SomethingElse")
|
||
|
|
]
|
||
|
|
|
||
|
|
make_prop = lambda f: lambda nm: f.createIfcPropertySingleValue(Name=nm)
|
||
|
|
|
||
|
|
old_map = map
|
||
|
|
map = lambda fn, *args: list(old_map(fn, *args))
|
||
|
|
|
||
|
|
for nms in names:
|
||
|
|
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()))
|
||
|
|
f.createIfcPropertySet(
|
||
|
|
ifcopenshell.guid.new(),
|
||
|
|
ownerhist,
|
||
|
|
"MyPset",
|
||
|
|
HasProperties=map(make_prop(f), nms)
|
||
|
|
)
|
||
|
|
f.write(f"{'pass' if len(set(nms)) == len(nms) else 'fail'}-property-{'-'.join(map(str.lower, nms))}-ifc2x3.ifc")
|
||
|
|
15
|