Itoo Software Forum

Author Topic: Expression for changing material ID  (Read 563 times)

arch3d

  • Jr. Member
  • **
  • Posts: 68
    • arch3d.pl
Expression for changing material ID
« on: January 15, 2019, 08:38:12 AM »
Hi again:)

I have expression
Mateial ID for n*2+1 - for id over 2 material ID is changing from 1 to 2

return if(mod(XSplineMatID,2) == 1,2,1);

I would like edit but i stuck - for matrial ID over 2 I would like to have:
material 1 --> ID's 1...3,4...7,8...11,12 etc
material 2 --> ID's 2...5,6...9,10...13,14 etc

thank you for help
Michal

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1867
    • iToo
Re: Expression for changing material ID
« Reply #1 on: January 15, 2019, 08:50:01 AM »
Hi

I don't understand what You mean.
Particularly what "..." means?
from how I understand logic 1...3 means [1,2,3] but that not what You mean.
Rokas
iToo Software

arch3d

  • Jr. Member
  • **
  • Posts: 68
    • arch3d.pl
Re: Expression for changing material ID
« Reply #2 on: January 15, 2019, 09:25:29 AM »
sorry for that
material 1 --> ID's 1 (then material 2 for ID =2), 3,4 (then material 2 for ID =5,6) 7,8...11,12 etc

material 1 --> ID's 1,3,4,7,8,11,12 etc
material 2 --> ID's 2,5,6,9,10,13,14 etc

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1867
    • iToo
Re: Expression for changing material ID
« Reply #3 on: January 15, 2019, 09:50:20 AM »
ok, then this:

Quote
return if(XSplineMatID==1,1,if((mod((XSplineMatID+1)/2,2) == 0)|(mod((XSplineMatID)/2,2) == 0),1,2));
Rokas
iToo Software

arch3d

  • Jr. Member
  • **
  • Posts: 68
    • arch3d.pl
Re: Expression for changing material ID
« Reply #4 on: January 15, 2019, 09:55:30 AM »
works perfect!

thank you Rokas