Measure script (Blender 2.5x and newer)

seems to be working very fast - nice

can change the scale and kkep going shoiwing the area!

but is there also the original distance vector
i wold like to see the Angles too for this vector if possible
at least it gives all the info about this vector

very nice
if i have time later on i’ll study this one
but it’s beginning to be a complicated on i guess

also when closing blender
i get a huge amount of errors function of the number of times
a played with the faces selection in edit mode
did you see a memory pointer error on the console beign repeated
100’s of time?

by the way would it be possible to add on file name the version number if pssible
so you can refer to different version when needed
would be easier to work with different versions

keep up the good work

I plan to do something like that, but not just yet.
I really want there to be some sort of indication in 3D to show what angles are actually calculated.

Yes, whenever one uses the area calculation in “Global” mode I need to create a temporary mesh (that is not visible anywhere) to get the correct surface area.
This is done a lot in the measure script.
All this temporary data is normally cleared automatically before saving and exiting Blender. (At least this is what i think is happening)

It’s not really a bug, but annoying as hell if the measure panel was active for a long time.
I’ll try to fix this, but no promises.

Version 0.6 of the script is now available

  • Removed auto-update in mesh EditMode.
    Meaning: Removed EditMode/ObjectMode toggle stuff.
    Instead I’ve added a manual “refresh” button.
    I’m sorry for this inconvenience, but this made the script CRASH Blender a lot. [1]
  • Use “unit” settings (i.e. none/metric/imperial)
  • Fix: Only display surface area (3 or more selected objects) if they are meshes.
  • Internal code cleanup

See the original post for the download links.

[1] A more in-depth description of what i think is happening here:
While in edit mode the measure script is called in varying intervals.
Each time the script is called it exits to object-mode and reenters edit mode to update the mesh.
But if the user changes the selection or moves/transforms/changes the mesh while the script is called there is a conflict :frowning:
I really hope BMesh (or some other code-change) is able to help here.

Version 0.6.1 of the script is now available

Mostly bugfixes and cleanup.

  • Fixed display of multiple objects.
  • Added “BU^2” next to (area) values that are not yet translated via “unit”.
    See the original post for the download links.

What version of Blender do you need to use to get the measure panel script to run? I am running Blender 2.5 Alpha0 on Mac OS X 10.6. It fails to run for a number of reasons.

Alpha 0 is already pretty dated (2.5 development is progressing rapidly).
A few thing the script uses have changed since Alpha 0.

The script should work with a recent SVN version of Blender … you should be able to get a recent build for MacOS X from GraphicAll:

Version 0.6.3 of the script is now available

Mostly bugfixes and cleanup.

Version 0.6.3

  • Added register & unregister functions.
  • Minor: Fixed line length.

Version 0.6.2

  • Fixed precision of second area property.
  • Reduced display precision to 5 (instead of 6).
  • Changed the script so it can be managed from the “Add-Ons” tab in the user preferences.
  • Corrected FSF address.

You can now add the script file in your .blender/scripts/addons/ directory and then enable/disable it in the User Preferences under Add-Ons.

See the original post for the download links.

Anybody who is curious can try my preliminary script with enabled drawing of distances in the 3D View.
i.e. Shiny “3D” lines

Note: No testing or any kind of thorough bugfixing went into this version (yet).

