mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 00:23:14 +00:00
@@ -17,6 +17,8 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import blenderbim.tool as tool
|
||||
from blenderbim.bim.prop import ObjProperty
|
||||
from blenderbim.bim.module.model.data import AuthoringData
|
||||
from blenderbim.bim.module.model.root import ConstrTypeEntityNotFound
|
||||
@@ -302,10 +304,15 @@ class BIMSverchokProperties(PropertyGroup):
|
||||
|
||||
def window_type_prop_update(self, context):
|
||||
number_of_panels, panels_data = self.window_types_panels[self.window_type]
|
||||
|
||||
si_coversion = 0.001 / ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
panels_data = [[v * si_coversion for v in data] for data in panels_data]
|
||||
|
||||
self.first_mullion_offset, self.second_mullion_offset = panels_data[0]
|
||||
self.first_transom_offset, self.second_transom_offset = panels_data[1]
|
||||
|
||||
|
||||
# default prop values are in mm and converted later
|
||||
class BIMWindowProperties(PropertyGroup):
|
||||
window_types = (
|
||||
("SINGLE_PANEL", "SINGLE_PANEL", ""),
|
||||
|
||||
@@ -191,9 +191,7 @@ def create_bm_window_closed_profile(bm, size: Vector, thickness: Vector, positio
|
||||
def update_window_modifier_bmesh(context):
|
||||
obj = context.object
|
||||
props = obj.BIMWindowProperties
|
||||
# blender interprets all values as if they are in meters
|
||||
# so no need to convert to blender scene units, just convert to meters
|
||||
si_conversion = 0.001
|
||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
panel_schema = DEFAULT_PANEL_SCHEMAS[props.window_type]
|
||||
accumulated_height = [0] * len(panel_schema[0])
|
||||
built_panels = []
|
||||
@@ -211,7 +209,7 @@ def update_window_modifier_bmesh(context):
|
||||
first_transom_offset = props.first_transom_offset * si_conversion
|
||||
second_transom_offset = props.second_transom_offset * si_conversion
|
||||
|
||||
glass_thickness = 10 * si_conversion
|
||||
glass_thickness = 10 * 0.001 * si_conversion
|
||||
|
||||
bm = bmesh.new()
|
||||
panel_schema = list(reversed(panel_schema))
|
||||
@@ -335,6 +333,17 @@ class AddWindow(bpy.types.Operator, tool.Ifc.Operator):
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMWindowProperties
|
||||
|
||||
si_coversion = 0.001 / ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
for prop_name in props.bl_rna.properties.keys():
|
||||
if prop_name in ("rna_type", "name", "is_editing", "window_type"):
|
||||
continue
|
||||
prop_value = getattr(props, prop_name)
|
||||
if type(prop_value) is float:
|
||||
prop_value = prop_value * si_coversion
|
||||
elif type(prop_value) is bpy.types.bpy_prop_array:
|
||||
prop_value = [el * si_coversion for el in prop_value]
|
||||
setattr(props, prop_name, prop_value)
|
||||
|
||||
window_data = props.get_general_kwargs()
|
||||
lining_props = props.get_lining_kwargs()
|
||||
panel_props = props.get_panel_kwargs()
|
||||
|
||||
Reference in New Issue
Block a user