2022-12-26 11:29:32 +01:00
|
|
|
import time
|
2025-12-19 18:53:04 +05:00
|
|
|
|
2022-12-26 11:29:32 +01:00
|
|
|
import ifcopenshell
|
2026-08-10 15:31:39 +05:00
|
|
|
|
2026-08-03 19:46:18 +05:00
|
|
|
from ...fixture_generate import normalize_header, pass_if, write_fixture
|
2022-12-26 11:29:32 +01:00
|
|
|
|
2024-07-26 12:00:28 +10:00
|
|
|
names = [("Same", "Same"), ("Different", "SomethingElse")]
|
2022-12-26 11:29:32 +01:00
|
|
|
|
|
|
|
|
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()))
|
2024-07-26 12:00:28 +10:00
|
|
|
f.createIfcPropertySet(ifcopenshell.guid.new(), ownerhist, "MyPset", HasProperties=map(make_prop(f), nms))
|
2026-08-03 16:07:29 +05:00
|
|
|
normalize_header(f)
|
2026-08-03 16:51:10 +05:00
|
|
|
write_fixture(f, __file__, pass_if(len(set(nms)) == len(nms)), f"property-{'-'.join(map(str.lower, nms))}-ifc2x3")
|