mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix issues adding roof and railing representation #5534
Apparently after recent changes with how types are added, it's now required to add a representation for them explicitly instead of just marking them as edited
This commit is contained in:
@@ -353,7 +353,7 @@ class AddRailing(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
refresh()
|
refresh()
|
||||||
update_railing_modifier_bmesh(context)
|
update_railing_modifier_bmesh(context)
|
||||||
update_railing_modifier_ifc_data(context)
|
update_railing_modifier_ifc_data(context)
|
||||||
return {"FINISHED"}
|
tool.Model.add_body_representation(obj)
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingRailing(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingRailing(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ class AddRoof(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
refresh()
|
refresh()
|
||||||
update_roof_modifier_bmesh(context)
|
update_roof_modifier_bmesh(context)
|
||||||
update_roof_modifier_ifc_data(context)
|
update_roof_modifier_ifc_data(context)
|
||||||
return {"FINISHED"}
|
tool.Model.add_body_representation(obj)
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingRoof(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingRoof(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -65,26 +65,6 @@ def regenerate_stair_mesh(context):
|
|||||||
obj.data.update()
|
obj.data.update()
|
||||||
|
|
||||||
|
|
||||||
def update_stair_representation(obj):
|
|
||||||
body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
|
||||||
representation = ifcopenshell.api.run(
|
|
||||||
"geometry.add_representation",
|
|
||||||
tool.Ifc.get(),
|
|
||||||
context=body,
|
|
||||||
blender_object=obj,
|
|
||||||
geometry=obj.data,
|
|
||||||
coordinate_offset=tool.Geometry.get_cartesian_point_offset(obj),
|
|
||||||
total_items=tool.Geometry.get_total_representation_items(obj),
|
|
||||||
should_force_faceted_brep=tool.Geometry.should_force_faceted_brep(),
|
|
||||||
should_force_triangulation=tool.Geometry.should_force_triangulation(),
|
|
||||||
should_generate_uvs=tool.Geometry.should_generate_uvs(obj),
|
|
||||||
ifc_representation_class=None,
|
|
||||||
profile_set_usage=None,
|
|
||||||
)
|
|
||||||
tool.Model.replace_object_ifc_representation(body, obj, representation)
|
|
||||||
tool.Ifc.finish_edit(obj)
|
|
||||||
|
|
||||||
|
|
||||||
def update_ifc_stair_props(obj):
|
def update_ifc_stair_props(obj):
|
||||||
"""should be called after new geometry settled
|
"""should be called after new geometry settled
|
||||||
since it's going to update ifc representation
|
since it's going to update ifc representation
|
||||||
@@ -220,7 +200,7 @@ class AddStair(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
)
|
)
|
||||||
regenerate_stair_mesh(context)
|
regenerate_stair_mesh(context)
|
||||||
update_ifc_stair_props(obj)
|
update_ifc_stair_props(obj)
|
||||||
update_stair_representation(obj)
|
tool.Model.add_body_representation(obj)
|
||||||
|
|
||||||
|
|
||||||
class CancelEditingStair(bpy.types.Operator, tool.Ifc.Operator):
|
class CancelEditingStair(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -255,7 +235,7 @@ class FinishEditingStair(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
data = props.get_props_kwargs(convert_to_project_units=True)
|
data = props.get_props_kwargs(convert_to_project_units=True)
|
||||||
props.is_editing = False
|
props.is_editing = False
|
||||||
regenerate_stair_mesh(context)
|
regenerate_stair_mesh(context)
|
||||||
update_stair_representation(obj)
|
tool.Model.add_body_representation(obj)
|
||||||
|
|
||||||
pset = tool.Pset.get_element_pset(element, "BBIM_Stair")
|
pset = tool.Pset.get_element_pset(element, "BBIM_Stair")
|
||||||
data = tool.Ifc.get().createIfcText(json.dumps(data))
|
data = tool.Ifc.get().createIfcText(json.dumps(data))
|
||||||
|
|||||||
@@ -1405,3 +1405,24 @@ class Model(bonsai.core.tool.Model):
|
|||||||
mesh.materials.pop(index=i1)
|
mesh.materials.pop(index=i1)
|
||||||
else:
|
else:
|
||||||
mesh.materials[i1] = mbstyle2
|
mesh.materials[i1] = mbstyle2
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_body_representation(cls, obj: bpy.types.Object) -> None:
|
||||||
|
ifc_file = tool.Ifc.get()
|
||||||
|
body = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
|
||||||
|
representation = ifcopenshell.api.run(
|
||||||
|
"geometry.add_representation",
|
||||||
|
ifc_file,
|
||||||
|
context=body,
|
||||||
|
blender_object=obj,
|
||||||
|
geometry=obj.data,
|
||||||
|
coordinate_offset=tool.Geometry.get_cartesian_point_offset(obj),
|
||||||
|
total_items=tool.Geometry.get_total_representation_items(obj),
|
||||||
|
should_force_faceted_brep=tool.Geometry.should_force_faceted_brep(),
|
||||||
|
should_force_triangulation=tool.Geometry.should_force_triangulation(),
|
||||||
|
should_generate_uvs=tool.Geometry.should_generate_uvs(obj),
|
||||||
|
ifc_representation_class=None,
|
||||||
|
profile_set_usage=None,
|
||||||
|
)
|
||||||
|
tool.Model.replace_object_ifc_representation(body, obj, representation)
|
||||||
|
tool.Ifc.finish_edit(obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user