Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: eqko on August 11, 2023, 01:18:32 pm

Title: Brazillian Brick / alternating brickwidth between fixed start /end bricksize
Post by: eqko on August 11, 2023, 01:18:32 pm
I've (again) been breaking my limited mathskills on this one.
I am trying to accomplish this attached image.
(https://forum.itoosoft.com/index.php?action=dlattach;topic=9254.0;attach=21080;image)
I have 3  brick sizes, let's call them A, B and C ... actual sizes being 20cm, 15cm and 10cm.
on Y row 1 I start and end with A, alternating to C/A inbetween, ending again in A (with the second last being C) so ACACACA for instance
On row 2, I start with B, then alternating A/C ending in B again (with the second to last being A) so BACACAB
then on 3 I do the first sequence again and so on and so forth.

I just can't seem to figure out how to make sure that between the fixed start and end brick, I always have A or ACA (or C/CAC) so always an uneven number of bricks.

This is the current AArithmetic Expression I'm using to add adaptive width to a preset grout size (trying to use variable groutwidth to force fixed bricksizes)
Code: [Select]
return
if (
    SegmentYCounter==1,
        if(
            mod(XSectionLength-(2*input1),(input1+input3)) == 0,
            mod(XSectionLength-(2*input1),(input1+input3)) / floor((XSectionLength-2*input1)/(input1+input3)),
            mod(XSectionLength-(3*input1),(input1+input3)) / floor((XSectionLength-(2*input1))/(input1+input3))
        ),
        if(
            mod(XSectionLength-(2*input2),(input1+input3)) == 0,
            mod(XSectionLength-(2*input2),(input1+input3)) / floor((XSectionLength-(2*input2))/(input1+input3)),
            mod(XSectionLength-(2*input2),(input1+input3)) / floor((XSectionLength-(2*input2))/(input1+input3))
        )
);

Any help wouild really be appreciated. I've attached the maxfile I'm using for this setup.

*ps, is it possible to be able to use variables in expression to get better readable code eg
Code: [Select]
remainder = mod(XSectionLength-(2*input1),(input1+input3))
amount = floor((XSectionLength-2*input1)/(input1+input3))
return remainder/amount;
Title: Re: Brazillian Brick / alternating brickwidth between fixed start /end bricksize
Post by: Dragan on August 11, 2023, 01:40:39 pm
I have a macro doing similar.
It uses only one brick as input and you just set a spacing.
It can be controlled by to splines or a spline+size

Title: Re: Brazillian Brick / alternating brickwidth between fixed start /end bricksize
Post by: eqko on August 11, 2023, 02:08:47 pm
Hi @dragan I don't think it's really applicable to my case because of the fixed start end bricks and the other fixed bricksizes.
But I'll see if I can pilfer some ideas/math and apply that to my needs.
Title: Re: Brazillian Brick / alternating brickwidth between fixed start /end bricksize
Post by: Paul Roberts on August 11, 2023, 03:31:49 pm
Here's a version that might be of use. The only slight issue is that there's a gap at the start and end of the spline, but I assume you can compensate for that. I can fix it by nesting the generator, but I didn't think it was worth the performance hit.

(https://forum.itoosoft.com/railclone-pro-(*)/brazillian-brick-alternating-brickwidht-between-fixed-start-end-bricksize/?action=dlattach;attach=21084;image)

The main difference in my style is that I have used minimal expressions and X Evenly to create the pattern. The other interstitial bricks are scaled, so you'll need to be sure that your spline is a multiple of the brick lengths is maintain the size is important.

I hope that helps, let me know if you need anything explained in more detail.

Paul
Title: Re: Brazillian Brick / alternating brickwidth between fixed start /end bricksize
Post by: eqko on August 16, 2023, 10:52:46 am
Thx for that Paul.
It works for our purpose.