Lengthen (Measure and position verts)

Small update (for a long time) of my little script to dist between 2 vertices and position according to a given distance. It now gives vertices distance, deltaX, Y ,Z.
Link: http://clientes.netvisao.pt/pconcretos/temp/lengthen_0.16.zip
If you have comments or ideas to improve it, please post them here.:slight_smile:

Enjoy!

Wow ! I like this ! Very handy !!!

My suggestion: It should show in 3D View which vertex is first and which vertex is second. It should highlight these two vertexes and show near first “1” and near second “2”. This would give better orientation :).

Bug: When I put 1.999 show 2.00 in GUI. It should show correct value and it should have bigger window (for 2.000. Blender every values display like 0.000).

Regards and THX for your work :).

I’m glad at least you found it usefull.:slight_smile:

I try to get some answers in the forum about how to increment decimals, but didn’t get a solution. You can still see the real value in the text “Distance:”.

About something to signal the vertices, i think it’s not easy for me, not at this moment, to implement that. But give me time and maybe i could do it.

Thank you for your ideas and enjoy!:slight_smile:

Maybe this script will be useful for you, for creating show in 3D View which vertex is first and which vertex is second:
http://blenderartists.org/forum/showthread?t=61967

Again THX for your work :slight_smile:

Have a look at the caliper script: http://www.alienhelpdesk.com/index.php?id=38

It does some things you may find interesting… You could for instance use some of it’s code to allow distancing according to real world measurements.

Ah and I just saw the message in my console window… Apparently you’re using the deprecated function “copyvec” … in stead just do something like NewVector = Mathutils.Vector(OldVector);

A big headeach for a “small” improvement.

1 - Corrected a bug;
2 - The button label now updates when is “Distance” or “Percentage”
3 - Finaly, it now signal the chosen vertices (enable “Script Links” to get this to work). It doesn’t put numbers, but a small green or yelow dot, if it’s the first or second vertices.
In here, i have to say thank you to cambo, to teach me how to share information between scripts, and a big thank you to 3R - R3gis, cause without is “Trajectory” script i could not have done this (learned alot and still learning). Hope you don’t mind, cause i use some of your code.:o

Enjoy!
p.s. comments, please!

http://clientes.netvisao.pt/pconcretos/temp/lengthen_020.zip

I heard, years ago, that it is not good to connect data to the main Blender module and it is the reason why somebody wrote a Registry module to manage this kind of data .

http://www.blender3d.org/documentation/240PythonDoc/Registry-module.html

As you read above, cambo teach me this way to do this stuff.
I do not say you are right or wrong, but i think that cambo would not teach something (especially with is knowledge about blender and python) that is not a good way of doing things. Of course i thank you your opinion and will investigate the Registry module.

Have you something to say about the way the script works, or any ideas about an improvement?

Thank you!

There was a bug that doesn’t draw the chosen vertices in correct location. Solved now!

http://clientes.netvisao.pt/pconcretos/temp/lengthen_020.zip

Comments, please!

About weather this is right or wrong.

I have also read that its not good practice… (Pretty sure I said that when you asked how it was possible)

You need to be careful because it opens up the possibility of things like referencing objects that have been removed (Youll find some errors you havnt seen before)

But taking into account all that, its a much faster way then the registry. Say with the registry you save an object name instead.

    • You need to do a Full lookup everytine you want to reference that object from the registry with Object.Get()
  1. It may end up Clogging the registry (Think Windows) if lots of scripts save data that they should only be using to do inter process communication with other scripts.
  • Of course You could get around #2 by making sure you removed the regestry entry after the script finished.

Even though the “data being removed” issue is a problem, its not limited to assigning data to the Blender module. - EditBones, Mesh API has this issue also, so basically be careful and test you work well and you should be ok.

So to simplify, Id say Registry is for settings and assigning to the module is to be used with care for interscript communication.

Even with all the safeguards we impose, people still manage to write scripts that mess up Blenders internals so just try to write modular easy to debug code and you should be right…

  • Cheers

I don’t know if you look at my code (i think it’s clumsy) but i try to remove in the possible ways that i remember.

