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

how to pass a whole array to a geometry functions?

Anonymous
Not applicable
Hey everyone,

is it possible to pass all values from a one dimensional array to a geometry generating function without referencing the index of each single element?

simple Array:

dim sides[]

for i=1 to 3
verts = i
next i
This is possible:
block verts[1], verts[2], verts[3]
But i want to pass the whole array at once something like this (not possible):
block verts
This would be extremly helpful for more complicated geometry functions like the tube function. Example:
TUBE 4, 7, 16+32,
	
	0,	0,	0,
	-0.5,	0,	0,
	-0.5,	-0.5,	0,
	0,	-0.5,	0,
	
	0 +0.2,	0,	0,	0,
	0,	0,	0,	0,
	0,	2,	0,	0,
	1,	2,	0,	0,
	1,	0,	0,	0,
	0,	0,	0,	0,
	0,	0+0.2,	0,	0

For these i would like to just pass an array with the right values (for example different profiles) that can vary in length. Does someone know how this can be achieved? Thanks in advance!
4 REPLIES 4
David Maudlin
Rockstar
el_flamenco:

I don't have the answer (maybe the Put and Get functions), but you should also post the query at GDL Center Forum, the GDL developers follow this forum.

You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this forum.

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
Thanks David i wasn't aware of the special forum for the gdl center, i will try my luck there.
Jochen Suehlo
Moderator
Yes, you can use PUT and GET, and No, you cannot use an array as whole in a 3D command (as far as I know).
You can write something like this:


DIM x_g[6]: DIM y_g[6]

x_g[1]=100		:		y_g[1]=0
x_g[2]=0		:		y_g[2]=0
x_g[3]=0		:		y_g[3]=10
x_g[4]=10		:		y_g[4]=10
x_g[5]=10		:		y_g[5]=0
x_g[6]=0		:		y_g[6]=100

GOSUB "tube_4eck~"

END

"tube_4eck~":

PUT			0,0,0,		!Profil
			0,1,0,
			1,1,0,	
			1,0,0,
			0,0,0	

profpoints = NSP/3
!-----------------------------
FOR ii = 1 TO VARDIM1(x_g)
     PUT			x_g[ii],			y_g[ii],			0,		0	
NEXT ii

pathpoints = (NSP - profpoints * 3)/4
!-------------------------------

BODY -1
TUBE profpoints, pathpoints, 1+2+4+8+16+32,
GET(NSP)
BODY -1


RETURN
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Lingwisyer
Guru
There is an example object utilising Tube and Put / Get commands. There is a link to it in this thread. Do not recall where the original link is...



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660