- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I once needed to find out the length of a spline using Maxscript and assign its value to a variable. I'm very bad at Maxscript, so the advice I found was either to use curveLength() or to use the following code:
local a = getSegLengths spline01 1
local b = a.count
a[b]
As I understand it, both of these options produce the last value in the vector, which is the sum of all elementary lengths. But in the course of my research, I had to manually do a summing loop:
for i = 1 to b-1 do
(
y = a[i]
sum += y
format "%\n" a[i]
)
sum
As it turned out, the value of sum was not equal to that obtained by the first two methods, but the values were close, the relative error being in the order of 1-2%. Moreover, even outputting the data array with the format "%\n" a[i] string and summing the values in Excel resulted in the same value as in sum.
In this regard, I have a question: either I am not correctly finding the spline length manually, or the first two functions, as well as the value in the tab Utillites - Measure - Lenght are lying.
Solved! Go to Solution.