ifcopenshell.validate to check unique guids (IfcRoot.UR1)

This commit is contained in:
Andrej730
2024-04-02 17:17:23 +05:00
parent 72011c2fbd
commit e5cfe5cf3c
8 changed files with 128 additions and 0 deletions
@@ -0,0 +1,26 @@
import ifcopenshell
import ifcopenshell.api
from pathlib import Path
guid1 = "3pdqyORIn8KBHZAhhtJ72T"
guid2 = "1sEzC8v31DshmvW5t5P631"
for schema in ("ifc2x3", "ifc4", "ifc4x3"):
for status in ("fail", "pass"):
f = ifcopenshell.file(schema=schema)
# setup IfcOwnerHistory
if schema == "ifc2x3":
ifcopenshell.api.run("owner.add_application", f)
person = ifcopenshell.api.run("owner.add_person", f)
organization = ifcopenshell.api.run("owner.add_organisation", f)
ifcopenshell.api.run("owner.add_person_and_organisation", f, person=person, organisation=organization)
wall1 = ifcopenshell.api.run("root.create_entity", f)
wall2 = ifcopenshell.api.run("root.create_entity", f)
wall1.GlobalId = guid1
wall2.GlobalId = guid1 if status == "fail" else guid2
filename = f"{status}-{'not-' if status == 'pass' else ''}duplicated-guids-{schema}.ifc"
f.write(Path(__file__).parent / filename)