ScriptSpot

Script

Normalize Spline

By LittleLordPotala · 2011-11-22

Version
1.7.1
Version requirement
2009, 2010, 2011, 2012, 2013
Votes
13
Description

This scripted plug-in normalizes a spline by number of segments instead of the segments length. With options to show the vertex ticks, to close the splines, and optimize by deleting points relative to an angle threshold.

Additional Info

Launch the script. Select an editable spline or line and apply the modifier "Normalize Spl. 2" Change the parameters as you like. If you want to reset the modifications, just click the button "reset spl.". All the parameters are saved in the object properties -> "user defined". If you modify the spline and delete the modifier, the spline will stay to its current state. To reset after deleting, apply again the modifier and click the button "reset spl.". So, important : never delete or change manually the "user defined properties". To load automatically the script at startup, copy it in the following folder : C:\Users\[your name]\AppData\Local\Autodesk\3dsMax\2012 - 64bit\enu\scripts\startup ------------------ v1.4: -Like the version 1.3 but in the modifier list. -Record properties of each spline object in its user defined properties. -The "Optimization" is corrected to always keep the first and last point. -You cannot disable the modifier (click "reset spl." to get the initial state) -This scripted plug-in is not animatable. v1.5: -When normalizing, now it always keeps the last point and give a correct number of segments. -In "Optimization", change the default parameter to "Keep < 180°" v1.6: -Works with 3ds Max 2013 -Corrected an issue with closed splines v1.7: -Corrected a small issue with the "close spline" check box -Added a button "Bake spl. state" that will copy the spline state in the user properties v1.7.1: -Corrected a bug with "relative to total spl. length" check box when the number of segments was too low to close one of the splines.
Videos
Attachments

Tags: Scripted plug-in, Optimize Spline

Comments (28)

measurement

paul james · 2016-08-31

Hi

is it possible to get this script to allow an input of distance as well as a value ?
i want to be able to space the vertices evenly with a space of 4.877 mtrs between each..

thanks

asymptote · 2014-09-22

Awesome suggestion Barigazy

@Little Lord....pleeeeeease have the option to fix points and cure the eternal paths to Max issues that have been plaguing designers since year dot.

I use your script all the time and have been wanting this feature for years.

barigazy · 2014-08-24

One suggestion
You already have option "keep" for optimization.
Is it posible to add option where user can pick knots which will be excluded from calculation ei. in calculation process in the places of this knots spline will be broken and optimization will be on separate spline. On spinner "button up" event this shape will be welded again.

Good suggestion

LittleLordPotala · 2014-08-24

Hi barigazy,
It seems a good idea to have an option to keep a selection of knots untouched.
I think that the selection can only be done on the base object, not directly in the modifier.
I'm currently working on other projects but all in all, this doesn't look hard to do. So, I will have a close look at it, as soon as I have a little free time.
I thank you for this nice and useful suggestion.

barigazy · 2014-08-24

Thank you for taking this into consideration for the next update. :)
It's not the problem to goes down one level and select knots which will simulate some kind of pins. This will help a lot in the process of logo or text shape knots reduction. Most common case is imported shapes from vector packages (Illustrator or CorelDraw). Red dots on the logo shows pin positions.

I also have few suggestions about code optimization.
One of them is storing all data (UI states, knots properties etc.) in xml string and save it inside actual plugin (parameter block).
When you have more free time send me PM and we can discuss about this topic.
Keep up the good work man!

Fantastic work!

baszermaszer · 2014-02-21

Absolutely awesome tool for Max 2009! Thank You!

Thanks.

luxxeon · 2013-04-27

Thank you for this. This is exactly what I always wished was an option with the Normalize modifier. Great tool.

berdinatilli · 2013-04-26

thx alot, ill try the workaround.

berdinatilli · 2013-04-26

no vertex showing up in max 2014.

thx in adv

Thanks for the report,

LittleLordPotala · 2013-04-26

I've already seen this little issue but, sadly, I cannot correct it because it's a bug of the viewport in Max 2014.
The script does the same thing as :
right click -> object properties -> general tab -> show vertex ticks.
The same ptoblem appears if you apply an "edit spline" modifier onto your spline and activate the "show vertex ticks" option...

As a workaround, you can add an "edit spline" mod on top of the "Normalize spl.2",
activate the vertex sub-object, go back to "Normalize spl.2" and toggle on the "show end result" button.

Otherwise, I'm sorry but we just have to wait for the next product updates !

Best regards.

