[AddOn] NP Point Distance (measuring tool)

Hi,

here’s another small tool i developed for the architectural pipeline. It measures the distance between two points in a CAD fashion. It is a macro and it is not very subtle in terms of coding, i made it in my spare time for my work and i can’t guarantee it will work flawlessly in your setup. So far it does what it is supposed to.

Current version: 018

http://pasteall.org/pic/show.php?id=111404

GIFF video

INSTALLATION:

Unzip and copy .py to addons_contrib folder in your Blender folder. Start Blender, go to User Preferences/Addons. Turn on Testing filter and type np into the search box. Check the box next to the addon name. If you have a previous version uncheck it and then check the new one.

USAGE:

START - space search menu / type np or 018 / enter or hit the shortcut key if you assigned it
LMB / CTRL+LMB - selection of points with snap, depending of mode the second LMB ends/continues the command
MMB - constraint movement to X/Y/Z axis
ENTER - change snap target
SPACE - entering/exiting the new navigation mode during the command
ESC / RMB - exiting the command

ADDON SETTINGS:

Scale: Distance multiplier for various measuring scenarios
Suffix: Unit abbreviation after the numerical distance
Step: Mode of command - whether the command operates in one-step or continuous fashion
Mouse badge: Option to display a small cursor info
Value to header info: Option to display the last measured distance in the header
Value to clipboard: Copy the last measured distance to clipboard for later reuse
Custom colors: Default or custom colors for graphical elements
Stereo cage: Display bounding box that contains the dimension, for better graphical comprehension
XYZ lines: Display axial distance lines
XYZ distances: Display axial distances
XYZ backdrop: Display backdrop field for xyz distances

SHORTCUT ASSIGNMENT:

Detailed instructions are inside the py.file, as with other NP add-ons.

Please report eventual bugs, the 018 version is heavy with upgrades. Thanks for all the feedback and suggestions.

Attachments

NP_point_distance_016.py.zip (8.61 KB)NP_point_distance_018.py.zip (10.3 KB)

Thanks you so much @Okavango,
i will tested because I’m architect and i need this kind of tool!
Byebye
Spirou4D

You are welcome Spirou, hope it helps.

It was made and tested in Blender 2.75a.

Fantastic! Thx you!

Fantastic! Thx you!

How can i create a button with this macro?

Hi mkbreuer, thanks for the kind words.

The main thing is that when you enable this script in your user prefs / addons and click save settings, this command (operator) is in your system permanently. You can check this by using the spacebar search menu and typing ‘point’.

There are several ways that you can make a switch for this. For example, you can make a pie menu with a button and this operator assigned. Or make a script that creates a button somewhere in the panels and assign the operator.

The way i usually do it is via keyboard shortcut and it is the least complicated way. In the user preferences menu go to the input tab and look for the 3D View / Global group and expand it. On the bottom of the list click ‘add new’ and in the ‘none’ field type object.np_point_distance_014 and assign a key of your choice. For example, i think ‘D’ is free, or ‘T’ for ‘tape measuring’. I use T because i freed my ‘T’ and ‘N’ from ‘tools’ and ‘properties’ and replaced them with Z and X…

@Okavango

Thank you!
It is not the problem to create a shortcut or button, but i don´t know wich id i have to use for it:

I tried this without success (marco id):

 layout.operator("object.np_point_distance_014", "Point Distance") 

When you start it from search you became this (see also Operator List):


bpy.ops.object.np_point_distance_014(OBJECT_OT_np_pd_get_selection={},
 OBJECT_OT_np_pd_read_mouse_loc={}, OBJECT_OT_np_pd_add_point={},
 OBJECT_OT_np_pd_run_translate={}, OBJECT_OT_np_pd_change_mode_one={},
 OBJECT_OT_np_pd_run_translate={}, OBJECT_OT_np_pd_delete_point={})

This will crash blender when i paste it into the operator.

I also tried to start it with an separator operator, but nothing happen.

What to do?

I forgott: i tried in 2.77

Another useful CAD tool from you, thanks :slight_smile:

Hi, mkbreuer,

i managed to enable the command in 2.75a in all three ways - via shortcut, via pie menu and through a simple panel. I attached the code for the panel in a form of a script, so you can try it out and see the code. The script makes a new NP tab in the toolshelf and inserts the NP_point_distance operator if you enabled it in the addons tab. I guess it should work for 2.77 also.

Hi bekic.bojan, glad you found it useful, hope it helps…

EDIT: in the .py file find “object.np_point_distance_xxx” and change the number to version you have installed.

