mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Bonsai - exclude selected non-ifcobjects from type assignment/unsassignment #6454
This commit is contained in:
@@ -50,6 +50,8 @@ class AssignType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
model_props = tool.Model.get_model_props()
|
model_props = tool.Model.get_model_props()
|
||||||
for obj in related_objects:
|
for obj in related_objects:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
if not element or not element.is_a("IfcObject"):
|
||||||
|
continue
|
||||||
core.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
|
core.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
|
||||||
if model_props.occurrence_name_style == "TYPE":
|
if model_props.occurrence_name_style == "TYPE":
|
||||||
obj.name = tool.Model.generate_occurrence_name(relating_type, element.is_a())
|
obj.name = tool.Model.generate_occurrence_name(relating_type, element.is_a())
|
||||||
@@ -69,7 +71,7 @@ class UnassignType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
objs = [bpy.data.objects.get(self.related_object)] if self.related_object else context.selected_objects
|
objs = [bpy.data.objects.get(self.related_object)] if self.related_object else context.selected_objects
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element or element.is_a("IfcElementType"):
|
if not element or not element.is_a("IfcObject"):
|
||||||
continue
|
continue
|
||||||
ifcopenshell.api.run("type.unassign_type", self.file, related_objects=[element])
|
ifcopenshell.api.run("type.unassign_type", self.file, related_objects=[element])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user