mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Really barebones UI to list space boundaries.
This commit is contained in:
@@ -31,6 +31,7 @@ if bpy is not None:
|
||||
"sequence": None,
|
||||
"group": None,
|
||||
"structural": None,
|
||||
"boundary": None,
|
||||
"material": None,
|
||||
"style": None,
|
||||
"layer": None,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import bpy
|
||||
from . import ui
|
||||
|
||||
classes = (
|
||||
ui.BIM_PT_boundary,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
@@ -0,0 +1,34 @@
|
||||
import bpy
|
||||
import blenderbim.bim.helper
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.boundary.data import Data
|
||||
|
||||
|
||||
class BIM_PT_boundary(Panel):
|
||||
bl_label = "IFC Space Boundaries"
|
||||
bl_idname = "BIM_PT_boundary"
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "object"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if not context.active_object:
|
||||
return False
|
||||
props = context.active_object.BIMObjectProperties
|
||||
if not props.ifc_definition_id:
|
||||
return False
|
||||
if IfcStore.get_file().by_id(props.ifc_definition_id).is_a() not in ["IfcSpace", "IfcExternalSpatialElement"]:
|
||||
return False
|
||||
return True
|
||||
|
||||
def draw(self, context):
|
||||
self.oprops = context.active_object.BIMObjectProperties
|
||||
if not Data.is_loaded:
|
||||
Data.load(IfcStore.get_file())
|
||||
for boundary_id in Data.spaces.get(self.oprops.ifc_definition_id, []):
|
||||
boundary = Data.boundaries[boundary_id]
|
||||
row = self.layout.row()
|
||||
row.label(text=f"{boundary_id}", icon="GHOST_ENABLED")
|
||||
@@ -47,6 +47,7 @@ def draw_boundary_condition_editable_ui(layout, props):
|
||||
if attribute.is_optional:
|
||||
row.prop(attribute, "is_null", icon="RADIOBUT_OFF" if attribute.is_null else "RADIOBUT_ON", text="")
|
||||
|
||||
|
||||
def draw_boundary_condition_read_only_ui(layout, boundary_condition_data):
|
||||
for key, value in boundary_condition_data.items():
|
||||
if key == "id" or key == "type" or value == None:
|
||||
@@ -59,7 +60,6 @@ def draw_boundary_condition_read_only_ui(layout, boundary_condition_data):
|
||||
row.label(text=str(value))
|
||||
|
||||
|
||||
|
||||
class BIM_PT_structural_boundary_conditions(Panel):
|
||||
bl_label = "IFC Structural Boundary Conditions"
|
||||
bl_idname = "BIM_PT_structural_boundary_conditions"
|
||||
@@ -231,7 +231,9 @@ class BIM_PT_structural_connection(Panel):
|
||||
row.prop(self.props, "ccs_z_angle", text="Z Angle")
|
||||
else:
|
||||
row = self.layout.row()
|
||||
row.operator("bim.enable_editing_structural_connection_cs", text="Edit Connection CS", icon="GREASEPENCIL")
|
||||
row.operator(
|
||||
"bim.enable_editing_structural_connection_cs", text="Edit Connection CS", icon="GREASEPENCIL"
|
||||
)
|
||||
else:
|
||||
row = self.layout.row()
|
||||
row.label(text="TODO")
|
||||
@@ -417,7 +419,6 @@ class BIM_PT_structural_load_cases(Panel):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class BIM_UL_structural_activities(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||
if item:
|
||||
@@ -444,9 +445,7 @@ class BIM_PT_structural_loads(Panel):
|
||||
self.props = context.scene.BIMStructuralProperties
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
row.label(
|
||||
text="{} Structural Loads Found".format(len(Data.structural_loads)), icon="GHOST_ENABLED"
|
||||
)
|
||||
row.label(text="{} Structural Loads Found".format(len(Data.structural_loads)), icon="GHOST_ENABLED")
|
||||
if self.props.is_editing_loads:
|
||||
row.prop(self.props, "structural_load_types", text="")
|
||||
row.operator("bim.add_structural_load", text="", icon="ADD").ifc_class = self.props.structural_load_types
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
class Data:
|
||||
is_loaded = False
|
||||
boundaries = {}
|
||||
spaces = {}
|
||||
|
||||
@classmethod
|
||||
def purge(cls):
|
||||
cls.is_loaded = False
|
||||
cls.boundaries = {}
|
||||
cls.spaces = {}
|
||||
|
||||
@classmethod
|
||||
def load(cls, file):
|
||||
cls._file = file
|
||||
for boundary in cls._file.by_type("IfcRelSpaceBoundary"):
|
||||
data = boundary.get_info()
|
||||
data["RelatingSpace"] = data["RelatingSpace"].id() if data["RelatingSpace"] else None
|
||||
data["RelatedBuildingElement"] = (
|
||||
data["RelatedBuildingElement"].id() if data["RelatedBuildingElement"] else None
|
||||
)
|
||||
del data["ConnectionGeometry"]
|
||||
if cls._file.schema == "IFC2X3":
|
||||
pass
|
||||
else:
|
||||
if boundary.is_a("IfcRelSpaceBoundary1stLevel"):
|
||||
data["ParentBoundary"] = data["ParentBoundary"].id() if data["ParentBoundary"] else None
|
||||
if boundary.is_a("IfcRelSpaceBoundary2ndLevel"):
|
||||
data["CorrespondingBoundary"] = (
|
||||
data["CorrespondingBoundary"].id() if data["CorrespondingBoundary"] else None
|
||||
)
|
||||
cls.boundaries[boundary.id()] = data
|
||||
cls.spaces.setdefault(data["RelatingSpace"], []).append(boundary.id())
|
||||
cls.is_loaded = True
|
||||
Reference in New Issue
Block a user