Parameter buffer and Loops
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-04-20 03:02 PM - edited 2023-04-20 04:30 PM
Hello,
I'd like to know how to improve my use of the Parameter buffer when it comes to loops because I have a loop that create a simple stack of prisms :
for N = 1 to 4
put 0, 0, 15,
1, 0, 15,
1, 1, 15,
0, 1, 15,
0, 0, 1
prism_ nsp/3, 0.5, get(nsp)
addz 0.5
next N
del 4
I feel this code is not good as I populate and clear the stack with each loop rather than populating it once, looping the geometry and clearing the stack at the end. I would like to make it better but the following snippet doesn't work :
put 0, 0, 15,
1, 0, 15,
1, 1, 15,
0, 1, 15,
0, 0, 1
for N = 1 to 4
prism_ nsp/3, 0.5, use(nsp)
addz 0.5
next N
del 4
get(nsp) ! Clearing the stack that way after the loop doesn't work
Is there a way to clear the parameter buffer without having to use get() in a command ? Or am I reduced to do this :
put 0, 0, 15,
1, 0, 15,
1, 1, 15,
0, 1, 15,
0, 0, 1
for N = 1 to 4-1
prism_ nsp/3, 0.5, use(nsp)
addz 0.5
next N
prism_ nsp/3, 0.5, get(nsp)
del 3
get(nsp)
Looks less readable but seems to be the only solution ?
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Solved! Go to Solution.
- Labels:
-
Library (GDL)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-04-20 03:41 PM - edited 2023-04-20 03:46 PM
Try to use
if NSP>0 then ttt = max(get(NSP))
Final code:
n_prism = 4
put 0, 0, 15
put 1, 0, 15
put 1, 1, 15
put 0, 1, 15
put 0, 0, 1
for N = 1 to n_prism
prism_ nsp/3, 0.5, use(nsp)
addz 0.5
next N
del n_prism
if nsp>0 then ttt = max(get(nsp))
Structural engineer, developer of free addon for sync GDL param and properties

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-04-20 03:41 PM - edited 2023-04-20 03:46 PM
Try to use
if NSP>0 then ttt = max(get(NSP))
Final code:
n_prism = 4
put 0, 0, 15
put 1, 0, 15
put 1, 1, 15
put 0, 1, 15
put 0, 0, 1
for N = 1 to n_prism
prism_ nsp/3, 0.5, use(nsp)
addz 0.5
next N
del n_prism
if nsp>0 then ttt = max(get(nsp))
Structural engineer, developer of free addon for sync GDL param and properties
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-04-20 04:00 PM
Thanks, it worked 👍
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-09-09 02:36 AM
The last get (nsp) is not needed because it does not perform any operations and only extracts data, resulting in a program error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-09-11 03:35 AM
If you only ever 'USE' the PUT stack, then the stack will remain populated.
The last 'GET' just clears the stack so you can use PUT again later if you need to.
Barry.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2024-01-11 03:33 PM
It should be possible to just use GET(NSP) to Empty the stack. While it is not, Thank you for this solution.