Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: arch3d on January 15, 2019, 08:38:12 AM

Title: Expression for changing material ID
Post by: arch3d 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
Title: Re: Expression for changing material ID
Post by: Rokas 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.
Title: Re: Expression for changing material ID
Post by: arch3d 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
Title: Re: Expression for changing material ID
Post by: Rokas 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));
Title: Re: Expression for changing material ID
Post by: arch3d on January 15, 2019, 09:55:30 AM
works perfect!

thank you Rokas