Arch: Use ifcopenshell.guid.new() to generate IFC UUIDs
This commit is contained in:
@@ -1583,7 +1583,7 @@ def export(exportList,filename):
|
||||
if "IfcUID" in obj.IfcData.keys():
|
||||
uid = str(obj.IfcData["IfcUID"])
|
||||
if not uid:
|
||||
uid = ifcopenshell.guid.compress(uuid.uuid1().hex)
|
||||
uid = ifcopenshell.guid.new()
|
||||
# storing the uid for further use
|
||||
if STORE_UID and hasattr(obj,"IfcData"):
|
||||
d = obj.IfcData
|
||||
@@ -1716,7 +1716,7 @@ def export(exportList,filename):
|
||||
if six.PY2:
|
||||
l = l.encode("utf8")
|
||||
prod2 = ifcfile.createIfcBuildingElementProxy(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
l,
|
||||
None,
|
||||
@@ -1728,7 +1728,7 @@ def export(exportList,filename):
|
||||
)
|
||||
subproducts[o.Name] = prod2
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'Addition',
|
||||
'',
|
||||
@@ -1753,7 +1753,7 @@ def export(exportList,filename):
|
||||
if six.PY2:
|
||||
l = l.encode("utf8")
|
||||
prod2 = ifcfile.createIfcOpeningElement(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
l,
|
||||
None,
|
||||
@@ -1764,7 +1764,7 @@ def export(exportList,filename):
|
||||
)
|
||||
subproducts[o.Name] = prod2
|
||||
ifcfile.createIfcRelVoidsElement(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'Subtraction',
|
||||
'',
|
||||
@@ -1840,14 +1840,14 @@ def export(exportList,filename):
|
||||
psets.setdefault(pset,[]).append(p)
|
||||
for pname,props in psets.items():
|
||||
pset = ifcfile.createIfcPropertySet(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
pname,
|
||||
None,
|
||||
props
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -1916,13 +1916,13 @@ def export(exportList,filename):
|
||||
print("Unable to create a property of type:",tp)
|
||||
if props:
|
||||
pset = ifcfile.createIfcPropertySet(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,cat,
|
||||
None,
|
||||
props
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -1966,14 +1966,14 @@ def export(exportList,filename):
|
||||
props.append(ifcbin.createIfcPropertySingleValue(str(key),str(tp),val))
|
||||
if props:
|
||||
pset = ifcfile.createIfcPropertySet(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'PropertySet',
|
||||
None,
|
||||
props
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -2003,14 +2003,14 @@ def export(exportList,filename):
|
||||
quantities.append(ifcfile.createIfcQuantityVolume('Volume',None,None,obj.Shape.Volume/1000000000.0))
|
||||
if quantities:
|
||||
eltq = ifcfile.createIfcElementQuantity(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
"ElementQuantities",
|
||||
None,
|
||||
"FreeCAD",quantities
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -2087,13 +2087,13 @@ def export(exportList,filename):
|
||||
FreeCADProps.append(ifcbin.createIfcPropertySingleValue("FreeCAD_"+prop,itype,ivalue))
|
||||
if FreeCADProps:
|
||||
pset = ifcfile.createIfcPropertySet(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,'FreeCADPropertySet',
|
||||
None,
|
||||
FreeCADProps
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -2102,14 +2102,14 @@ def export(exportList,filename):
|
||||
)
|
||||
if FreeCADGuiProps:
|
||||
pset = ifcfile.createIfcPropertySet(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'FreeCADGuiPropertySet',
|
||||
None,
|
||||
FreeCADGuiProps
|
||||
)
|
||||
ifcfile.createIfcRelDefinesByProperties(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
None,
|
||||
None,
|
||||
@@ -2139,7 +2139,7 @@ def export(exportList,filename):
|
||||
treated.append(c.Name)
|
||||
if subs:
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.new(),
|
||||
history,
|
||||
'Assembly',
|
||||
'',
|
||||
@@ -2163,7 +2163,7 @@ def export(exportList,filename):
|
||||
f = products[floor.Name]
|
||||
if children:
|
||||
ifcfile.createIfcRelContainedInSpatialStructure(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.new(),
|
||||
history,
|
||||
'StoreyLink',
|
||||
'',
|
||||
@@ -2194,7 +2194,7 @@ def export(exportList,filename):
|
||||
b = products[building.Name]
|
||||
if children:
|
||||
ifcfile.createIfcRelContainedInSpatialStructure(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'BuildingLink',
|
||||
'',
|
||||
@@ -2203,7 +2203,7 @@ def export(exportList,filename):
|
||||
)
|
||||
if childfloors:
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'BuildingLink',
|
||||
'',
|
||||
@@ -2233,7 +2233,7 @@ def export(exportList,filename):
|
||||
if not sites:
|
||||
if DEBUG: print("No site found. Adding default site")
|
||||
sites = [ifcfile.createIfcSite(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,"Default Site",
|
||||
'',
|
||||
None,
|
||||
@@ -2248,7 +2248,7 @@ def export(exportList,filename):
|
||||
None
|
||||
)]
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'ProjectLink',
|
||||
'',
|
||||
@@ -2257,7 +2257,7 @@ def export(exportList,filename):
|
||||
if not buildings:
|
||||
if DEBUG: print("No building found. Adding default building")
|
||||
buildings = [ifcfile.createIfcBuilding(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
"Default Building",
|
||||
'',
|
||||
@@ -2272,14 +2272,14 @@ def export(exportList,filename):
|
||||
)]
|
||||
if floors:
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'BuildingLink',
|
||||
'',
|
||||
buildings[0],floors
|
||||
)
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'SiteLink',
|
||||
'',
|
||||
@@ -2298,7 +2298,7 @@ def export(exportList,filename):
|
||||
if untreated:
|
||||
if not defaulthost:
|
||||
defaulthost = ifcfile.createIfcBuildingStorey(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
"Default Storey",
|
||||
'',
|
||||
@@ -2310,7 +2310,7 @@ def export(exportList,filename):
|
||||
None
|
||||
)
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'DefaultStoreyLink',
|
||||
'',
|
||||
@@ -2318,7 +2318,7 @@ def export(exportList,filename):
|
||||
[defaulthost]
|
||||
)
|
||||
ifcfile.createIfcRelContainedInSpatialStructure(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'UnassignedObjectsLink',
|
||||
'',
|
||||
@@ -2363,7 +2363,7 @@ def export(exportList,filename):
|
||||
isr = ifcfile.createIfcStyledRepresentation(context,"Style","Material",[isi])
|
||||
imd = ifcfile.createIfcMaterialDefinitionRepresentation(None,None,[isr],mat)
|
||||
ifcfile.createIfcRelAssociatesMaterial(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'MaterialLink',
|
||||
'',
|
||||
@@ -2443,7 +2443,7 @@ def export(exportList,filename):
|
||||
if six.PY2:
|
||||
l = l.encode("utf8")
|
||||
ann = ifcfile.createIfcAnnotation(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,l,
|
||||
'',
|
||||
None,
|
||||
@@ -2486,7 +2486,7 @@ def export(exportList,filename):
|
||||
if six.PY2:
|
||||
name = name.encode("utf8")
|
||||
grp = ifcfile.createIfcGroup(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
name,
|
||||
'',
|
||||
@@ -2495,7 +2495,7 @@ def export(exportList,filename):
|
||||
products[g[0]] = grp
|
||||
spatialelements[g[0]] = grp
|
||||
ass = ifcfile.createIfcRelAssignsToGroup(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'GroupLink',
|
||||
'',
|
||||
@@ -2515,7 +2515,7 @@ def export(exportList,filename):
|
||||
stack.setdefault(parent.Name,[]).append(spatialelements[g[0]])
|
||||
for k,v in stack.items():
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'GroupStackLink',
|
||||
'',
|
||||
@@ -2530,7 +2530,7 @@ def export(exportList,filename):
|
||||
if remaining:
|
||||
if not defaulthost:
|
||||
defaulthost = ifcfile.createIfcBuildingStorey(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
"Default Storey",
|
||||
'',
|
||||
@@ -2542,7 +2542,7 @@ def export(exportList,filename):
|
||||
None
|
||||
)
|
||||
ifcfile.createIfcRelAggregates(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'DefaultStoreyLink',
|
||||
'',
|
||||
@@ -2550,7 +2550,7 @@ def export(exportList,filename):
|
||||
[defaulthost]
|
||||
)
|
||||
ifcfile.createIfcRelContainedInSpatialStructure(
|
||||
ifcopenshell.guid.compress(uuid.uuid1().hex),
|
||||
ifcopenshell.guid.new(),
|
||||
history,
|
||||
'AnnotationsLink',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user