From 4dc55e844ce38622af23cd772de78dc8cdbd00a2 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 4 Aug 2023 14:46:00 +0500 Subject: [PATCH] Fix default mep profile names Previously it was generating names like 4000000x4000000 in mm projects. --- .../blenderbim/bim/module/type/operator.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/type/operator.py b/src/blenderbim/blenderbim/bim/module/type/operator.py index 151eaf0dd0..ea07090640 100644 --- a/src/blenderbim/blenderbim/bim/module/type/operator.py +++ b/src/blenderbim/blenderbim/bim/module/type/operator.py @@ -312,32 +312,36 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator): ) else: # NOTE: defaults dims are in meters / mm + # for now default names are hardcoded to mm if template == "FLOW_SEGMENT_RECTANGULAR": - default_x_dim = 0.4 / unit_scale - default_y_dim = 0.2 / unit_scale - profile_name = f"{ifc_class}-{default_x_dim*1000}x{default_x_dim*1000}" + default_x_dim = 0.4 + default_y_dim = 0.2 + profile_name = f"{ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}" profile = ifc_file.create_entity( "IfcRectangleProfileDef", ProfileName=profile_name, ProfileType="AREA", - XDim=default_x_dim, - YDim=default_y_dim, + XDim=default_x_dim / unit_scale, + YDim=default_y_dim / unit_scale, ) elif template == "FLOW_SEGMENT_CIRCULAR": - default_diameter = 0.1 / unit_scale + default_diameter = 0.1 profile_name = f"{ifc_class}-{default_diameter*1000}" profile = ifc_file.create_entity( - "IfcCircleProfileDef", ProfileName=profile_name, ProfileType="AREA", Radius=default_diameter / 2 + "IfcCircleProfileDef", + ProfileName=profile_name, + ProfileType="AREA", + Radius=(default_diameter / 2) / unit_scale, ) elif template == "FLOW_SEGMENT_CIRCULAR_HOLLOW": - default_diameter = 0.15 / unit_scale - default_thickness = 0.005 / unit_scale + default_diameter = 0.15 + default_thickness = 0.005 profile_name = f"{ifc_class}-{default_diameter*1000}x{default_thickness*1000}" profile = ifc_file.create_entity( "IfcCircleHollowProfileDef", ProfileName=profile_name, ProfileType="AREA", - Radius=default_diameter / 2, + Radius=(default_diameter / 2) / unit_scale, WallThickness=default_thickness, )