# Itoo Software Forum

## RailClone => RailClone Pro (*) => Topic started by: eqko on January 23, 2019, 05:25:16 PM

Title: for each: Rotate sequence
Post by: eqko on January 23, 2019, 05:25:16 PM
so I have this fence with vertical slats, spaced evenly.
It starts with an unrotated slat, then for each new slat up till 10, it rotates 5 degrees. then it rotates back for every slat up til the next 10 by 5 degrees,  then ends with an unrotated slat, then starts allover again.
(see attachement for front & topview)

Amongst other things, I was thinking of using an arithmetic node plugged into the z fixed rotation, but I can't seem to figure it out.
Math has never been my strongest suit  :-[  so expressions are doing my head in.

any ideas ?
Title: Re: for each: Rotate sequence
Post by: Rokas on January 24, 2019, 10:44:04 AM
if I understand correctly this is Your scheme in angles, right:

(https://i.imgur.com/GgsYvPR.png)

Then I attach You a maxfile with arithmetic doing this:
(https://i.imgur.com/8I5Oy6Q.png)

Hope this helps
Title: Re: for each: Rotate sequence
Post by: eqko on January 24, 2019, 10:56:52 AM
NICE ... this looks like something I can pull apart and learn from.

Any chance you could explain what's going on in the expression in laymans terms ?

In general, I didn't know you could variables in the Expression (real Id, real Sort)
what's the real for anyways ?

Thanks a lot for your help on this.
Title: Re: for each: Rotate sequence
Post by: Rokas on January 24, 2019, 11:07:27 AM
Yes You can have some variables in expression editor.
Real means float values like 0.05, -75.45, 6874864.87 well anything goes.
Alternative is int which stores only whole values: -5 - 1 0 5 7 824 etc

Well I would say this is quite complex example to start learning from it,- not that complex but certainly not the starting case for learning. Maybe my solve is not the most efficient too.
Idea is I divide current segment number from 11 (as that is the half of full repeating pattern). Then i calculate if it is among 11 items which are decreasing angle, or the other ones- with increasing angles.

Everything rest is just expression syntax.
Title: Re: for each: Rotate sequence
Post by: eqko on January 24, 2019, 11:13:51 AM
That's more than enough explanation I can figure out what's going on from that. I love it.

Cool to learn about real. I do know maxscript so I keep trying to compare it in some way.
eveyday one learns something new.