Itoo Software Forum

Author Topic: for each: Rotate sequence  (Read 1371 times)

eqko

  • Jr. Member
  • **
  • Posts: 96
for each: Rotate sequence
« 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 ?

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: for each: Rotate sequence
« Reply #1 on: January 24, 2019, 10:44:04 AM »
if I understand correctly this is Your scheme in angles, right:



Then I attach You a maxfile with arithmetic doing this:


Hope this helps
Rokas

eqko

  • Jr. Member
  • **
  • Posts: 96
Re: for each: Rotate sequence
« Reply #2 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.
« Last Edit: January 24, 2019, 10:59:47 AM by eqko »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: for each: Rotate sequence
« Reply #3 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.
Rokas

eqko

  • Jr. Member
  • **
  • Posts: 96
Re: for each: Rotate sequence
« Reply #4 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.

Thanks again for your help.