mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Paramteric doors/windows - detect previously assigned materials when editing is enabled
Example - https://imgur.com/a/FEbSBaX
This commit is contained in:
@@ -640,6 +640,7 @@ class EnableEditingDoor(bpy.types.Operator, tool.Ifc.Operator):
|
||||
data = json.loads(ifcopenshell.util.element.get_pset(element, "BBIM_Door", "Data"))
|
||||
data.update(data.pop("lining_properties"))
|
||||
data.update(data.pop("panel_properties"))
|
||||
data.update(tool.Model.get_constituents_props_data(element))
|
||||
|
||||
# required since we could load pset from .ifc and BIMDoorProperties won't be set
|
||||
props.set_props_kwargs_from_ifc_data(data)
|
||||
|
||||
@@ -491,7 +491,13 @@ WindowType = Literal[
|
||||
|
||||
# default prop values are in mm and converted later
|
||||
class BIMWindowProperties(PropertyGroup):
|
||||
non_si_units_props = ("is_editing", "window_type")
|
||||
non_si_units_props = (
|
||||
"is_editing",
|
||||
"window_type",
|
||||
"lining_material",
|
||||
"framing_material",
|
||||
"glazing_material",
|
||||
)
|
||||
|
||||
# number of panels and default mullion/transom values
|
||||
# fmt: off
|
||||
@@ -690,7 +696,14 @@ DoorType = Literal[
|
||||
|
||||
|
||||
class BIMDoorProperties(PropertyGroup):
|
||||
non_si_units_props = ("is_editing", "door_type", "panel_width_ratio")
|
||||
non_si_units_props = (
|
||||
"is_editing",
|
||||
"door_type",
|
||||
"panel_width_ratio",
|
||||
"lining_material",
|
||||
"framing_material",
|
||||
"glazing_material",
|
||||
)
|
||||
is_editing: bpy.props.BoolProperty(default=False)
|
||||
door_type: bpy.props.EnumProperty(
|
||||
name="Door Operation Type",
|
||||
|
||||
@@ -550,6 +550,7 @@ class EnableEditingWindow(bpy.types.Operator, tool.Ifc.Operator):
|
||||
data = json.loads(ifcopenshell.util.element.get_pset(element, "BBIM_Window", "Data"))
|
||||
data.update(data.pop("lining_properties"))
|
||||
data.update(data.pop("panel_properties"))
|
||||
data.update(tool.Model.get_constituents_props_data(element))
|
||||
|
||||
# required since we could load pset from .ifc and BIMWindowProperties won't be set
|
||||
props.set_props_kwargs_from_ifc_data(data)
|
||||
|
||||
@@ -133,6 +133,19 @@ class Model(bonsai.core.tool.Model):
|
||||
data[prop_name] = prop_value * si_conversion
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def get_constituents_props_data(cls, element: ifcopenshell.entity_instance) -> dict[str, str]:
|
||||
constituents = ("lining", "framing", "glazing")
|
||||
props: dict[str, str] = {f"{constituent}_material": "0" for constituent in constituents}
|
||||
material = ifcopenshell.util.element.get_material(element)
|
||||
if not material or not material.is_a("IfcMaterialConstituentSet"):
|
||||
return props
|
||||
for constituent in material.MaterialConstituents:
|
||||
name = (constituent.Name or "").lower()
|
||||
if name in constituents:
|
||||
props[f"{name}_material"] = str(constituent.Material.id())
|
||||
return props
|
||||
|
||||
@classmethod
|
||||
def convert_mesh_to_curve(
|
||||
cls, position: Matrix, edge_indices: list[tuple[int, int]]
|
||||
|
||||
Reference in New Issue
Block a user