2022-02-13 07:11 PM
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,
-Ben
2022-02-13 11:57 PM
Hi Ben,
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
dim _nodes_MuPr_2[][]
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
else
_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]
endif
next i
nodes_MuPr_2 = _nodes_MuPr_2
parameters nodes_MuPr_2 = nodes_MuPr_2
2022-02-14 03:22 AM
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.
2022-02-14 11:07 AM
Hi Benji_W
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)
2022-02-14 11:34 AM
Could you utilise the Dynamic Polyline object floating around on here?
Ling.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2022-02-14 12:37 PM
2022-02-27 10:47 PM
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.
-Ben