I work with neuroscientists who are really excited about the Measure Tool in Blender 2.80. They want to measure large quantities of neuronal structures that we have modelled in 3D from microscopy data, and then perform statistical analyses on these measurements. This tool makes this process much faster than tools we have developed in the past.
However, I can’t figure out how to access the measurements from Python. Can somebody help point me to how we can access the measure tool measurements from Python?
Could you elaborate on what you’re trying to accomplish? The measure tool would not be useful without human input, unless you’re measuring distance between known points or objects, which can be accomplished with regular blender functions.
I want my users to be able to make many length measurements (hundreds) by hand, in a scene with many objects. I then want to be able to extract the values contained in these measurements via python. Only one type of object would be measured at a time, so it’s okay to not know which measurement corresponds to what point in space, they don’t need to be named, I just want to be able to grab all the lengths that have been created in the scene, for further processing.
I dont think there’s a way to do it, but should be easy enough to make a custom measurement tool in python. you want it to snap to surfaces, measure and save lengths its very easy.
If you know exactly what features you are looking for, maybe its even possible to auto-detect them for measuring.
Why not write your own measure tool with employing Empties and the draw a simple line with some text on it? That way your users can measure and commit measurements which would let you make recordings of those measures.
In any case those measurement points should be in
I believe the printed measurements are actually just drawn on the screen and are not available as data. So you have to make your own calcs based on those points.
I think he is not talking about grease pencil, probably it is talking about the ruler tool
Anyway, It should be possible to even extrude mesh edges and just write a script that logs the edge lengths/angles to a file or whatever (If this script already don’t exist).
yes the ruler tools start and end points are in that data block, I just checked.
Oh, yeah, I found it.
Its really hidden and obscure, I wonder how did you found it.
I use it in my EZLattice addon for manual lattice alignment and pivot placement in Originie. I was looking for ways to access GP data and I realized that all those tools lay their data there.
You can also see that RulerData3d is actually listed as a layer in the Annotations pane.
That’s why, its clear now.
Anyway, If it was me, I wouldn’t resist the opportunity to make a custom tool for freaking neuroscientists its not a thing you do every day.
I agree, I think having a bit fancier measuring tools would be even nice for modeling and other purposes too.
I am also curious how they set up their scenes. and how they take their measurements, also good to know if they are using images or 3d data from cat scans.
Actually, writing custom tools for neuroscientists is something I do everyday. =)
I have already written measurement addons for them, but the new Measure Tool is just so much more efficient than anything else I have thus far been able to create. And when you are making hundreds or thousands of measurements, that extra 1-2 seconds really makes a difference to your sanity. (We have 3D models exported from TrakEM2/Fiji, from 3D Electron Microscopy imagery.) I would like to write a new tool using this interface for purely length measurements.
But I’m still not seeing how to get the length measurement data out of
when I check .values() I get the error “this type doesn’t support IDProperties”. Any suggestions?
Thanks again for your help!
Here’s a one-liner:
lengths = list((s.points.co - s.points[-1].co).length for s in bpy.data.grease_pencils["Annotations"].layers['RulerData3D'].frames.strokes)
lengths = 
ruler_data = bpy.data.grease_pencils["Annotations"].layers['RulerData3D']
frame = ruler_data.frames
for stroke in frame.strokes:
p1, p2 = stroke.points, stroke.points[-1]
length = (p1.co - p2.co).length
That works, many thanks from my team of neuroscientists!
and to get angle from measurement tool:
from mathutils import Vector
from math import degrees
lengths = [
round(degrees(Vector(s.points.co - s.points.co).angle(Vector(s.points.co - s.points.co))))
for s in bpy.data.grease_pencils["Annotations"].layers['RulerData3D'].frames.strokes]
Hi 1_conscience_0_dimen (great pseudo),
While searching a way to add labels to the 3D anatomy atlas that I gather in Blender, I found your post and could not resist to propose you to have a look at this:
I am glad to see that other anatomists are using Blender.
Please let me know if our work can match together in any way.
Hello fellow neuroscientist! Thank you for this informative thread. We have a similar need to measure length and width of modelled neuronal structures. Blender’s Measure Tool is lovely, but we need to associate the length and width measurements with the original structure. Do any of your addons do that and if so, would you be willing to share them?