# 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.
If you have comments or ideas to improve it, please post them here.

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.

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!

Maybe this script will be useful for you, for creating show in 3D View which vertex is first and which vertex is second:

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!

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

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!

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 !!! 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 ? What do U think about it ?

Hi, Jedrzej_s
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!
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: