IFC Wall Length

When you draw a wall object I see each section of the wall has a GlobalId.
I cant see in the object properties the length of the object?
I do like in Revit when drawing a wall there is some dimension feedback annotation, can we do that in Bonsai?

Tagged:
MassimozoomerOwura_qu

Comments

  • edited May 4

    @wayneh150

    1. you can run "Perform Quantity Take-off" to extract quantities from your elements

    1. or press 'N' to get the right panel, check "Item"

    1. or use "measure" tool from the left panel

    Antonio_Diaswayneh150Owura_qu
  • edited May 4

    Skynet wrote a script...

    import bpy
    import gpu
    from gpu_extras.batch import batch_for_shader
    from mathutils import Vector
    from bpy_extras.view3d_utils import location_3d_to_region_2d
    import blf
    
    draw_handler = None
    draw_enabled = False
    
    def draw_callback(self, context):
        print("[draw_callback] Called")
        obj = context.active_object
        if not obj or obj.type != 'MESH':
            print("[draw_callback] No active mesh object")
            return
    
        mesh = obj.data
        world = obj.matrix_world
        region = context.region
        rv3d = context.space_data.region_3d
    
        scene = context.scene
        unit_system = scene.unit_settings.system
        unit_scale = scene.unit_settings.scale_length
        use_separate = unit_system == 'IMPERIAL'
    
        font_id = 0
        blf.size(font_id, 12)
    
        for edge in mesh.edges:
            v1 = world @ mesh.vertices[edge.vertices[0]].co
            v2 = world @ mesh.vertices[edge.vertices[1]].co
            mid = (v1 + v2) / 2
            screen_pos = location_3d_to_region_2d(region, rv3d, mid)
    
            if screen_pos:
                length = (v2 - v1).length
                length_str = bpy.utils.units.to_string(
                    unit_system=unit_system,
                    unit_category='LENGTH',
                    value=length,
                    precision=2,
                    split_unit=use_separate
                )
    
                blf.position(font_id, screen_pos.x, screen_pos.y, 0)
                blf.draw(font_id, length_str)
                print(f"  Edge {edge.index} length: {length_str}")
            else:
                print(f"  Edge {edge.index} is off screen")
    
    class VIEW3D_OT_toggle_edge_lengths(bpy.types.Operator):
        bl_idname = "view3d.toggle_edge_lengths"
        bl_label = "Toggle Edge Lengths"
        bl_description = "Toggle drawing edge lengths in Object Mode"
    
        def execute(self, context):
            global draw_handler, draw_enabled
    
            if draw_enabled:
                bpy.types.SpaceView3D.draw_handler_remove(draw_handler, 'WINDOW')
                draw_handler = None
                draw_enabled = False
            else:
                draw_handler = bpy.types.SpaceView3D.draw_handler_add(
                    draw_callback, (self, context), 'WINDOW', 'POST_PIXEL'
                )
                draw_enabled = True
    
            context.area.tag_redraw()
            return {'FINISHED'}
    
    class VIEW3D_PT_edge_length_panel(bpy.types.Panel):
        bl_label = "Edge Length Overlay"
        bl_space_type = 'VIEW_3D'
        bl_region_type = 'UI'
        bl_category = "Edge Tools"
    
        def draw(self, context):
            layout = self.layout
            layout.operator("view3d.toggle_edge_lengths", icon='DRIVER_DISTANCE')
    
    def register():
        bpy.utils.register_class(VIEW3D_OT_toggle_edge_lengths)
        bpy.utils.register_class(VIEW3D_PT_edge_length_panel)
    
    def unregister():
        global draw_handler, draw_enabled
        if draw_enabled and draw_handler:
            bpy.types.SpaceView3D.draw_handler_remove(draw_handler, 'WINDOW')
            draw_handler = None
            draw_enabled = False
    
        bpy.utils.unregister_class(VIEW3D_OT_toggle_edge_lengths)
        bpy.utils.unregister_class(VIEW3D_PT_edge_length_panel)
    
    if __name__ == "__main__":
        register()
    
    
    steverugizoomerwalpaAntonio_Dias
  • @theoryshaw why not a PR 😉?.
    Really handy.

  • Dear Skynet, can you make a PR? ;)
    ...
    I think it would be a good tool to be integrated as well, but will leave it to other more qualified to make the integration. Want to try?

    Best, Ryan

  • Having that information on the model would be useful, if the user would like to adjust things,

    I like the look of this QTO stuff too no more calculating piles, caps and slabs :)

  • @theoryshaw Sure! :) Where would you think it would make sense to add it?
    Add the "Toggle Edge Lenghts" as an icon in the "Explore Tool"?
    Thanks!

  • So that dimension tool is good, could those values remain while the wall tool is selected, would that be easier?

    (I see also with that tool if you want to measure something using the same point that s not possible)

  • edited May 4

    @wayneh150

    So that dimension tool is good, could those values remain while the wall tool is selected, would that be easier?

    (I see also with that tool if you want to measure something using the same point that s not possible)

    In my previous post I forgot to mention @theoryshaw 's method using the Explore Tool > Shift+M to turn on the Measure Tool

    Not having figured out how to only show certain values it looks a bit too messy for me, but it's a matter of taste of course

  • edited May 9

    I have seen that the editing tools get refreshed with the data of the selected item in latest builds (it was not the case in some older ones)

    os: Linux
    os_version: #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025
    python_version: 3.11.11
    architecture: ('64bit', 'ELF')
    machine: x86_64
    blender_version: 4.4.3
    bonsai_commit_hash: 0f37eca
    bonsai_commit_date: 2025-05-09T15:24:30+10:00
    originating_system: Bonsai 0.8.2-alpha250314-6aba164
    

    Maybe it would make sense to have a read only field added to that part of the screen? so for the wall to add the depth (which comes from the material definition in this case) ?

  • @falken10vdl

    I have seen that the editing tools get refreshed with the data of the selected item in latest builds (it was not the case in some older ones)
    Maybe it would make sense to have a read only field added to that part of the screen? so for the wall to add the depth (which comes from the material definition in this case) ?

    wouldn't it be a kind of duplicate of what already available ?

  • @steverugi you are right! It is true that the N panel has the bounding box information. The same info is in different places.
    @wayneh150 What do you think? if you press N, you will have that information already there.

  • Actually I was looking to the sourcecode and there is BIM_PT_derived_coordinates(Panel). So in Geometry & Materials -> Placement -> Derived coordinates: XYZ Dimensions

  • edited May 9

    Yes that's good, so it would be good to have that information available when drawing and editing IFC walls.
    Much like AutoCAD when you draw a line maybe?
    Having some handy visual feedback somewhere I feel would be useful.

    zoomer
Sign In or Register to comment.