Measuring tool

@bruno_perdigao awesome measuring tool!
https://github.com/IfcOpenShell/IfcOpenShell/pull/5197#issue-2474248435
Is it okay to provide feedback on this yet, or are you still working on it?

steverugiMassimoAceduarteframos

Comments

  • Actually, both :)
    I'm still working on it, but any feedback is welcome. I think this will be a work-in-progress for some time and things might change along the way.

    theoryshawJohnlelopes
  • edited August 2024

    Love how using x,y,z locks to axises!
    ...
    Maybe this is the roadmap already, but would be nice to display the entire length of the polyline(s) that are drawn.
    ...
    You might be working on this already, but it seems to not want to snap to one side of the wall...
    https://community.osarch.org/uploads/editor/dk/qxuoqgq1pnzx.mp4

  • I can see using the measure tool a lot!
    Is there a way to add it to the 'quick favorites'? Normally i right click on a button to 'Add to Quick Favorites`, but the measure tool doesn't have a button, per say.

  • Maybe this is the roadmap already, but would be nice to display the entire length of the polyline(s) that are drawn.

    Good idea!

    You might be working on this already, but it seems to not want to snap to one side of the wall...

    I'll try to fix that later, but for now if you press "M" you'll see that it detects the other snapping point, but it needs some polishing.

    Is there a way to add it to the 'quick favorites'? Normally i right click on a button to 'Add to Quick Favorites`, but the measure tool doesn't have a button, per say.

    I'll have to check that. It would be very useful indeed. Maybe we should just add a button somewhere.

    John
  • A few things that are on roadmap:

    • The measure tool should leave the dimensions on the screen while using other tools. The user should have an option to erase them when needed.
    • There will be another option to measure using only one line. This line will show the direct measurement but also the x, y and z distance for the two points.
    • There will be an option for the user to copy the measurement value to the clipboard so it can be used to create or edit elements.
    • There will be a measure tool just for area calculation.
    theoryshawwmiAcecarlopavsteverugiJohnNigelCGRBedsonOwura_qu
  • edited September 2024

    Love how the measure tool's coming together!
    Is there any plans to support something like 'Shift + Z' (or X, Y) to lock in the Z( or X,Y) plane?
    or maybe this is possible already.

    Bedson
  • @theoryshaw said:
    ping @bernd. :)

    have been in vacation, but for sure this is something very useful for me :-)

    bruno_perdigao
  • Is there a way to get the snap to work, when you're in camera mode (inside a drawing)?
    From the following, i have a sense this is a gnarly problem to solve: https://github.com/s-leger/blender_cad_transforms/issues/25

  • @theoryshaw said:
    I can see using the measure tool a lot!
    Is there a way to add it to the 'quick favorites'? Normally i right click on a button to 'Add to Quick Favorites`, but the measure tool doesn't have a button, per say.

    Along comes AI...
    ...
    To add a custom operator like your MeasureTool (bim.measure_tool) to Blender's Quick Favorites when it doesn’t have a visible button by default, you can use a similar approach to creating a temporary UI element to make it available for Quick Favorites. Here's how you can do it:

    Steps to Add MeasureTool to Quick Favorites:

    1. Create a Custom UI Panel: You’ll need to create a panel in the UI where you can invoke the MeasureTool operator, and then you can add that to Quick Favorites.

    2. Write a Script for the Custom Panel: Here’s how you can create a basic UI panel with a button that runs your custom MeasureTool operator.

      • Open Blender and go to the Scripting workspace.

      • In the Text Editor, create a new text file and paste the following code:

            import bpy
    
            class CustomMeasurePanel(bpy.types.Panel):
                bl_label = "Measure Tool Panel"
                bl_idname = "VIEW3D_PT_measure_tool"
                bl_space_type = 'VIEW_3D'
                bl_region_type = 'UI'
                bl_category = "My Tools"
    
                def draw(self, context):
                    layout = self.layout
                    layout.operator("bim.measure_tool", text="Measure Tool")
    
            def register():
                bpy.utils.register_class(CustomMeasurePanel)
    
            def unregister():
                bpy.utils.unregister_class(CustomMeasurePanel)
    
            if __name__ == "__main__":
                register()
    
    1. Run the Script:

      • Run the script by pressing Alt + P in the text editor. This will create a new panel in the 3D Viewport Sidebar (press N to open the sidebar if it’s hidden).
      • You will now see a My Tools tab in the 3D Viewport with a button labeled "Measure Tool."
    2. Add to Quick Favorites:

      • Right-click on the "Measure Tool" button that appears in the new My Tools panel.
      • Choose Add to Quick Favorites from the context menu.

    Now the MeasureTool operator (bim.measure_tool) is accessible via the Quick Favorites menu.

    Explanation:

    • The script creates a new panel that appears in the 3D Viewport's sidebar, under the "My Tools" tab.
    • In the panel, a button is created to call the bim.measure_tool operator.
    • Once the button is available in the UI, you can right-click on it and add it to your Quick Favorites for easy access.

    This will allow you to quickly call the operator without needing to have a permanent button for it elsewhere in the interface.

    tlang
  • @theoryshaw said:
    Is there a way to get the snap to work, when you're in camera mode (inside a drawing)?
    From the following, i have a sense this is a gnarly problem to solve: https://github.com/s-leger/blender_cad_transforms/issues/25

    Thanks for reporting, I'll take a look at that.

  • @theoryshaw I'm planning on creating icons for the measure tool, it should solve the quick favorites problem.

    Bedson
  • @theoryshaw The issue with snapping in camera mode should be solved. Let me know it's working for you.

    theoryshawMoultduarteframos
  • seems to work!
    ...
    Is there, when using the measure tool, a way to complete a measurement (end it). And then start a new measurement, without exiting the measuring tool?

  • I've made a few updates to the measure tool:

    • You can now select between 3 modes. See here: https://github.com/IfcOpenShell/IfcOpenShell/issues/5316#issuecomment-2392586520
    • It shows the area, for area type, in the center of the polyline.
    • It show the total length in the last polyline point.
    • Measurements now persist on screen. To erase them, activate the measure tool and press "E".
    • While they are on screen, measurement can be snapped, which means they can work as construction lines.

    Please let me know your feedback.

    carlopavMeetlatMassimosteverugiJohntheoryshawatomkarincatlangBedsonAce
  • I can't seem to get locking to the plane to work. Anyone have any pointers?

  • It should be working. However, it lacks a visual feedback. I'll try to mimic Blender behavior.
    For now, try pressing shift+Z and see if the Plane type changes to XY in the bottom right. All the measures should show the same Z value:

  • edited November 2024

    See attached video. I would assume i would not be able to snap to all those corners, if the snap was locked on the XY, for example.

  • Ok, that’s a bug. I’ll take a look at that

    theoryshaw
  • @theoryshaw I've just pushed a fix for this, let me know if it works: https://github.com/IfcOpenShell/IfcOpenShell/issues/5690

    theoryshaw
Sign In or Register to comment.