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

using repeat command

Anonymous
Not applicable
First time using GDL (I was brave after a masters of archiCAD video)

im trying to do a if and repeat command.

if (no_pan_0-sla_pan_0)>0 then

i=1
repeat
gosub 20
add2 pan_m,0
i= i+1
until i>(no_pan_0-sla_pan_0)

endif

it works perfectly in 2D as left hand side of image shows but in 3D it doesn't. The object is for a kit of parts that the client has designed and so it can have a comination of panel types. Hence the if and repeat.

the best the 3D gets is one of each panel type.

Any assistance greatly welcomed.

Untitled-1.jpg
4 REPLIES 4
sinceV6
Advocate
Hi.

You are just showing the 2D script, right? (I only see ADD2)

Remember that 2D script and 3D script are different things. You might get by with one REPEAT cycle in 2D, but in 3D you may need more to accomplish what you want. You may be missing some coordinate transformations to correctly position the panels in each iteration.

Other than that, is difficult to know how you want the object to work.

Best regards.
Anonymous
Not applicable
SinceV6

code posted was 2d sorry. 3D repeat code is:

if (no_pan_0-sla_pan_0)>0 then

i=1
repeat
gosub 20
addx pan_m
i= i+1
until i>(no_pan_0-sla_pan_0)

endif

the transformations to the next screen works otherwise the slatted panel would be over or further from the solid one.

I have a sub set for each type (slatted or solid) and I want the script to be able to repeat that sub for however many times it needs. So if in the future we can have a 6 panel long leg then I just change one small bit of code.
David Maudlin
Rockstar
tlodge:

One thing to check is the subroutine 20, to make sure it is not deleting the Add command or assigning "i" a different value.

You can zip and then post the object here, debugging is much easier when the entire code and parameters can be seen.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Anonymous
Not applicable
David

there was a repeat in the sub codes which used i. Simply changing the this to J in the 'main' script resolved the issue.

Lesson use a different letter for each Repeat.

Many Thanks