ScriptSpot

Forum topic · General Scripting

Measuring and adjusting splines?

By WillyWonka · 2007-09-17

Description

Does anyone know of any existing script or the math to adjust the size of a circular-like spline to have a user specified circumference?  I want the user to type a length in and then adjust the size of the spline so it adjusts to that length but keeps its shape.

 

or

 

Does anyone know how to properly measure the length of a spline? Right now I measure it and I get a decimal number back which is useful for comparing against another spline, but it doesn't seem to be in max world units.  I know it's 30-40 inches long but it's returning a 0'0.06" when I try to format the values using the units commands.

 

 

Comments (2)

fatamus · 2008-11-21

TO: Measuring and adjusting splines?

PI = 3.1415926535897932384626433832795

(WE WILL USE: PI = 3.1416; 2 * PI = 6.2832)

circumference = 2 x PI x radius

so radius = circumference / 2 * PI

Example: I wont a circle of 357.2 cm of circumference.

radius = circumference / 2 * PI
radius = 357.2 / 6.2832

So, you must set the circles radius to.
RADIUS = 56.8500

WillyWonka · 2007-09-18

I figured it out.  You need to read in the length of the selected edges, then take the desired length and divide it by the calculated length.  That will give you a scale factor with which you can scale with to get to the proper size.