mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Add button space to select its boundaries
This commit is contained in:
@@ -23,6 +23,7 @@ classes = (
|
|||||||
operator.LoadProjectSpaceBoundaries,
|
operator.LoadProjectSpaceBoundaries,
|
||||||
operator.LoadSpaceBoundaries,
|
operator.LoadSpaceBoundaries,
|
||||||
operator.LoadBoundary,
|
operator.LoadBoundary,
|
||||||
|
operator.SelectSpaceBoundaries,
|
||||||
operator.SelectProjectBoundaries,
|
operator.SelectProjectBoundaries,
|
||||||
operator.ColourByRelatedBuildingElement,
|
operator.ColourByRelatedBuildingElement,
|
||||||
operator.EnableEditingBoundary,
|
operator.EnableEditingBoundary,
|
||||||
|
|||||||
@@ -158,6 +158,22 @@ class LoadSpaceBoundaries(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class SelectSpaceBoundaries(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_space_boundaries"
|
||||||
|
bl_label = "Select all space boundaries"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
for obj in context.visible_objects:
|
||||||
|
obj.select_set(False)
|
||||||
|
element = tool.Ifc.get_entity(context.active_object)
|
||||||
|
for rel in element.BoundedBy or []:
|
||||||
|
obj = tool.Ifc.get_object(rel)
|
||||||
|
if obj:
|
||||||
|
obj.select_set(True)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class SelectProjectBoundaries(bpy.types.Operator):
|
class SelectProjectBoundaries(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_project_space_boundaries"
|
bl_idname = "bim.select_project_space_boundaries"
|
||||||
bl_label = "Select all project space boundaries"
|
bl_label = "Select all project space boundaries"
|
||||||
@@ -208,11 +224,10 @@ class ColourByRelatedBuildingElement(bpy.types.Operator):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.file = tool.Ifc.get()
|
|
||||||
for obj in context.visible_objects:
|
for obj in context.visible_objects:
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||||
continue
|
continue
|
||||||
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element.is_a("IfcRelSpaceBoundary"):
|
if not element.is_a("IfcRelSpaceBoundary"):
|
||||||
continue
|
continue
|
||||||
obj.color = get_colour(element)
|
obj.color = get_colour(element)
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ class BIM_PT_SpaceBoundaries(Panel):
|
|||||||
self.ifc_file = tool.Ifc.get()
|
self.ifc_file = tool.Ifc.get()
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.operator("bim.load_space_boundaries")
|
row.operator("bim.load_space_boundaries")
|
||||||
|
row.operator("bim.select_space_boundaries", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
for boundary in SpaceBoundariesData.data["boundaries"]:
|
for boundary in SpaceBoundariesData.data["boundaries"]:
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.label(text=boundary["description"], icon="GHOST_ENABLED")
|
row.label(text=boundary["description"], icon="GHOST_ENABLED")
|
||||||
|
|||||||
Reference in New Issue
Block a user