mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 20:42:27 +00:00
@@ -230,6 +230,10 @@ class ObjectMaterialData:
|
|||||||
if cls.material.is_a("IfcMaterialProfileSetUsage"):
|
if cls.material.is_a("IfcMaterialProfileSetUsage"):
|
||||||
if cls.material.CardinalPoint:
|
if cls.material.CardinalPoint:
|
||||||
results["cardinal_point"] = cardinal_point_map[cls.material.CardinalPoint]
|
results["cardinal_point"] = cardinal_point_map[cls.material.CardinalPoint]
|
||||||
|
if cls.material.is_a("IfcMaterialLayerSetUsage"):
|
||||||
|
if cls.material.LayerSetDirection:
|
||||||
|
results["layer_set_direction"] = cls.material.LayerSetDirection
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -259,7 +263,16 @@ class ObjectMaterialData:
|
|||||||
icon = "POINTCLOUD_DATA"
|
icon = "POINTCLOUD_DATA"
|
||||||
|
|
||||||
for item in items or []:
|
for item in items or []:
|
||||||
data = {"id": item.id(), "name": getattr(item, "Name", None) or "Unnamed", "icon": icon}
|
if item.is_a("IfcMaterial"):
|
||||||
|
material_id = item.id()
|
||||||
|
else:
|
||||||
|
material_id = item.Material.id()
|
||||||
|
data = {
|
||||||
|
"id": item.id(),
|
||||||
|
"name": getattr(item, "Name", None) or "Unnamed",
|
||||||
|
"icon": icon,
|
||||||
|
"material_id": material_id
|
||||||
|
}
|
||||||
if item.is_a("IfcMaterialProfile") and not item.Name:
|
if item.is_a("IfcMaterialProfile") and not item.Name:
|
||||||
if item.Profile:
|
if item.Profile:
|
||||||
data["name"] = item.Profile.ProfileName or "Unnamed"
|
data["name"] = item.Profile.ProfileName or "Unnamed"
|
||||||
|
|||||||
@@ -253,9 +253,9 @@ class BIM_PT_object_material(Panel):
|
|||||||
len(self.props.material_set_item_profile_attributes)
|
len(self.props.material_set_item_profile_attributes)
|
||||||
and self.props.active_material_set_item_id == set_item["id"]
|
and self.props.active_material_set_item_id == set_item["id"]
|
||||||
):
|
):
|
||||||
self.draw_editable_set_item_profile_ui(set_item)
|
self.draw_editable_set_item_profile_ui(box, set_item)
|
||||||
elif self.props.active_material_set_item_id == set_item["id"]:
|
elif self.props.active_material_set_item_id == set_item["id"]:
|
||||||
self.draw_editable_set_item_ui(set_item)
|
self.draw_editable_set_item_ui(box, set_item)
|
||||||
else:
|
else:
|
||||||
self.draw_read_only_set_item_ui(
|
self.draw_read_only_set_item_ui(
|
||||||
box, set_item, index, is_first=index == 0, is_last=index == total_items - 1
|
box, set_item, index, is_first=index == 0, is_last=index == total_items - 1
|
||||||
@@ -263,16 +263,15 @@ class BIM_PT_object_material(Panel):
|
|||||||
|
|
||||||
self.layerset_bounds(box, active_object, location="Bottom_Interior")
|
self.layerset_bounds(box, active_object, location="Bottom_Interior")
|
||||||
|
|
||||||
def draw_editable_set_item_profile_ui(self, set_item):
|
def draw_editable_set_item_profile_ui(self, box, set_item):
|
||||||
box = self.layout.box()
|
# box = self.layout.box()
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
op = row.operator("bim.edit_material_set_item_profile", icon="CHECKMARK", text="Save Changes")
|
op = row.operator("bim.edit_material_set_item_profile", icon="CHECKMARK", text="Save Changes")
|
||||||
op.material_set_item = set_item["id"]
|
op.material_set_item = set_item["id"]
|
||||||
row.operator("bim.disable_editing_material_set_item_profile", icon="CANCEL", text="")
|
row.operator("bim.disable_editing_material_set_item_profile", icon="CANCEL", text="")
|
||||||
draw_attributes(self.props.material_set_item_profile_attributes, box)
|
draw_attributes(self.props.material_set_item_profile_attributes, box)
|
||||||
|
|
||||||
def draw_editable_set_item_ui(self, set_item):
|
def draw_editable_set_item_ui(self, box, set_item):
|
||||||
box = self.layout.box()
|
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
op = row.operator("bim.edit_material_set_item", icon="CHECKMARK", text="Save Changes")
|
op = row.operator("bim.edit_material_set_item", icon="CHECKMARK", text="Save Changes")
|
||||||
op.material_set_item = set_item["id"]
|
op.material_set_item = set_item["id"]
|
||||||
@@ -365,7 +364,7 @@ class BIM_PT_object_material(Panel):
|
|||||||
|
|
||||||
for set_item in ObjectMaterialData.data["set_items"]:
|
for set_item in ObjectMaterialData.data["set_items"]:
|
||||||
material_name = set_item["material"]
|
material_name = set_item["material"]
|
||||||
material_id = self.get_material_id_from_name(material_name)
|
material_id = set_item['material_id']
|
||||||
if ObjectMaterialData.data["material_class"] == "IfcMaterialList":
|
if ObjectMaterialData.data["material_class"] == "IfcMaterialList":
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.label(text="IfcMaterial", icon="LAYER_ACTIVE")
|
row.label(text="IfcMaterial", icon="LAYER_ACTIVE")
|
||||||
@@ -379,17 +378,10 @@ class BIM_PT_object_material(Panel):
|
|||||||
|
|
||||||
self.layerset_bounds(box, active_object, location="Bottom_Interior")
|
self.layerset_bounds(box, active_object, location="Bottom_Interior")
|
||||||
|
|
||||||
def get_material_id_from_name(self, material_name):
|
|
||||||
for index, set_item in enumerate(ObjectMaterialData.data["materials"]):
|
|
||||||
if material_name == ObjectMaterialData.data["materials"][index][1]:
|
|
||||||
material_id = int(ObjectMaterialData.data["materials"][index][0])
|
|
||||||
return material_id
|
|
||||||
|
|
||||||
def layerset_bounds(self, box, obj, location="Top_Exterior"):
|
def layerset_bounds(self, box, obj, location="Top_Exterior"):
|
||||||
element = tool.Ifc.get_entity(obj)
|
set_usage = ObjectMaterialData.data.get('set_usage', {})
|
||||||
has_layersetdirection = hasattr(element.HasAssociations[0].RelatingMaterial, "LayerSetDirection")
|
layer_set_direction = set_usage.get('layer_set_direction')
|
||||||
if has_layersetdirection:
|
if layer_set_direction:
|
||||||
layer_set_direction = element.HasAssociations[0].RelatingMaterial.LayerSetDirection
|
|
||||||
if location == "Top_Exterior":
|
if location == "Top_Exterior":
|
||||||
if layer_set_direction == "AXIS3":
|
if layer_set_direction == "AXIS3":
|
||||||
box.label(text="----- Top -----")
|
box.label(text="----- Top -----")
|
||||||
|
|||||||
Reference in New Issue
Block a user