Itoo Software Forum

Author Topic: Brazillian Brick / alternating brickwidth between fixed start /end bricksize  (Read 2571 times)

eqko

  • Jr. Member
  • **
  • Posts: 96
I've (again) been breaking my limited mathskills on this one.
I am trying to accomplish this attached 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;
« Last Edit: August 11, 2023, 01:21:21 pm by eqko »

Dragan

  • Hero Member
  • *****
  • Posts: 1473
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


eqko

  • Jr. Member
  • **
  • Posts: 96
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.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 3061
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.



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
« Last Edit: August 11, 2023, 03:36:25 pm by Paul Roberts »
Paul Roberts
iToo Software

eqko

  • Jr. Member
  • **
  • Posts: 96
Thx for that Paul.
It works for our purpose.