Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: Guillermo Leal on July 17, 2015, 02:06:34 AM

Title: Material from Spline ID ?
Post by: Guillermo Leal on July 17, 2015, 02:06:34 AM
i have an stadium in which i need certain chairs to be an specific color, i would like to drive the color from the spline id's. is it possible?

thanks,
Guillermo Leal
Title: Re: Material from Spline ID ?
Post by: Paul Roberts on July 17, 2015, 09:50:54 AM
Hi Guillermo,

This can be done in a couple of ways. You could change the Material IDs of a single chair to the ID of the spline section by wiring an Arithmetic operator with the expression XSplineMatID to a Material operator''s From and To inputs.

(http://i.imgur.com/27I0JOQ.png)

Alternatively if you'd like different geometry as well as materials for each material ID you could create a number of different chairs and attach them to a Selector operator with the mode set to Spline Mat.ID

(http://i.imgur.com/x0cFyLE.png)

Either approach will work. You also have the ability to limit an entire generator using material IDs if necessary - you can read more about that in our online documentation (http://docs.itoosoft.com/display/RAILCLONE/1D+arrays+-+Generator+L1S#id-1Darrays-GeneratorL1S-Limits).

I hope that helps, please let me know if you have any further questions.

Many thanks,

Paul
Title: Re: Material from Spline ID ?
Post by: Guillermo Leal on July 17, 2015, 04:24:25 PM
Paul,

thanks for the replay, this works with an object that has a single id but how would you do this on an object with multiple ids, for example the seat stand 04 f preset?

Guillermo Leal.
Title: Re: Material from Spline ID ?
Post by: Paul Roberts on July 17, 2015, 05:01:26 PM
Hi Guillermo,

The material operator allow you to choose which Material ID you wish to replace, so in the case of the 04 f preset we need to enter a value of 6 as this is the ID used for the seat colour.

(http://i.imgur.com/cD5Mqbr.png)

You can then either change the IDs on the splines as in the previous example, so that they use the correct Material IDs from the Multi-Sub object material. Alternatively you could use IF statements to map the spline's IDs to a different number. An example of an expression that map Spline IDs 1 - 3, to material IDs 6-8 would look like this:

Code: [Select]
if(XSplineMatID=1,6,
if(XSplineMatID=2,7,
if(XSplineMatID=3,8,1)))

(http://i.imgur.com/YOE4jjZ.png)

I've attached this example below. I hope that helps, please let me know if you need anything else.

Many thanks,

Paul
Title: Re: Material from Spline ID ?
Post by: Guillermo Leal on July 17, 2015, 05:52:27 PM
Excellent Paul, thanks.

wish there were more tutorials/info on expressions.

Guillermo Leal.
Title: Re: Material from Spline ID ?
Post by: Paul Roberts on July 17, 2015, 06:01:43 PM
Hi Guillermo,

No Problem, Glad it helped out. We have plans to release an Expressions primer in the the near future that will hopefully make this all clearer.

Many thanks,

Paul