EDIT: OUTDATED:
(old one: 3. version http://pastebin.org/113133
old one: 2. version http://pastebin.org/101840
old one: 1. version http://pastebin.org/101794)

As kaito pointed out on IRC:

kaito: this trick with modal operators assigning draw callbacks is … eh… hrm…
I think he is 100% right about that. Does anybody know a better way of doing this?
The script definitely doesn’t need a modal operators like that for the drawing functionality.

Martin

Hey pontiac, amazing work, I was missing this feature since 2.4x, just a couple of suggestions:

would be nice to display the distance in the top header of blender, cause there already tells you how many vertices, objects, and others are selected, so would be nice to also see the distance between selections, are would always be visible and do not distract cause is on top, another suggestion is some kind of workflow similar to Maya’s measurament tool, based on two emptys and it shows on the 3d viewport the distance all the time, I tried to modify your script in someway changing the name of the object to show your measurement result, but I cannot use the name of the objects as a drivers, anyway thanks for your effort.

I made some modifications to your code, this is what I get, it’s still far from my idea, but I think is a good suggestion, what do you think?: http://img684.imageshack.us/img684/1790/scriptx.th.png Would be nice that the distance would looks like the rest of the object information (vertex, faces, etc…) I mean plane text instead of a button, also it’s a shame it cannot be update automatically, and in the header I get some lag between the information displayed in the 3D viewport (your original code) and the one it shows in the header (same code).

That’s easy to do, just use a “label” instead of a “prop”.
You loose the (planned) automatic conversation into metric/imperial units though.
At least I don’t know if there is a specific function (yet) to do that without using properties.

Can’t say much about the calculation/display updates., I don’t know the code for that bar.
Remember that you need to manually update the calculated values in edit mode with the button.

But to be honest I don’t really like that bar to display additional information to next to the one that is already there.
It is already crowded in there and picking out the information from all the numbers in a line gets kind of hard.
That’s defiantly not something I’ll integrate in the script. Maybe I’ll draw the text in the 3D View, we’ll see.

Martin

as label doesn’t work for me :no:

Look at how I’m doing the display of the area for more than 2 objects … there I use a simple label widget:
http://gitorious.org/blender-scripts/blender-measure-panel-script/blobs/master/panel_measure.py#line420
[Search for “len(context.selected_objects) > 2)” and the code below it.]

You have to manually transform the calculated value into a text string and use it as text="" attribute
(This also means that you don’t even need the “measure_panel_dist”, “measure_panel_area1” etc… stuff.)

Martin

thanks pontiac, but I think this is far from my knowledge hehehe, I just want to have the measurment calculation result in the header, that’s all, are you planning to update your script? also I tried to put this information instead on the header at the object name, so you can see in the viewport the distance, but there’s no driven key for the objects names i think.

I’m definitely going to update the script at some point in the near future, I just don’t have much time right now.

I’m still pondering about the drawing of the distance in the 3D view though - dunno if I’ll do that (at all or in the next release).

All the drawing changes in the 3D view and some bugfixes will be available in the next “official” release of the script for sure.
EDIT: This also means that I would welcome any testing & bug reports of the “PRE RELEASE” posted above. Especially testing all the calculations of values and correct display of lines would be appreciated.
A lot of code was re-written in this version, so I expect at least a few bugs that weren’t there before. :wink:

Martin

I haven’t given up on this yet.
Here’s the most recent PRE RELEASE (you have been warned) code:
EDIT: http://pastebin.org/148167
(6. old http://pastebin.org/140044)
(5. old http://pastebin.org/139845)
(4. old http://pastebin.org/124896)
(3. old http://pastebin.org/124877)
(2. old http://pastebin.org/124641)
(1. old: http://pastebin.org/122950)
I’d be glad to get feedback/bug reports.

Martin

It’s working very very nice, shame that has to be updated manually when you’re in edit mode.

I have a few questions.
The first on my mind is,
Is this script suppose to replace or substitute the “calliper” script used in 2.4x?
So I just save this script as .py and put it in my addons?

Thanks & great work everyone!

a2z

Pontiac, I have written a small extension to your script: calculating volume of one selected object. Since you are owner of this project, I send my patch to you:
http://www.pasteall.org/13889/diff
It can be applied to the current version of the script as it is in trunk.

It works similarly as the 2.4x GreyBeard’s tool: it divides the whole mesh into small tetrahedrons. So the basic requirements stay the same: all normals must be pointing outside and the mesh must be manifold.
But as a little improvement, this script works with quads correctly. And it follows your Global/Local switch.

And I fixed one little version bug: your calls to blf were outdated.

Btw. I cannot download any of the links to pastebin - what am I doing wrong?

Hi.
I have a problem with your script. Works OK but:

  1. it stops showing tool tips in 3dView properties panel ( N-key )
  2. when I hover mouse pointer over any input field or button in 3dView properties panel, CPU usage jumps to 50-60% with no reason ( I think it may be related to holding tool tips but it happens even when tool tips are off) and then it’s hard to adjust any value in panel
    3.strange lines appear in 3dViewport when measure is on :
    http://img594.imageshack.us/img594/5962/lineso.png

4.when measure is on and I disable add-on from UP, measure lines stay in place and are still drawn :
http://img7.imageshack.us/img7/5594/lineswhenoff.png

Tested on Ubuntu 9.10 32bit with latest driver for NVidia 250, Blender builds 30580 and 30593 from Fish.
Now I’m gonna test it under WinXP and post results.