Measure script (Blender 2.5x and newer)

It’s also pretty darn quick. What’s slow is computing wall thickness (making sure a given area is thick enough to support itself when produced in a given medium).

Version 0.8.0 of the script is now available

Version 0.8.0

  • Volume calculation

Syndaryl:
Thanks for the link, that code works perfectly (after some 2.5 API modifications). I’m especially happy that it includes a manifold check :smiley:
Many thanks to Benjamin Lauritzen (Loonsbury) for that code.

Thank you very much for the update! Hurray, I can stick to one version of Blender again! EDIT: I can’t download it from the links in the first post (getting 404 not founds). It’s so close I can TASTE it…

Oops, forgot to update the download links when the script file was renamed. Should be fixed now.
BUT I’ve only uploaded the script to blender svn yet. The gitorious upload will have to wait until I’m at home again.

EDIT: You can download the script from the svn download link (see original post).

Thanks, pulled it down from the SVN, I’m finding with 2.59.2 from graphicall I’m getting a volume of “8” all the time. Default Suzette, resized suzette at the object level, resized suzette geometry… it’s all “8”. Is it stuck on the default cube? There’s no button to refresh any more.

Suzanne is a non-manifold mesh (the eyes are loose), so you should get the message “Mesh is non-manifold!” and no volume at all.

There should be no need to refresh anything. As soon as you change object selection it will update the calculation (except in edit mode, but no volume calc supported there)
The only manual thing you need to do is to “Activate” the script once it shows up in the panel.

I’m using blender from svn, haven’t tested the script with anything else yet. Will try one of the official releases soon to see if the script is compatible.

EDIT: Works fine with the official Win32 2.59.0 release (=rev39307)

Ah! Interestingly, at home (Windows 64 bit) it complains about non manifold. At work (Windows 32 bit) it just kept the last volume.

Just had the time to check with the official Win32 2.59.0 release (equals the svn rev. 39307) - works fine there.

Personally I have found no release/build yet where this problem happens, so I guess it’s either a problem with your build or your local setup/settings.

I have no easy way to test Win64 builds right now. So if anybody is out there who can, can (s)he please test the script and report back here?

To be clear, the home computer (Windows 64 bit) was working properly - it correctly rejects Suzette as non-manifold, and correctly reports the volume of manifold meshes. The work computer (Windows 32 bit) has a somewhat hostile relationship with Blender due to the Intel integrated video card on this machine (useless hunk of junk :P) but normally I see symptoms like the User Config menu coming up black, not errors in paneled scripts like this.

I’m getting a volume of ~71 litres for my 180 cm tall, humanoid figure, which subtracting about six litres for average human lung capacity and estimating an average human density of 0.9 gets me 58.5 kg. That seems very strongly in the right range for the body type and height - not muscular or strongly developed, feminine frame, not bony-slim (which makes me feel good about my figure design).

Ah my bad, I’ve read it correctly, but my brain did something completely different. :o
No idea why it behaves like this on your Win32 box then.

Just a quick mention that I ran into a bug in r41593 that wasn’t in 2.60a which seems to be caused by having this addon enabled.

The problem is flickering menus when using overlap mode. You can see a sample of this in the following blend file and video:

http://download.blender.org/ftp/incoming/flickering_menu.ogv
http://www.pasteall.org/blend/9561

Psy-Fi was nice enough to track it down to this addon, and seems to be confirmed, so I hope this helps!

PS - Cool addon :slight_smile:

All things are difficult before they are easy.

That’s very strange behaviour, thanks for reporting it.
Just speculation: I suspect it has something to do with the redrawing/refreshing that is done by the script. The script may do this too often or at the wrong time. Unfortunately I have no clue yet where to start fixing this. Is anybody around who has experience with this?

At least there is the workaround from the video for now: Setting Window Draw Method to “Automatic” (which is the default anyway I believe).

Cheers,
Martin

Hi Marin,

First let me say: Very useful addon!!!

Can you include measure perimeter in the next release? (I think, it can be easy added.)
I’m working on Blender 2.6 and I’ll made this for myself, if you want I can share the results.

EDIT:

This is a very simple code, but works:

def calculateLength(mymesh): # length calculation
ltot = 0
for e in mymesh.edges:
ltot = ltot + (e.v1.co-e.v2.co).length
return ltot

reference:
http://yorik.uncreated.net/guestblog.php?2008=4

Best regards
Vagner

What you describe (especially the code) is not exactly the perimeter but the total length of all edges. i.e. that may include edges that are inside of an area/polygon and not part of the perimeter.

This should be very easy to implement, as soon as I have some free-time I’ll look into this. (At least it’s easier than finding & fixing the problem(s) with registration and performance :o)

Once this works you could go into edit mode, select an area (or single polygon) and convert the area with Region to Loop into its perimeter.

Saludos, Martin

Hi martin,

thanks for your answer… I think, blender python is more hard than I thought

this is a parte of my code:



scn = bpy.context.scene           
obj = bpy.context.object

# Get mesh data from Object                
mesh = obj.data
            
if(mesh.total_face_sel):
    #faces selected measure area
    sum_area = 0.0 
                    
    for f in mesh.faces:
        if f.select:
            print(f.select)
            sum_area += f.area
                    
    print (sum_area) 
                         
elif(mesh.total_edge_sel):
    #edges selected measure length
    sum_length = 0.0 
                    
    for e in mesh.edges:
        if e.select:
            v1 = e.vertices[0]
            v2 = e.vertices[1]
            sum_length += (mesh.vertices[v1].co - mesh.vertices[v2].co).length

    print (sum_lenght) 


Good lucky in your work, I’ll wait for updates

Vagner

The script would be even more usable if…
it could measure distance between snapped vertices/nodes/endpoints/midpoints/centerpoints (the way it should be).
…but thats just (ridiculous) beauty of Blender’s snap functions.
Who needs distance between center of a cube to some other imaginary center of a cone or even other ‘Selected’ point ?

Reusing the snap functionality directly would be nice, but that is way beyond my coding capabilities (and interface design skills).

You do know that this script supports measurement between the 3D cursor, empties and vertices (the latter two being snap-able)?
Only downside is the damn manual update in edit-mode :frowning:

I already started the integration of edge-length measurement into the script. It gets a bit more complex than your example code when dealing with local and global (i.e. object scale) results, but I think I can get it done between tomorrow and the weekend.

EDIT 2011-11-28: My weekend was kinda busy, so no new version (yet). The good news is that the new code is basically finish, I just need to test it and make sure everything works as expected/intended. I’ll keep you updated on the progress