Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: Pictor on February 04, 2019, 03:56:25 PM

Title: Expression evaluation help!
Post 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

Title: Re: Expression evaluation help!
Post by: Rokas on February 04, 2019, 04:17:56 PM
Technically all You wrote seems correct.
What is the result You get ? What result You expect ?
Title: Re: Expression evaluation help!
Post by: Pictor on February 04, 2019, 04:23:58 PM
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.

Title: Re: Expression evaluation help!
Post by: Pictor on February 04, 2019, 04:31:32 PM
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%.
Title: Re: Expression evaluation help!
Post by: Rokas on February 04, 2019, 04:32:45 PM
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.
Title: Re: Expression evaluation help!
Post by: Pictor on February 04, 2019, 04:50:42 PM
Hi Rokas, Max2016 file attached. Had to zip it up.

Many thanks for takting the time to look into this.

Tim
Title: Re: Expression evaluation help!
Post by: Rokas on February 04, 2019, 05:03:36 PM
Thanks for file. Can You explain the expected result?
Title: Re: Expression evaluation help!
Post by: Pictor on February 04, 2019, 05:22:29 PM
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!
Title: Re: Expression evaluation help!
Post by: Pictor on February 04, 2019, 05:54:08 PM
Rokas, I have it working!

real secLength = XSectionLength;
return round(secLength/Input1)-2;