Wonderful

jewboy · 2013-01-03

Thank you for the script! This is seriously needed in Max and I have no idea why a simple but very useful tool that has been in Maya for a long time is still not in Max.

asymptote · 2012-07-03

Thx barigazy, that fixed it.

What a cool little script this is, we're lucky to have you guys fix crap AD just don't care about anymore.

thanks

asymptote · 2012-07-03

This is great, much more accurate than standard normalize spline. but why the 1000 segment limit ? Is there any way to increase this ? I am trying to keep the distance uniform over a large spline and don't want to start breaking the spline up to get more segments in.

tia

barigazy · 2012-07-03

Just open the script and in line 8 change range to be greater then 1000
something like range:[1,1e6,10]

cibine · 2012-06-19

i'm on 2012x64 when i run the script nothing appends.i try with different version, it does the same when superior to 1.5 and i got this error when running 1.5

-- Error occurred during fileIn in #C:\Downloads\normalizespline_v1.5.mse; line number: 1
-- Error occurred in anonymous codeblock; filename: C:\Downloads\normalizespline_v1.5.mse; position: 217; line: 1
>> MAXScript FileIn Exception:
-- Runtime error: Plugin redefinition: cannot change class ID. NormalizeSpline <<

"Plugin redefinition : cannot change class ID"

LittleLordPotala · 2012-06-19

If you have this error, that mean that one version of the script is already loaded in memory, so you cannot load another version. You are trying to load two versions of the same script.
The solution is :
-first, if you have a copy of the script in the "\scripts\startup" folder, just delete it
-then, before loading any new version of the script, you have to restart 3ds Max

Now it works.

stealthx · 2012-05-25

Thank you for great script and so fast update!

closed spline

stealthx · 2012-05-23

Should it work with closed spline?

Updated script

LittleLordPotala · 2012-05-24

Now, it should work correctly with the closed splines and the last version 1.6

You can try it and feel free to give some feedback...

Best regards

hi!

harumscarum · 2011-11-30

thanks for modifier but is it works inside out. here i attach illustration what i mean - when i need 200 points on the spline do ш have to apply modifier and turn it off?

It's weird...

LittleLordPotala · 2011-11-30

As you can see on the attached files, I have not this problem and I execute the same script. I tested it with editable splines and lines. I don't need to add any modifier on it.
I think the problem could come of a conflict between the classID of the script and
another plug-in in your modifiers list.

I changed the script with a new classID, you can try it now.
(The version is still 1.4 and you will have to restart 3ds max before launching this version)

And of course, don't execute diferent versions of the same script in same time.
For your information : I made and I tested the script on 3ds max 2012 64bits sp2

Best regards.

Attachments

hi!

harumscarum · 2011-11-30

thanks for modifier but is it works inside out. here i attach illustration what i mean - when i need 200 points on the spline do ш have to apply modifier and turn it off?

Attachments

thank you for update

harumscarum · 2011-11-29

just tested latest version i'm really missing plugin, but I understand these limitations. unfortunately don't get how optimization works - is it affecting only one (first) point?

About the optimization

LittleLordPotala · 2011-11-29

It calculates the angle (between 0° and 180°) of each point relative to its adjacent points.
It doesn't take in account the tangent of the curve.
So, on a line with a lot of points, the angle will be often between 150° and 180°
and if you choose to keep points with angles > 30°, almost nothing will happen
because the angles are much higher.
I'm still searching a way to put all this in the modifier list and to optimize
while taking in account the tangents.

Best regards.

simple and useful - thank you!

harumscarum · 2011-11-25

and i have some suggestions if possible:

- keep base points with threshold in degrees (for example if 30 - it will keep all points which have 30 and more degrees between segments)

- EQUAL MODE (all segments are same length with the value closest to a given. for example - base segments are 6m, 9m and 13m - so first one is 3 segments by 2m, second is 5 segments by 1.8m and third is 7 segments by 1.857m

Good ideas

LittleLordPotala · 2011-11-25

I will see if it's possible.
Notice that the scripted plug-ins have more limitations than
the normal scripts.
Anyway, I'll try.

It seems really buggy.

Script_Butler · 2011-11-24

Hi.

I've just been using your script and every time i change the Seg number max just hangs and i have to crash it out to close it.

I get no error messages at all......

Script corrected

LittleLordPotala · 2011-11-25

Thank you for the bug report.
I corrected it and it works on my system 3ds max 2012 64bits sp2 (+win 7 64bits).