### Author Topic: array 2s, x-evenly, y-evenly  (Read 3358 times)

#### funk24

• Newbie
• Posts: 17
##### array 2s, x-evenly, y-evenly
« on: July 04, 2014, 08:25:56 AM »
hello
how can I solve this problem? see print screen.
for the x evenly also a start and an end (such as corner)?

greeting
stefan

#### Rokas

• iToo Software
• Hero Member
• Posts: 2150
##### Re: array 2s, x-evenly, y-evenly
« Reply #1 on: July 04, 2014, 04:24:33 PM »
could you please attach the scene?
Rokas
iToo Software

#### Paul Roberts

• iToo Software
• Hero Member
• Posts: 1721
##### Re: array 2s, x-evenly, y-evenly
« Reply #2 on: July 04, 2014, 05:11:01 PM »
Hi Stefan,

Thanks for contacting us. Though there are no inputs in the generator for the ends of the X Evenly rows, it is possible to target them using some simple conditional operations. In the style shown below I've used a selector operator and an expression to use a different segment based on the position along the Y Spline.

The selector operator (1) includes the segment used for the start, mid, and end of the column. Export the Index and then plug in an Arithmetic operator (2). The expression uses two If functions, one inside the other : if(YSplinePosition<0.05,1,if(YSplinePosition>0.95,2,3)) which is checking to see if the current segment is either near the beginning of the spline, in which case it will return the segment in index 1, or near the end, in which case it return index 2. If it's neither of those, it will return index 3. This works particularly well when a top and bottom row is also being used. Note that it may be necessary to adjust the conditional values depending on the typical height range, or alternatively it could be calculated dynamically by calculating the ratio of the segments height to the current length of the Y Spline (For simplicity I haven't shown this).

This same technique should also work in a corner input too.

I've attached this style for you to have a look at.

Hopefully that helps out, please let me know if you have further questions.

Many thanks,

Paul
« Last Edit: July 04, 2014, 05:20:03 PM by Paul Roberts »
Paul Roberts
iToo Software

#### Paul Roberts

• iToo Software
• Hero Member
• Posts: 1721
##### Re: array 2s, x-evenly, y-evenly
« Reply #3 on: July 04, 2014, 05:32:46 PM »
Here's a version that automatically calculates the value needed for the conditional expression to work. It divides the segment height by the Y spline length and uses this to detect the start and end position.

Thanks,

Paul
Paul Roberts
iToo Software

#### funk24

• Newbie
• Posts: 17
##### Re: array 2s, x-evenly, y-evenly
« Reply #4 on: July 08, 2014, 04:57:32 PM »

hi paul

now I have another question.
how can I segement in the middle?

greeting
stefan

#### Paul Roberts

• iToo Software
• Hero Member
• Posts: 1721
##### Re: array 2s, x-evenly, y-evenly
« Reply #5 on: July 09, 2014, 03:24:37 PM »
Hi Stefan,

RailClone doesn't have a way to automatically target that segment, but there is a way to achieve it with expressions. The catch is you cannot use Justify mode for the Y Evenly rows with this technique.

I've used the same technique of evaluating the segment's position on the Y Spline, Only this time using the Y Evenly distance to work out whether the current block falls on an evenly row.  To do this:

• Export the Y Evenly value and wire it to a Numeric node, this makes it easier to adjust and use in expressions
• Create a new Arithmetic operator and attach the Numeric node created in the previous step to Input 1
• I want to try and create a "switch", so that when the current segment is in a row, the arithmetic node will output "0", if it is not in a row it will output a decimal number. To do this, divide the segment's position on the Y Spline by the Y Evenly distance using a Modulo function:

mod(YSplinePosition,Input1/YSplineLength) Input 1 is the Y Evenly distance

You'll notice that I have divided the Y evenly distance by the Y Spline's length. This is because YSplinePosition returns a Scalar value (0-1), so I need to convert the Y evenly distance to match.
• This can now be used with a second Arithmetic node using an if statement to test to see if the output is 0. If it is, then the segment will be in a Y evenly Row. The Conditional statement would look like this:

if(Input1=0,1,2) Input1 is the Arithmetic node created in step 3

In reality, due to the nature of the divisors, the number is seldom likely to be exactly 0, so you can build in a slight margin for error either side of 0:

if(Input1>-0.03 & Input1<0.03,1,2)

To change the accuracy you can try different values in place of 0.03.
• The finished setup looks like this:
• To add this to the rest of list of conditional statements for the X Evenly column and try to automate the accuracy using techniques discussed earlier in this thread you'd need to use the following:

if(YSplinePosition<Input1,1,                                 Checks for Bottom Segments
if(YSplinePosition>(1-Input1),2,                           Checks for Top Segments
if(Input2>-Input3/2 & Input2<Input3/2,3,           Checks for Evenly intersection Segments
4)))                                                                       Returns this if no other conditions are true

nb
Input 1 = Brick height expressed as a scalar proportion of Y Spline Height.
Input 2 = Returns 0 (ish) if segment is a multiple of Y Evenly Distance

I've attached a revised version of the file so that you can see this working.

Another option, which might be simpler, would be to use sequence operators to place segments on the Y Axis instead of using the Y Evenly input and all the conditional operations. The disadvantage is the the rows could only be moved in increments of the segment's height (and would not be sliced), so it depends on your intended usage. The Spider Glazing tutorial used this approach to target the points at which the glass intersects.

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

Thanks!

Paul
« Last Edit: July 09, 2014, 03:32:07 PM by Paul Roberts »
Paul Roberts
iToo Software

#### Rokas

• iToo Software
• Hero Member
• Posts: 2150
##### Re: array 2s, x-evenly, y-evenly
« Reply #6 on: July 09, 2014, 03:32:40 PM »
very detailed description thank you.
It is still not to my liking the way corners and last column evenly are prepared, but i will try to make it myself.
Rokas
iToo Software

#### Paul Roberts

• iToo Software
• Hero Member
• Posts: 1721
##### Re: array 2s, x-evenly, y-evenly
« Reply #7 on: July 09, 2014, 03:45:39 PM »
Hi, Yes, I Must admit that I didn't look at the ends of the Y evenly rows, but the same principles, only using XSplinePosition instead of Y would apply to targeting the first and last segment. Using the sequence modifier will help to target the 1st segment but can't help with the last.  Attached is a file that uses these technique to get the first and last segment in the Y Evenly rows.

Cheers,

Paul
Paul Roberts
iToo Software

#### funk24

• Newbie
• Posts: 17
##### Re: array 2s, x-evenly, y-evenly
« Reply #8 on: July 09, 2014, 03:55:09 PM »

hello paul

many thanks for the great help.
I have tried to solve the problem with the spider glazing tutorial.
I will study the file exactly.