S
by smr02 on 23 Aug 2023, edited 24 Aug 2023
#
When I'm running the following code in BlenderBIM, the boolean gets added, but the representation is not updated. What am I missing?
ifcopenshell.api.run(
"geometry.add_boolean",
tool.Ifc.get(),
representation = e.Representation.Representations[0],
type = 'Mesh',
blender_obj = obj,
blender_void = void,
)

M
by Massimo on 24 Aug 2023
#
@smr02 have you tried to execute "regen" button after that?
A
by Andrej730 on 24 Aug 2023
#
+1 votes
Yeah, you need to update the representation. For that you can either Regen in one of the BIM tools or call bpy.ops.bim.recalculate_wall()
directly.

As a more general way that would work for all types of geometry you can either use Switch Representation to kind of reload the mesh from IFC (example how to call it from the code) or just use "Apply Boolean" (bpy.ops.bim.add_boolean()
) that does exactly this but need to make sure your obj
and void
are in context.selected_objects
.

S
by smr02 on 24 Aug 2023
#
Thank you, @Andrej730.
I've included the following in my code:
blenderbim.core.geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj = obj,
representation = e.Representation.Representations[0],
)