Itoo Software Forum
RailClone => RailClone Pro (*) => Topic started by: Pictor on February 04, 2019, 03:56:25 PM
-
Hi iToo and everyone,
I'm trying to calculate the number of segments required over a specific spline section length, but I cannot get the expression to evaluate correctly:
return round(XSectionLength/Input1);
Whereby "Input1" is the X size of the segment; 91.5cm in this instance. So let's say the X spline section is 1000cm:
Round(1000/91.5) - this should evaluate to 11?
This is then plugged into the counter node of a sequence operator. But is doesn't work. Any ideas what I'm doing wrong? Is the expression outputting in scene units?
Any help very much appreciated!
Tim
-
Technically all You wrote seems correct.
What is the result You get ? What result You expect ?
-
Thanks for the reply Rokas.
It's difficult to know, the print function returns 0 on both the expression, and just the XSectionLength function. Screenshot attached.
-
Quick update, plugging the same expression into the Z fixed size parameter of a transform operator, presents the correct result, the segment is 11cm high.
And plugging it into the Z Fixed Scale, again correct, it's scales 11%.
-
You probably need empty segment in the sequence operator to "kill" the next batch of segments.
If You could attach max file i could check it for You.
-
Hi Rokas, Max2016 file attached. Had to zip it up.
Many thanks for takting the time to look into this.
Tim
-
Thanks for file. Can You explain the expected result?
-
The expression is designed to calculate the number of segments required before adding the final mirrored "up kerb" along a given section, on MAT ID 2 only.
So
drop kerb down > drop kerb x N < drop kerb up
Where N is calculated from the spline section expression.
Hope this makes sense!
-
Rokas, I have it working!
real secLength = XSectionLength;
return round(secLength/Input1)-2;