Attachments

NP_base_panel_000.py.zip (1.02 KB)

Ok! This works!
I forgot to say that i have tried to run it from the header.
From there only the settings list (F6) pop up.
Anyway thank you for your fast reply…

Hi guys,

new version 015 is available. I cleaned the code a bit, solved some visual problems and put some custom settings in the add-on tab. You can now use your own scale and units.


Nice thank you. Could you make a git repo with your addons ?

Very good news but do you want my correction to your addon: I added a menu to show and remain the last dimension (+ infobar and written in Terminal , usefull after some times…
Here is the link

Very handy Okavango and thank you. Make it more easy to use, when Lclick the second point it will start again like at the beginning, no selections.

Here is my correction fo your release 15:
Added an “Architectural Infos” menu in Tools panel and the nber of digit option in plus in user prefs:

LINK

I want you say that the “Scale” option is not necessary, the unit(suffix) must change automatiquely the scale in hidden mode.

EDIT 1: My shortcut is Alt + TWO (top of A)
EDIT 2: Infos panel with last size cell to copy (place your cursor on top of the cell and ctrl + C to copy)
The units are independent of the units selected for the Blender scene : you can have a result in Feet even the units of the scene are in meters and vice & versa . It’s interesting when your compare your job in international units.
EDIT 3: Updated 14 07 2016.

Thank you for sharing this script!

It might be useful to have measured value on the clipboard - you then can simply paste value in any transform box and do any additional calculations if needed.


 483       # Modified Spirou4D
        endloc3d=Storage.endloc3d
        startloc3d=Storage.startloc3d
        dist = (mathutils.Vector(endloc3d) - mathutils.Vector(startloc3d)).length
        Storage.dist = dist

488       bpy.context.window_manager.clipboard = str(dist)

Eppo, yu’re right, I will modified it soon…Thks for your return.:yes:

Eppo,
You can download again my corrected release as you wanted! Same link above, please.
Bye bye :yes:
Spirou4D

Hi guys, thank you for taking interest.

matali Nice thank you. Could you make a git repo with your addons ?

Hi matali, unfortunately, i don’t have any plans to move to git system yet. From your posts elsewhere I see that you have a concern about loosing track of the latest addons, it is a normal situation for me also. However, by my enumeration i will try to be clear what is the most upgraded version.

Spirou4D
Very good news but do you want my correction to your addon: I added a menu to show and remain the last dimension (+ infobar and written in Terminal , usefull after some times…

Some nice suggestions from your side, there is a chance i will try to incorporate some in my next version. Although i must say that ‘length’ in your info may not be the best choice of terms. I often use this script for measuring distance between objects as well as object height and depth. For this reason i think i will continue to use the term ‘distance’.

I want you say that the “Scale” option is not necessary, the unit(suffix) must change automatiquely the scale in hidden mode.

Automatic adjustment of scale would be nice, but i am afraid that ‘scene unit scale’ in scene settings could interfere with this setting in several scenarios. In the way it currently is it is more resistant to system settings, flexible and gives more freedom to user.

my shortcut is Alt + TWO (top of A)

Automatic keymap assignment is good, but i would recommend everyone to do it’s keymapping manually. For example, your proposition conflicted with my layer shortcuts and it didn’t work on my system.

JuhaW Very handy Okavango and thank you. Make it more easy to use, when Lclick the second point it will start again like at the beginning, no selections.

Thanks JuhaW. Could you explain better what you mean?

eppo Thank you for sharing this script!

It might be useful to have measured value on the clipboard - you then can simply paste value in any transform box and do any additional calculations if needed.

Nice propostition. Maybe i will add this when i get the time for the next version.

A general note to all using NP addons - they are all made and tested in 2.75a. I am only sharing what we use in our work, my free time is very limited for additional support although i will try to respond…

Automatic keymap assignment is good, but i would recommend everyone to do it’s keymapping manually. For example, your proposition conflicted with my layer shortcuts and it didn’t work on my system.

I write Alt + TWO, not TWO as you say is for layer 2 -> no problem all system, I am on linux Mint Rosa and no problem.On Windows no problem, Mac I don’t know, I havn’t nomore.

Length is a length of a size in every kind. Length between two point and between two object’s points. In architecture, we measure lengths. The distance is just an appraisal report between two objects.

There are no fear here: Automatic adjustment of scale
is your code not the Blender behavior. When you choose a suffix, you know that you must scale by x to change the dimension. It’s easy to understood. No need the user change the scale.