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_quAce

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_DiasAce
  • @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
  • edited May 12

    Since we have the information in "Geometry and Materials", what do you think about adding a checkbox (Show Locals Gizmo) there to show the local gizmo and a bounding box with the same color as the axis?

    Thanks!

    John
  • @falken10vdl said:
    Since we have the information in "Geometry and Materials", what do you think about adding a checkbox (Show Locals Gizmo) there to show the local gizmo and a bounding box with the same color as the axis?

    Thanks!

    The bounding box is useful to identify an object that's a good idea 💡

    I thought I would go through and experience a tutorial by IFC Architect and look for areas new users might find difficult to do,

    With a view to deliver a 45 min introduction and onboard rooms full of supply chain and entirely new users to Bonsai and native IFC.

    One of the early comments around UIUX was
    "How do I know how long my walls are, and how do I adjust a wall to 12500mm if I make a mistake?"
    My natural thought would be
    1.Which wall is what dimension?
    2.click a dimension button or shortcut ,
    3.snap to two points to anotate
    4. Click to position the annotation distance from the wall if not automatic.
    or
    a.click the wall object
    b1.type the dimension
    b2.or move a grab with live feedback.

  • edited May 13

    @wayneh150

    please try:

    How do I know how long my walls are?

    how do I adjust a wall to 12500mm if I make a mistake?

    not to mention that when modeling it's good practice (for me) to use axis and numpad to set length

    last but not least, if you have gridlines in place you can use them to extend/trim, or use other walls for the same purpose
    cheers

  • edited May 13

    Minor changes. Better layout and exact same rgb for the bounding box edges as for the local gizmo axis

    As @steverugi mentioned you can use the dimensions in the N Panel.
    Other option in to look to the "XYZ Dimensions" in the "Derived Dimensions" from the "Geometry and Materials" TAB.
    Here the PR Derived dimensions: Show colored dimensions #6698
    Cheers!

    John
  • As per feedback:

    Cheers!

    duarteframosMassimosteverugiwalpaAntonio_DiasDarth_Blender
  • Adding nice formating for units already available in Bonsai


    thanks @theoryshaw !

    theoryshawzoomerwalpaMassimoNigelJohnDarth_BlenderFranSeoane
  • Improved layout (hopefully) and possibility to select multiple objects. Moved to explore tool as per discussion in https://github.com/IfcOpenShell/IfcOpenShell/pull/6698

    Cheers!

    wayneh150zoomer
  • Same style for the texts as the rest of measuring tools

    Massimo
  • @falken10vdl said:
    Same style for the texts as the rest of measuring tools

    This is great thank you! looking forward to playing with it.

  • edited May 17

    @wayneh150 if you want you can fetch it from the PR and test it yourself: https://github.com/IfcOpenShell/IfcOpenShell/pull/6698
    I attach you the documentation I submitted in PR https://github.com/IfcOpenShell/IfcOpenShell/pull/6494 on how to setup a dev environment in case you are not familiar with it.
    Cheers!

    Nigeltheoryshaw
Sign In or Register to comment.