mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Preventing error when IfcSpatialElement has been deleted and an IFC Type instance is added
This commit is contained in:
@@ -114,5 +114,13 @@ class MepGenerator:
|
|||||||
tool.Ifc.run("system.assign_port", element=element, port=port)
|
tool.Ifc.run("system.assign_port", element=element, port=port)
|
||||||
tool.Ifc.run("geometry.edit_object_placement", product=port, matrix=obj.matrix_world @ mat, is_si=True)
|
tool.Ifc.run("geometry.edit_object_placement", product=port, matrix=obj.matrix_world @ mat, is_si=True)
|
||||||
|
|
||||||
obj.select_set(True)
|
try:
|
||||||
|
obj.select_set(True)
|
||||||
|
except RuntimeError:
|
||||||
|
def msg(self, context):
|
||||||
|
txt = "The created object could not be assigned to a collection. "
|
||||||
|
txt += "Has any IfcSpatialElement been deleted?"
|
||||||
|
self.layout.label(text=txt)
|
||||||
|
|
||||||
|
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
|
||||||
return obj
|
return obj
|
||||||
|
|||||||
@@ -162,7 +162,15 @@ class DumbProfileGenerator:
|
|||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbProfile"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbProfile"})
|
||||||
MaterialData.load(self.file)
|
MaterialData.load(self.file)
|
||||||
obj.select_set(True)
|
try:
|
||||||
|
obj.select_set(True)
|
||||||
|
except RuntimeError:
|
||||||
|
def msg(self, context):
|
||||||
|
txt = "The created object could not be assigned to a collection. "
|
||||||
|
txt += "Has any IfcSpatialElement been deleted?"
|
||||||
|
self.layout.label(text=txt)
|
||||||
|
|
||||||
|
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -306,7 +306,15 @@ class DumbSlabGenerator:
|
|||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer3"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer3"})
|
||||||
MaterialData.load(self.file)
|
MaterialData.load(self.file)
|
||||||
obj.select_set(True)
|
try:
|
||||||
|
obj.select_set(True)
|
||||||
|
except RuntimeError:
|
||||||
|
def msg(self, context):
|
||||||
|
txt = "The created object could not be assigned to a collection. "
|
||||||
|
txt += "Has any IfcSpatialElement been deleted?"
|
||||||
|
self.layout.label(text=txt)
|
||||||
|
|
||||||
|
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -817,7 +817,15 @@ class DumbWallGenerator:
|
|||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer2"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer2"})
|
||||||
MaterialData.load(self.file)
|
MaterialData.load(self.file)
|
||||||
obj.select_set(True)
|
try:
|
||||||
|
obj.select_set(True)
|
||||||
|
except RuntimeError:
|
||||||
|
def msg(self, context):
|
||||||
|
txt = "The created object could not be assigned to a collection. "
|
||||||
|
txt += "Has any IfcSpatialElement been deleted?"
|
||||||
|
self.layout.label(text=txt)
|
||||||
|
|
||||||
|
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ class Collector(blenderbim.core.tool.Collector):
|
|||||||
if obj.users_collection != (object_collection,):
|
if obj.users_collection != (object_collection,):
|
||||||
for collection in obj.users_collection:
|
for collection in obj.users_collection:
|
||||||
collection.objects.unlink(obj)
|
collection.objects.unlink(obj)
|
||||||
object_collection.objects.link(obj)
|
if object_collection is not None:
|
||||||
|
object_collection.objects.link(obj)
|
||||||
|
|
||||||
if collection_collection and collection_collection.children.find(object_collection.name) == -1:
|
if collection_collection and collection_collection.children.find(object_collection.name) == -1:
|
||||||
if bpy.context.scene.collection.children.find(object_collection.name) != -1:
|
if bpy.context.scene.collection.children.find(object_collection.name) != -1:
|
||||||
|
|||||||
Reference in New Issue
Block a user