Itoo Software Forum

Author Topic: Expression evaluation help!  (Read 1598 times)

Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Expression evaluation help!
« 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

« Last Edit: February 04, 2019, 03:58:05 PM by Pictor »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Expression evaluation help!
« Reply #1 on: February 04, 2019, 04:17:56 PM »
Technically all You wrote seems correct.
What is the result You get ? What result You expect ?
Rokas

Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Re: Expression evaluation help!
« Reply #2 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.


Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Re: Expression evaluation help!
« Reply #3 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%.

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Expression evaluation help!
« Reply #4 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.
Rokas

Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Re: Expression evaluation help!
« Reply #5 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

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Expression evaluation help!
« Reply #6 on: February 04, 2019, 05:03:36 PM »
Thanks for file. Can You explain the expected result?
Rokas

Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Re: Expression evaluation help!
« Reply #7 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!

Pictor

  • Newbie
  • *
  • Posts: 26
    • Picto Studios Ltd
Re: Expression evaluation help!
« Reply #8 on: February 04, 2019, 05:54:08 PM »
Rokas, I have it working!

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