[Script] mesh elastic

This is my first script in 25x, and i started writing scripts a week ago - so i am grateful for some feedback.

What does it ?
The script moves a selected part of the mesh to fit best into it’s surrounding. The edges from the selected to the unselected verts are serving as elastic bands.
The selected verts in the mesh must not be connected, you can use reference-verts in the mesh.
The Script shows up in the Mesh Tools.
The selected mesh can be rotated and translated free or with restriction, for example: only rotation around the z-axis.

Known Issues
(1) Sometimes you have to repeat the script several times for a final result
(2) The Script quits sometimes, if the calculation do not get a unique solution - i will work out something to make a regular end for this exception. If this happens, try out some restrictions, like switching off the scaling or rotation.


great to see you back!
How are you enjoying the new api?

it reported error when i selected a single vertex and hit move, seems to work ok though.

issue 2, the algorithm tries to rotate a single point and since there is no singularity = more than one solution, it fails.
Mathematically the problem is an underdeterminated equation.
I am looking for a way to include a user error message with a propositions, how to solve this problem.

looks promising.
Still carving on a optimal UI - scaffold. I do have a lot of minor problems like an initially collapsed Panel, …
There is some event trigger for starting a script, when a object is moved, that’s very useful, but i have still not have figured that option out. And for some tricks like the global context attribut for the panel it took me some time to realize.
And after all there are a lot of scripts, i want to rewrite :slight_smile:

What I am doing with my script in the case a user does not fulfill the requirements of an action, I disable the button. I do that with replacing the button with a label text explaining the reason why the button is disabled. I prefer it from displaying an annoying error that the user may not understand or not care at all.

That’s not that easy, because i can’t tell if there is a solution until i have checked it out by the algorithm. There are some basic estimates, which will maybe cover 80% of all requirements, but for the rest it’s either there is a singularity, or there are many.
And to make it worse, it also depends a little bit on the math accuracy, sometimes the algorithm fails, while with a little different start, it will succeed.

So where is the problem ? Check that algorithm gives a solution and then enable the button. Even if the algorith is slow its not a problem cause from my experience the gui updates only the when the mouse hovers it or clicks on it. That helps avoiding unnecessary code execution.

You could probably make it intelligent so its does not check the same data more than one time with the algorithm.