WIP implement void module with add / remove openings. See #1222.

This commit is contained in:
Dion Moult
2021-01-12 15:12:53 +11:00
parent 1836136049
commit 9400eab0ff
10 changed files with 282 additions and 78 deletions
@@ -76,6 +76,7 @@ class AssignClass(bpy.types.Operator):
ifc_class: bpy.props.StringProperty()
predefined_type: bpy.props.StringProperty()
userdefined_type: bpy.props.StringProperty()
context_id: bpy.props.IntProperty()
def execute(self, context):
objects = [bpy.data.objects.get(self.obj)] if self.obj else bpy.context.selected_objects
@@ -107,7 +108,7 @@ class AssignClass(bpy.types.Operator):
obj.name = "{}/{}".format(product.is_a(), obj.name)
obj.BIMObjectProperties.ifc_definition_id = int(product.id())
bpy.ops.bim.add_representation(obj=obj.name)
bpy.ops.bim.add_representation(obj=obj.name, context_id=self.context_id)
if product.is_a("IfcElementType"):
self.place_in_types_collection(obj)
@@ -160,12 +161,12 @@ class AssignClass(bpy.types.Operator):
class UnassignClass(bpy.types.Operator):
bl_idname = "bim.unassign_class"
bl_label = "Unassign IFC Class"
object_name: bpy.props.StringProperty()
obj: bpy.props.StringProperty()
def execute(self, context):
self.file = IfcStore.get_file()
if self.object_name:
objects = [bpy.data.objects.get(self.object_name)]
if self.obj:
objects = [bpy.data.objects.get(self.obj)]
else:
objects = bpy.context.selected_objects
for obj in objects:
@@ -3,6 +3,7 @@ from bpy.types import Panel
from blenderbim.bim.module.root.data import Data
from blenderbim.bim.ifc import IfcStore
class BIM_PT_class(Panel):
bl_label = "IFC Class"
bl_idname = "BIM_PT_class"
@@ -34,8 +35,7 @@ class BIM_PT_class(Panel):
row = self.layout.row(align=True)
row.label(text=name)
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
op = row.operator("bim.unassign_class", icon="X", text="")
op.object_name = context.active_object.name
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
else:
self.draw_class_dropdowns()
row = self.layout.row(align=True)