Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.
SOLVED!

How to replicate elements by two axes

Anonymous
Not applicable
Hi there,
i'm new to gdl

I'm trying to make a brick wall.
I want to replicate bricks along the "z" and "x" axes with "do ... while", but I can only do this along one of the axes.
Here is my example:
xb = 0.25
yb = 0.12
cb = 0.065
sb = 0.01

movex = xb+sb 

lenA = (A/xb+sb) - fra(A/xb+sb)+1
if fra(B/xb+sb)<=0.5 then
lenH = (B/xb+sb) - fra(B/xb+sb)
else
lenH = (B/xb+sb) - fra(B/xb+sb)+1
endif

gosub "brick"
del 1
addx movex
gosub "brick"

end

"brick":

movez = cb+sb
i= movez
ii=0

do

if fra(ii/2)>0 then

addz i
brick xb,yb,cb
del top

else

add xb/2,0,i
brick xb,yb,cb
del top

endif

i = i+movez
ii=ii+1

while i<=lenH

return


How can I replicate elements along the x axis?
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Nader Belal
Mentor
ohh I see

there is no xb in your code, it's as if you haven't defined it's value
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

View solution in original post

4 REPLIES 4
Nader Belal
Mentor
Hi there,

1. First, there is a section in the GDL reference manual about scripting style, I advise you to read it and apply it as you can, since it will help with script readability.

2. Second, this is pseudocode so that you can apply it:

rBrickLength : Brick length parameter
rBrickHeight : Brick height parameter
rBrickWidth : Brick width parameter
rJointWidth : Brick mortar width parameter (assume that its width will not change in the X o Z axis)

rWallLength = Wall final length parameter (desired parameter)
rWallHeight = Wall final height parameter(desired parameter)

_rWallLength = Wall total length at a given point of the iteration variable
_rWallHeight = Wall total height at a given point of theiteration variable

_rBrickStepLength : is the brick length + brick joint width variable
_rBrickStepHeight : is the brick Height + brick joint width variable



_rWallLength = 0.00		!<-- to initialise your variables
_rWallHeight = 0.00

do
	addz _rWallHeight

	do
		add _rWallLength

		brick rBrickLength, rBrickWidth, rBrickHeight

		_rWallLength = _rWallLength + _rBrickStepLength
	while  (_rWallLength +  _rBrickStepLength ) < rWallLength

	_rWallLength = 0.00

	_rWallHeight = _rWallHeight + _rBrickStepHeight 
while (_rWallHeight +  _rBrickStepHeight ) < rWallHeight

Your bricks will be stacked on over another in a perfect stacked bond
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Nader Belal
Mentor
for s stretcher bond you will need extra variables

_iXRowIndex: Integer number for brick layed
_iZRowIndex: Integer number for row index

_rHalfBrickLength : Half brick index


_iXRowIndex = 1
_iZRowIndex = 1

do
	if ((_iXRowIndex mod (2)) > 0) then addz _rWallHeight
	if ((_iXRowIndex mod (2)) < 1) then addz _rHalfBrickLength, 0.00, _rWallHeight

	do
		add _rWallLength

		brick rBrickLength, rBrickWidth, rBrickHeight

		_rWallLength = _rWallLength + _rBrickStepLength
	while  (_rWallLength +  _rBrickStepLength ) < rWallLength

	_rWallLength = 0.00

	_iRowIndex = _iRowIndex + 1
	_rWallHeight = _rWallHeight + _rBrickStepHeight 

	if ((_iXRowIndex mod (2)) < 1) then addx -_rHalfBrickLength
while (_rWallHeight +  _rBrickStepHeight ) < rWallHeight

A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Anonymous
Not applicable
Thank you for your reply

Sorry, but maybe you misunderstood my question.

You rewrote my code in readable form, but my code worked like this.

The result of his work in the screenshot. The problem is that I can't duplicate all the elements along the X axis. Only the first element is duplicated
Solution
Nader Belal
Mentor
ohh I see

there is no xb in your code, it's as if you haven't defined it's value
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.