# ### Author Topic: Tiled Roof  (Read 826 times)

#### KU2149

• Newbie
• • Posts: 11 ##### Tiled Roof
« on: December 07, 2017, 09:31:53 AM »
I have been using the roof tile macro which is a pretty neat system. The question i ask is can you slide the tiles in the Y direction.  The inbuilt slate tile always has a large tile as the first one near the ridge. If i attempt to adjust with expand the tiles then are never capped on the side which then prevents me from working like this

#### Paul Roberts ##### Re: Tiled Roof
« Reply #1 on: December 08, 2017, 01:18:30 PM »
Hi,

Thanks for the message. Expand works by extending the size of the array using a percentage, but unfortunately, as you've pointed out, it does this on both the X and the Y axis.

One solution therefore is to add some padding on the left/right or top/bottom segments to compensate for the padding and move the array on one axis only. To do this we can use some simple maths and build a new macro. Basically we need to convert the Expand percentage value into a measurement in scene units, and then use this to add padding to the boundary segments. To do that we need to find out what the size of the array was before the expand value was applied. To find the original size you divide the current size by the current percentage to find the value for 1%, and then multiply it by 100. In an Arithmetic node we can write an expression to find this value and add it to a variable called OriginalSizeX (Input1 is the expand value)

real originalSizeX = (XSplineLength/(100+Input1))*100;

Now we need to find out the size in scene units that the array has been offset. To do that simply multiply the original size of the array by the Percentage. I've divided the percentage by 200 in the example below because the offset is shared over both sides

return originalSizeX*(Input1/200);

You can then wire this to the Left Padding on the segment in the Left input of the array, and the Right padding of the segments in the Right input and the expand property will only affect the Y axis. I will add this in a macro to future builds of RailClone.

Additionally you can create the same effect for the Y axis as well, but apply it only to the Bottom input. In that way you can use the expand property to add tiles only on the top row of the roof. The example attached to this post uses that technique.

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

Thanks,

Paul

Paul Roberts
iToo Software