mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix errors due to accessing empty enum
This commit is contained in:
@@ -72,7 +72,8 @@ def refreshPredefinedTypes(self, context):
|
||||
global types_enum
|
||||
types_enum.clear()
|
||||
enum = getIfcPredefinedTypes(self, context)
|
||||
context.scene.BIMRootProperties.ifc_predefined_type = enum[0][0]
|
||||
if enum:
|
||||
context.scene.BIMRootProperties.ifc_predefined_type = enum[0][0]
|
||||
|
||||
|
||||
def getIfcProducts(self, context):
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import blenderbim.bim.module.root.prop as root_prop
|
||||
from bpy.types import Panel
|
||||
from ifcopenshell.api.root.data import Data
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
@@ -49,7 +50,9 @@ class BIM_PT_class(Panel):
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.reassign_class", icon="CHECKMARK")
|
||||
row.operator("bim.disable_reassign_class", icon="CANCEL", text="")
|
||||
self.draw_class_dropdowns(context)
|
||||
self.draw_class_dropdowns(
|
||||
context,
|
||||
root_prop.getIfcPredefinedTypes(context.scene.BIMRootProperties, context))
|
||||
else:
|
||||
data = Data.products[props.ifc_definition_id]
|
||||
name = data["type"]
|
||||
@@ -72,23 +75,24 @@ class BIM_PT_class(Panel):
|
||||
else:
|
||||
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
|
||||
else:
|
||||
self.draw_class_dropdowns(context)
|
||||
ifc_predefined_types = root_prop.getIfcPredefinedTypes(context.scene.BIMRootProperties, context)
|
||||
self.draw_class_dropdowns(context, ifc_predefined_types)
|
||||
row = self.layout.row(align=True)
|
||||
op = row.operator("bim.assign_class")
|
||||
op.ifc_class = context.scene.BIMRootProperties.ifc_class
|
||||
op.predefined_type = context.scene.BIMRootProperties.ifc_predefined_type
|
||||
op.predefined_type = context.scene.BIMRootProperties.ifc_predefined_type if ifc_predefined_types else ""
|
||||
op.userdefined_type = context.scene.BIMRootProperties.ifc_userdefined_type
|
||||
|
||||
def draw_class_dropdowns(self, context):
|
||||
def draw_class_dropdowns(self, context, ifc_predefined_types):
|
||||
props = context.scene.BIMRootProperties
|
||||
row = self.layout.row()
|
||||
row.prop(props, "ifc_product")
|
||||
row = self.layout.row()
|
||||
row.prop(props, "ifc_class")
|
||||
if props.ifc_predefined_type:
|
||||
if ifc_predefined_types:
|
||||
row = self.layout.row()
|
||||
row.prop(props, "ifc_predefined_type")
|
||||
if props.ifc_predefined_type == "USERDEFINED":
|
||||
if ifc_predefined_types == "USERDEFINED":
|
||||
row = self.layout.row()
|
||||
row.prop(props, "ifc_userdefined_type")
|
||||
row = self.layout.row()
|
||||
|
||||
Reference in New Issue
Block a user