mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
partially addresses #3103.
This commit is contained in:
@@ -248,6 +248,7 @@ class EditPset(bpy.types.Operator, Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
|
objects = tool.Blender.get_selected_objects()
|
||||||
props = get_pset_props(context, self.obj, self.obj_type)
|
props = get_pset_props(context, self.obj, self.obj_type)
|
||||||
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, self.obj, self.obj_type)
|
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, self.obj, self.obj_type)
|
||||||
element = tool.Ifc.get().by_id(ifc_definition_id)
|
element = tool.Ifc.get().by_id(ifc_definition_id)
|
||||||
@@ -275,28 +276,40 @@ class EditPset(bpy.types.Operator, Operator):
|
|||||||
e[value_name] for e in prop.enumerated_value.enumerated_values if e.is_selected
|
e[value_name] for e in prop.enumerated_value.enumerated_values if e.is_selected
|
||||||
]
|
]
|
||||||
|
|
||||||
if pset.is_a() in ("IfcPropertySet", "IfcMaterialProperties", "IfcProfileProperties"):
|
|
||||||
ifcopenshell.api.run(
|
for obj in objects:
|
||||||
"pset.edit_pset",
|
element = blenderbim.tool.Ifc.get_entity(obj)
|
||||||
self.file,
|
pset_list = element.IsDefinedBy
|
||||||
pset=pset,
|
copy_of_properties = properties.copy()
|
||||||
name=props.active_pset_name,
|
|
||||||
properties=properties,
|
for rel in pset_list:
|
||||||
pset_template=blenderbim.bim.schema.ifc.psetqto.get_by_name(props.active_pset_name),
|
rel_name = rel.RelatingPropertyDefinition.Name
|
||||||
)
|
if rel.is_a("IfcRelDefinesByProperties") and rel_name == props.active_pset_name:
|
||||||
else:
|
rel_ID = rel.RelatingPropertyDefinition.id()
|
||||||
for key, value in properties.items():
|
rel_pset = rel.RelatingPropertyDefinition
|
||||||
if isinstance(value, float):
|
if rel_pset.is_a() in ("IfcPropertySet", "IfcMaterialProperties", "IfcProfileProperties"):
|
||||||
properties[key] = round(value, 4)
|
ifcopenshell.api.run(
|
||||||
ifcopenshell.api.run(
|
"pset.edit_pset",
|
||||||
"pset.edit_qto",
|
self.file,
|
||||||
self.file,
|
pset=rel_pset,
|
||||||
qto=pset,
|
name=props.active_pset_name,
|
||||||
name=props.active_pset_name,
|
properties=copy_of_properties,
|
||||||
properties=properties,
|
pset_template=blenderbim.bim.schema.ifc.psetqto.get_by_name(props.active_pset_name),
|
||||||
)
|
)
|
||||||
if tool.Cost.has_schedules():
|
else:
|
||||||
tool.Cost.update_cost_items(pset=pset)
|
for key, value in copy_of_properties.items():
|
||||||
|
if isinstance(value, float):
|
||||||
|
copy_of_properties[key] = round(value, 4)
|
||||||
|
ifcopenshell.api.run(
|
||||||
|
"pset.edit_qto",
|
||||||
|
self.file,
|
||||||
|
qto=rel_pset,
|
||||||
|
name=props.active_pset_name,
|
||||||
|
properties=copy_of_properties,
|
||||||
|
)
|
||||||
|
if tool.Cost.has_schedules():
|
||||||
|
tool.Cost.update_cost_items(pset=rel_pset)
|
||||||
|
|
||||||
bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type)
|
bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type)
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user