## how to pass a whole array to a geometry functions?

Home Forums Problems and solutions in GDL 3D modelling how to pass a whole array to a geometry functions?

• Author
Posts
• #4354
Tim Haering
Participant

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] = i
next i``````

This is possible:
`block verts[1], verts[2], verts[3]`

But i want to pass the whole array at once e.g. 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!

• #4355
Péter Baksa
Keymaster

Hello,

here is the technique that you need: How to use parameter buffer for polygons?

Péter Baksa
Library Platform, Software Engineer
GRAPHISOFT SE

• #4356
Tim Haering
Participant

Ok i guess it was a pretty basic question that should have a description in the docs since it is very useful. In the end i found a solution using the put and get() methods. I dump the values to the buffer using put and then the tube command looks something like this using the get() method. Like this the user can basically extrude any shape with any amount of vertices he likes just by changinge the shape in the UI.

``````tube num_verts, 7, 16+32,

get(num_verts*3),

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``````

Edit: Thanks Peter for pointing me to the documentation on this!