mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
avoid IfcSpatialElement errors in ifc2x3
IfcSpatialElement was added only in ifc4
This commit is contained in:
@@ -43,7 +43,11 @@ class SpatialData:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def containers(cls):
|
def containers(cls):
|
||||||
results = {}
|
results = {}
|
||||||
for container in tool.Ifc.get().by_type("IfcSpatialElement"):
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
|
spatial_elements = tool.Ifc.get().by_type("IfcSpatialStructureElement")
|
||||||
|
else:
|
||||||
|
spatial_elements = tool.Ifc.get().by_type("IfcSpatialElement")
|
||||||
|
for container in spatial_elements:
|
||||||
results[container.id()] = {
|
results[container.id()] = {
|
||||||
"type": container.is_a(),
|
"type": container.is_a(),
|
||||||
"id": container.id(),
|
"id": container.id(),
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class Geometry(blenderbim.core.tool.Geometry):
|
|||||||
if element.VoidsElements:
|
if element.VoidsElements:
|
||||||
bpy.ops.bim.remove_opening(opening_id=element.id())
|
bpy.ops.bim.remove_opening(opening_id=element.id())
|
||||||
else:
|
else:
|
||||||
is_spatial = element.is_a("IfcSpatialElement")
|
is_spatial = element.is_a() in ("IfcSpatialElement", "IfcSpatialStructureElement")
|
||||||
if getattr(element, "HasOpenings", None):
|
if getattr(element, "HasOpenings", None):
|
||||||
for rel in element.HasOpenings:
|
for rel in element.HasOpenings:
|
||||||
bpy.ops.bim.remove_opening(opening_id=rel.RelatedOpeningElement.id())
|
bpy.ops.bim.remove_opening(opening_id=rel.RelatedOpeningElement.id())
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
if not structure.is_a("IfcSpatialStructureElement"):
|
if not structure.is_a("IfcSpatialStructureElement"):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if not structure.is_a("IfcSpatialElement"):
|
if not structure.is_a() in ("IfcSpatialElement", "IfcSpatialStructureElement"):
|
||||||
return False
|
return False
|
||||||
if not hasattr(element, "ReferencedInStructures"):
|
if not hasattr(element, "ReferencedInStructures"):
|
||||||
return False
|
return False
|
||||||
@@ -204,7 +204,7 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
parent = tool.Ifc.get().by_type("IfcProject")[0]
|
parent = tool.Ifc.get().by_type("IfcProject")[0]
|
||||||
|
|
||||||
for object in ifcopenshell.util.element.get_parts(parent) or []:
|
for object in ifcopenshell.util.element.get_parts(parent) or []:
|
||||||
if object.is_a("IfcSpatialElement"):
|
if object.is_a() in ("IfcSpatialElement", "IfcSpatialStructureElement"):
|
||||||
cls.create_new_storey_li(object, 0)
|
cls.create_new_storey_li(object, 0)
|
||||||
cls.props.is_container_update_enabled = True
|
cls.props.is_container_update_enabled = True
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
new.has_children = True
|
new.has_children = True
|
||||||
if new.is_expanded:
|
if new.is_expanded:
|
||||||
for related_object in ifcopenshell.util.element.get_parts(element) or []:
|
for related_object in ifcopenshell.util.element.get_parts(element) or []:
|
||||||
if related_object.is_a("IfcSpatialElement"):
|
if related_object.is_a() in ("IfcSpatialElement", "IfcSpatialStructureElement"):
|
||||||
cls.create_new_storey_li(related_object, level_index + 1)
|
cls.create_new_storey_li(related_object, level_index + 1)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user