mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-15 18:14:08 +00:00
Fixed stair calculated params not updating during edit (after 8b23c615c)
.data doesn't update on props change, so need to take data from props explicitly when BIMStairProperties.is_editing
This commit is contained in:
@@ -333,25 +333,7 @@ class StairData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def calculated_params(cls):
|
def calculated_params(cls):
|
||||||
props = bpy.context.active_object.BIMStairProperties
|
return tool.Model.get_active_stair_calculated_params(cls.data["pset_data"]["data_dict"])
|
||||||
|
|
||||||
if props.is_editing:
|
|
||||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
|
||||||
number_of_treads = props.number_of_treads
|
|
||||||
height = props.height / si_conversion
|
|
||||||
tread_run = props.tread_run / si_conversion
|
|
||||||
else:
|
|
||||||
data = cls.data["pset_data"]["data_dict"]
|
|
||||||
number_of_treads = data["number_of_treads"]
|
|
||||||
height = data["height"]
|
|
||||||
tread_run = data["tread_run"]
|
|
||||||
|
|
||||||
calculated_params = {}
|
|
||||||
number_of_rises = number_of_treads + 1
|
|
||||||
calculated_params["Number of risers"] = number_of_rises
|
|
||||||
calculated_params["Tread rise"] = round(height / number_of_rises, 5)
|
|
||||||
calculated_params["Length"] = round(tread_run * number_of_rises, 5)
|
|
||||||
return calculated_params
|
|
||||||
|
|
||||||
|
|
||||||
class SverchokData:
|
class SverchokData:
|
||||||
|
|||||||
@@ -259,8 +259,8 @@ class BIM_PT_stair(bpy.types.Panel):
|
|||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Stair parameters", icon="IPO_CONSTANT")
|
row.label(text="Stair parameters", icon="IPO_CONSTANT")
|
||||||
|
|
||||||
stair_data = StairData.data["pset_data"]["data_dict"]
|
|
||||||
if props.is_editing:
|
if props.is_editing:
|
||||||
|
calculated_params = tool.Model.get_active_stair_calculated_params()
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.operator("bim.finish_editing_stair", icon="CHECKMARK", text="Finish Editing")
|
row.operator("bim.finish_editing_stair", icon="CHECKMARK", text="Finish Editing")
|
||||||
row.operator("bim.cancel_editing_stair", icon="CANCEL", text="")
|
row.operator("bim.cancel_editing_stair", icon="CANCEL", text="")
|
||||||
@@ -269,6 +269,7 @@ class BIM_PT_stair(bpy.types.Panel):
|
|||||||
self.layout.prop(props, prop_name)
|
self.layout.prop(props, prop_name)
|
||||||
regenerate_stair_mesh(context)
|
regenerate_stair_mesh(context)
|
||||||
else:
|
else:
|
||||||
|
calculated_params = StairData.data["calculated_params"]
|
||||||
row.operator("bim.enable_editing_stair", icon="GREASEPENCIL", text="")
|
row.operator("bim.enable_editing_stair", icon="GREASEPENCIL", text="")
|
||||||
row.operator("bim.remove_stair", icon="X", text="")
|
row.operator("bim.remove_stair", icon="X", text="")
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
@@ -278,7 +279,7 @@ class BIM_PT_stair(bpy.types.Panel):
|
|||||||
row.label(text=str(prop_value))
|
row.label(text=str(prop_value))
|
||||||
|
|
||||||
# calculated properties
|
# calculated properties
|
||||||
for prop_name, prop_value in StairData.data["calculated_params"].items():
|
for prop_name, prop_value in calculated_params.items():
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text=prop_name)
|
row.label(text=prop_name)
|
||||||
row.label(text=str(prop_value))
|
row.label(text=str(prop_value))
|
||||||
|
|||||||
@@ -908,6 +908,27 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
def is_parametric_door_active(cls):
|
def is_parametric_door_active(cls):
|
||||||
return (DoorData.is_loaded or not DoorData.load()) and DoorData.data["pset_data"]
|
return (DoorData.is_loaded or not DoorData.load()) and DoorData.data["pset_data"]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_active_stair_calculated_params(cls, pset_data=None):
|
||||||
|
props = bpy.context.active_object.BIMStairProperties
|
||||||
|
|
||||||
|
if props.is_editing:
|
||||||
|
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
|
number_of_treads = props.number_of_treads
|
||||||
|
height = props.height / si_conversion
|
||||||
|
tread_run = props.tread_run / si_conversion
|
||||||
|
else:
|
||||||
|
number_of_treads = pset_data["number_of_treads"]
|
||||||
|
height = pset_data["height"]
|
||||||
|
tread_run = pset_data["tread_run"]
|
||||||
|
|
||||||
|
calculated_params = {}
|
||||||
|
number_of_rises = number_of_treads + 1
|
||||||
|
calculated_params["Number of risers"] = number_of_rises
|
||||||
|
calculated_params["Tread rise"] = round(height / number_of_rises, 5)
|
||||||
|
calculated_params["Length"] = round(tread_run * number_of_rises, 5)
|
||||||
|
return calculated_params
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_stair_2d_profile(
|
def generate_stair_2d_profile(
|
||||||
cls,
|
cls,
|
||||||
|
|||||||
Reference in New Issue
Block a user