mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +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()
|
||||
|
||||
@@ -29,15 +29,15 @@ from mathutils import Vector
|
||||
# - order of rows is from top of the window to bottom
|
||||
|
||||
DEFAULT_PANEL_SCHEMAS = {
|
||||
"SINGLE_PANEL": [[0]],
|
||||
"DOUBLE_PANEL_HORIZONTAL": [[0], [1]],
|
||||
"DOUBLE_PANEL_VERTICAL": [[0, 1]],
|
||||
"TRIPLE_PANEL_BOTTOM": [[0, 1], [2, 2]],
|
||||
"TRIPLE_PANEL_TOP": [[0, 0], [1, 2]],
|
||||
"TRIPLE_PANEL_LEFT": [[0, 1], [0, 2]],
|
||||
"TRIPLE_PANEL_RIGHT": [[0, 1], [2, 1]],
|
||||
"TRIPLE_PANEL_HORIZONTAL": [[0], [1], [2]],
|
||||
"TRIPLE_PANEL_VERTICAL": [[0, 1, 2]],
|
||||
"SINGLE_PANEL": [[0]],
|
||||
"DOUBLE_PANEL_HORIZONTAL": [[0], [1]],
|
||||
"DOUBLE_PANEL_VERTICAL": [[0, 1]],
|
||||
"TRIPLE_PANEL_BOTTOM": [[0, 1], [2, 2]],
|
||||
"TRIPLE_PANEL_TOP": [[0, 0], [1, 2]],
|
||||
"TRIPLE_PANEL_LEFT": [[0, 1], [0, 2]],
|
||||
"TRIPLE_PANEL_RIGHT": [[0, 1], [2, 1]],
|
||||
"TRIPLE_PANEL_HORIZONTAL": [[0], [1], [2]],
|
||||
"TRIPLE_PANEL_VERTICAL": [[0, 1, 2]],
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ class Usecase:
|
||||
def execute(self):
|
||||
self.settings["unit_scale"] = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
||||
builder = ShapeBuilder(self.file)
|
||||
overall_height = self.convert_si_to_unit(self.settings["overall_height"])
|
||||
overall_width = self.convert_si_to_unit(self.settings["overall_width"])
|
||||
overall_height = self.settings["overall_height"]
|
||||
overall_width = self.settings["overall_width"]
|
||||
|
||||
if self.settings["context"].TargetView == "ELEVATION_VIEW":
|
||||
rect = builder.rectangle(V(overall_width, 0, overall_height))
|
||||
@@ -110,19 +110,19 @@ class Usecase:
|
||||
built_panels = []
|
||||
window_items = []
|
||||
|
||||
lining_thickness = self.convert_si_to_unit(self.settings["lining_properties"]["LiningThickness"])
|
||||
lining_depth = self.convert_si_to_unit(self.settings["lining_properties"]["LiningDepth"])
|
||||
lining_offset = self.convert_si_to_unit(self.settings["lining_properties"]["LiningOffset"])
|
||||
lining_panel_offset_x = self.convert_si_to_unit(self.settings["lining_properties"]["LiningToPanelOffsetX"])
|
||||
lining_panel_offset_y = self.convert_si_to_unit(self.settings["lining_properties"]["LiningToPanelOffsetY"])
|
||||
lining_thickness = self.settings["lining_properties"]["LiningThickness"]
|
||||
lining_depth = self.settings["lining_properties"]["LiningDepth"]
|
||||
lining_offset = self.settings["lining_properties"]["LiningOffset"]
|
||||
lining_panel_offset_x = self.settings["lining_properties"]["LiningToPanelOffsetX"]
|
||||
lining_panel_offset_y = self.settings["lining_properties"]["LiningToPanelOffsetY"]
|
||||
glass_thickness = self.convert_si_to_unit(10)
|
||||
|
||||
mullion_thickness = self.convert_si_to_unit(self.settings["lining_properties"]["MullionThickness"]) / 2
|
||||
first_mullion_offset = self.convert_si_to_unit(self.settings["lining_properties"]["FirstMullionOffset"])
|
||||
second_mullion_offset = self.convert_si_to_unit(self.settings["lining_properties"]["SecondMullionOffset"])
|
||||
transom_thickness = self.convert_si_to_unit(self.settings["lining_properties"]["TransomThickness"]) / 2
|
||||
first_transom_offset = self.convert_si_to_unit(self.settings["lining_properties"]["FirstTransomOffset"])
|
||||
second_transom_offset = self.convert_si_to_unit(self.settings["lining_properties"]["SecondTransomOffset"])
|
||||
mullion_thickness = self.settings["lining_properties"]["MullionThickness"] / 2
|
||||
first_mullion_offset = self.settings["lining_properties"]["FirstMullionOffset"]
|
||||
second_mullion_offset = self.settings["lining_properties"]["SecondMullionOffset"]
|
||||
transom_thickness = self.settings["lining_properties"]["TransomThickness"] / 2
|
||||
first_transom_offset = self.settings["lining_properties"]["FirstTransomOffset"]
|
||||
second_transom_offset = self.settings["lining_properties"]["SecondTransomOffset"]
|
||||
|
||||
panel_schema = list(reversed(panel_schema))
|
||||
|
||||
@@ -162,9 +162,9 @@ class Usecase:
|
||||
continue
|
||||
|
||||
cur_panel = panels[panel_i]
|
||||
panel_depth = cur_panel["FrameDepth"]
|
||||
panel_thickness = cur_panel["FrameThickness"]
|
||||
current_items = []
|
||||
panel_depth = self.convert_si_to_unit(cur_panel["FrameDepth"])
|
||||
panel_thickness = self.convert_si_to_unit(cur_panel["FrameThickness"])
|
||||
|
||||
panel_actual_width = panel_width - lining_panel_offset_x * 2
|
||||
panel_actual_height = panel_height - lining_panel_offset_x * 2
|
||||
|
||||
Reference in New Issue
Block a user