Minor fixes after the refactor mess

This commit is contained in:
Dion Moult
2021-03-25 20:19:48 +11:00
parent 9751b6af05
commit 0bc86631a5
4 changed files with 8 additions and 5 deletions
+1
View File
@@ -142,6 +142,7 @@ endif
cd dist/working && unzip v0.6.0.zip
# IfcOpenBot sometimes lags behind, so we hotfix the Python utilities
cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/util/* dist/blenderbim/libs/site/packages/ifcopenshell/util/
cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/api dist/blenderbim/libs/site/packages/ifcopenshell/api
# Provides bcf functionality
cp -r dist/working/IfcOpenShell-0.6.0/src/bcf/bcf dist/blenderbim/libs/site/packages/
# Provides IFCClash functionality
@@ -1,5 +1,6 @@
import bpy
import json
import ifcopenshell
import ifcopenshell.api.structural.add_structural_boundary_condition as add_structural_boundary_condition
import ifcopenshell.api.structural.edit_structural_boundary_condition as edit_structural_boundary_condition
import ifcopenshell.api.structural.remove_structural_boundary_condition as remove_structural_boundary_condition
@@ -59,7 +60,7 @@ class EnableEditingStructuralBoundaryCondition(bpy.types.Operator):
new.is_null = value is None
new.is_optional = attribute.optional()
if data_type == "select":
enum_items = [s.name() for s in ifcopenshell.get_select_items(attribute)]
enum_items = [s.name() for s in ifcopenshell.util.attribute.get_select_items(attribute)]
new.enum_items = json.dumps(enum_items)
if isinstance(value, bool):
new.bool_value = False if new.is_null else data[attribute.name()]
@@ -71,6 +72,7 @@ class EnableEditingStructuralBoundaryCondition(bpy.types.Operator):
new.enum_value = [i for i in enum_items if i != "IfcBoolean"][0]
elif data_type == "string":
new.string_value = "" if new.is_null else data[attribute.name()]
new.data_type = "string"
props.is_editing_boundary_condition = True
return {"FINISHED"}
@@ -49,7 +49,7 @@ class BIM_PT_structural_boundary_conditions(Panel):
self.draw_read_only_ui(context)
def draw_editable_ui(self, context):
for attribute in self.props.connection_attributes:
for attribute in self.props.boundary_condition_attributes:
if attribute.data_type == "string":
row = self.layout.row()
row.prop(attribute, "string_value", text=attribute["name"])
@@ -3,7 +3,9 @@ def get_primitive_type(attribute_or_data_type):
data_type = str(attribute_or_data_type.type_of_attribute())
else:
data_type = str(attribute_or_data_type)
if "<list" in data_type:
if "<select" in data_type:
return "select"
elif "<list" in data_type:
return ("list", get_primitive_type(data_type.replace("<list", "")))
elif "<entity" in data_type:
return "entity"
@@ -17,8 +19,6 @@ def get_primitive_type(attribute_or_data_type):
return "boolean"
elif "<enumeration" in data_type:
return "enum"
elif "<select" in data_type:
return "select"
def get_enum_items(attribute):