As you have guest, i’m just learning python and, if a guy that write scripts like you (i see you know alot) for me it’s a reference to keep. But, as always, i’ll keep your words in my memory. Thank’s for your tips.

Very usefull script !!

But why not some color???

Regards!
Dalai Felinto

(...)
    BGL.glColor3f(1.0, 1.0, 0.0)
    BGL.glRasterPos2i(x+w+5, y+h*4+5)
    Draw.Text(t2)
    Fix1 = Draw.Toggle("Fix", EVENT_FIX_1, x, y+h*5, w/4, h, Fix1.val, "Fix the 1st vertice")
    Draw.Button(s1 + "Pick 1", EVENT_PICK_1, x+w/4, y+h*5, w-w/4, h, "Select the 1st vertice")
    BGL.glColor3f(0.0, 1.0, 0.0)
    BGL.glRasterPos2i(x+w+5, y+h*5+5)
    Draw.Text(t1)

    BGL.glColor3f(1.0, 1.0, 0.0)
    BGL.glRasterPos2i(x, y+h*10+5)
    Draw.Text("Enable Script Links to get a mark on chosen vertices")
        
    BGL.glColor3f(0.0, 0.0, 0.0)
    BGL.glRasterPos2i(x, y+h*9+5)
    Draw.Text("Distance: " + dist)
        
    BGL.glColor3f(1.0, 0.0, 0.0)
    BGL.glRasterPos2i(x, y+h*8+5)
    Draw.Text("DeltaX: " + deltaX)

    BGL.glColor3f(0.0, 1.0, 0.0)
    BGL.glRasterPos2i(x, y+h*7+5)
    Draw.Text("DeltaY: " + deltaY)

    BGL.glColor3f(0.0, 0.0, 1.0)
    BGL.glRasterPos2i(x, y+h*6+5)
    Draw.Text("DeltaZ: " + deltaZ)
(...)

Another upgrade, a good one, i think!:slight_smile:

Basically it’s used in the same way.

1 - You pick the first vertice.
2 - you pick second vertice
3 - press apply to move to new position.

to group (new button) - select a group of vertices that you want to move the same amount and in the same direction as vertice 2 (it can be any mesh). Now press “to group”
(This new option only works OK if you have vertice 1 “fix”. Improvements are expected)

http://clientes.netvisao.pt/pconcretos/temp/lengthen_021.zip

Comments, bugs and ideas are welcome!
Enjoy!

Hi ! I use your cool script still :slight_smile: !!! I have some feature request:

  1. Possibility to copy measured distance of two vertexes and paste it to Distance button. This will be handy for fast added these same distance to another two vertexes ! It should based on great Blender feature: mouse over button copy it (CTRL-C) and paste it to other button (CTRL-V).

  2. Colored buttons: *Pick 1 should have green color (these same color as 1 st vertice in 3D View) *Pick 2 should have yellow color (these same color as 2 st vertice in 3D View). These colors would good symbolize which vertice in 3D Views is first and which is second. Because I noticed that sometimes forgot which color mean first ;).

Do you understand my ideas :slight_smile: ? What do U think about it ?

Hi, Jedrzej_s :slight_smile:
I keep using it to. Untill now, there’s still no easier way to do this in Blender.

Give me some time and i’ll see what i can do!

Yes, in some situation it’s very handy. THX for supporting still this script :). Cool !!! Regards !!!

Hi,

I`ve written a small guide on how to use the Lenghten script for my blog:

Hope it can be usefull!

[]`s
Allan

Jedrzej_s, i do not forget your sugestions, it’s just that i’m having no free time!:frowning:
It have to wait a little longer.

allanbs, thank you very much!
It’s always good when we make something from the heart!

Thank you, guys!:yes:

[edit]
I just saw that the last link was dead.
Here it is a new one: http://clientes.netvisao.pt/pconcretos/Scripts/lengthen_021.zip
Enjoy!
[/edit]

Ok. Nice to know that U haven’t forgotten ;). Thanks for this good script :wink:

Regards !

Cool script…thanks for sharing…keep up the good work…I wish I could contribute someday…