I apologize for not knowing how to word the title properly – still starting out with GDL. I just need pointed in the right direction.
Say I'm creating a SLAB in GDL. And let's say that I want to create a variable number of nodes (n = variable). Obviously, if I change the number of nodes from 3 to 4, then AC is going to be looking for 3 additional parameters (x4, y4, z4) which aren't there. Or, if reducing the number of nodes, then it will see too many parameters.
What's the best approach for inserting/removing these additional/unnecessary parameters?
On a related note: Is it possible to somehow insert a few lines of code halfway through a command, and have AC recognize the inserted lines as part of the command? My first thought to resolve this issue was to use a GOSUB within the SLAB command (after defining the number of nodes and height, but prior to defining the xyz coordinates of the individual nodes) that would insert the desire list of parameters (including commas and all), but "Keywords can't be used as variables".
Thanks In Advance,
For adding nodes you use "dynamic array" parameters. Any parameter can be made into an array by turning on the array function.
You can have 1D or 2D arrays; 1D being a 1 column with multiple rows of values and 2D being multiple columns and rows. The examples above are both 2D.
You then set this array to grow and shrink based on the number of nodes by using a loop statement in the master/parameter script. Using the values in the image above would look like this (note I have 6 columns but you only need 3 (x, y, z)) :
xNde = 1
yNde = 2
zNde = 3
for i = 1 to qNodes_MuPr_2
if i > vardim1(nodes_MuPr_2) then
_nodes_MuPr_2[i][xNde] = 0
_nodes_MuPr_2[i][yNde] = 0
_nodes_MuPr_2[i][zNde] = 0
_nodes_MuPr_2[i][xNde] = nodes_MuPr_2[i][xNde]
_nodes_MuPr_2[i][yNde] = nodes_MuPr_2[i][yNde]
_nodes_MuPr_2[i][zNde] = nodes_MuPr_2[i][zNde]
nodes_MuPr_2 = _nodes_MuPr_2
parameters nodes_MuPr_2 = nodes_MuPr_2
If you download one of the objects in my signature you can experiment. The top and bottom shapes are all likes this in the objects.
x1=0.0 : y1=0.0
x2=1.0 : y2=0.0
x3=1.0 : y3=1.0
x4=0.0 : y4=1.0
put x1 , y1 , 15,
x2 , y2 , 15,
x3 , y3 , 15,
x4 , y4 , 15
prism_ nsp/3, 1 , get(nsp)
Could you utilise the Dynamic Polyline object floating around on here?
So sorry for the delayed response everyone! Work picked up, and I had to set aside the non-billable GDL work (you all know how it is).
These are all fantastic suggestions. It's really great to have such an active community for such a niche topic! I've got some tinkering to do, but should have everything I need to get started.