[BlenderBIM] update representation after ifcopenshell.api.run(...

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,
)

Comments

  • @smr02 have you tried to execute "regen" button after that?

  • 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.

    Massimo
  • 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], 
    )
    
Sign In or Register to comment.