mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 08:33:10 +00:00
Prevent error when user deletes all spatial structure elements and the spatial manager panel is expanded
This commit is contained in:
@@ -44,6 +44,8 @@ def update_elevation(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def update_active_container_index(self, context):
|
def update_active_container_index(self, context):
|
||||||
|
if self.active_container_index < 0:
|
||||||
|
return
|
||||||
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
|
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
|
||||||
self.container_name = self.containers[self.active_container_index].name
|
self.container_name = self.containers[self.active_container_index].name
|
||||||
self.elevation = self.containers[self.active_container_index].elevation
|
self.elevation = self.containers[self.active_container_index].elevation
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class BIM_PT_SpatialManager(Panel):
|
|||||||
self.props = context.scene.BIMSpatialManagerProperties
|
self.props = context.scene.BIMSpatialManagerProperties
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.operator("bim.load_container_manager", icon="FILE_REFRESH", text="Load Spatial Structure")
|
row.operator("bim.load_container_manager", icon="FILE_REFRESH", text="Load Spatial Structure")
|
||||||
if self.props.active_container_index < len(self.props.containers):
|
if 0 <= self.props.active_container_index < len(self.props.containers):
|
||||||
ifc_definition_id = self.props.containers[self.props.active_container_index].ifc_definition_id
|
ifc_definition_id = self.props.containers[self.props.active_container_index].ifc_definition_id
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.alignment = "RIGHT"
|
row.alignment = "RIGHT"
|
||||||
@@ -134,7 +134,7 @@ class BIM_PT_SpatialManager(Panel):
|
|||||||
"active_container_index",
|
"active_container_index",
|
||||||
)
|
)
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
if self.props.active_container_index < len(self.props.containers):
|
if 0 <= self.props.active_container_index < len(self.props.containers):
|
||||||
row.prop(self.props, "container_name", text="")
|
row.prop(self.props, "container_name", text="")
|
||||||
row.prop(self.props, "elevation", text="")
|
row.prop(self.props, "elevation", text="")
|
||||||
op = row.operator("bim.edit_container_attributes", icon="CHECKMARK", text="Apply")
|
op = row.operator("bim.edit_container_attributes", icon="CHECKMARK", text="Apply")
|
||||||
|
|||||||
Reference in New Issue
Block a user