BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Wishes
Post your wishes about Graphisoft products: Archicad, BIMx, BIMcloud, and DDScad.

Add Static Variables to GDL

Anonymous
Not applicable
Let me explain what i mean. Imagine you have a line.
You put 2 hotspots (moveable-strechable) so you can modify the line.

Imagine now you have a parameter to define how many points you want to divide your line. Let that be N. You then put N moveable-stretchable hotspots. You can move them around. Ok till here (we have a simple polyline)

Now the bad part. If you use an initialisation part in the master script (for example if you hold the x,y,z coord of the points in an array and you give some initial values at the beginning, then Changing the number of the paramater "points" will result in running master script again, thus loosing ALL previous data. (all points would be given their initial coords from master script)

It would be great if i could define smths like

STATIC PARAMETERS variable_name = value
if the interpreter see that code it will give assign the value only the FIRST time the code is run when the object is first created.

Hope i explained it well
5 REPLIES 5
TomWaltz
Participant
It's not easy to do, but the solution to that problem is to create a second array that has the contents of the array at the beginning of the script, that is then re-copied to the original array.

You can also get rid of your DIM statements once the parameter list is made. You don't need to reinitialize the array every time. I get stung on that one a lot because I forget to comment them out.

Does that make sense?
Tom Waltz
Anonymous
Not applicable
what you propose has meaning if you are trying to do a certain structure.
If you are trying to make an abstract gdl object you cannot comment those.

If i could declare a variable as Static, i could do magic!
Let me give you an example

Imagine you have a simple cube. And you create a hotspot so you can move it in 3d and also a hotspot so you can rotate it.

If i could delcare a variable as STATIC i could create an array that would TRACK the movement of the cube. I mean it will store the x,y,z (and rot angles) of its movement. How? its time i change the position of the cube the script is reexecuted. A counter would increase (to count the number of times the cube has moved) and the new position would be recorded at the Position array at [counter] index.

Why all tha fuss? If i have all that data, i could actually create an extruded object following the cube!!

This is just a simple application of how a static variable would help gdl programming

Ofcourse i could workaround that part by using files (i am going to try that by the way)
Rob
Graphisoft
Graphisoft
oreopoulos,
I am not sure if I can understand it correctly but are you after a sort of permanent data buffer linked to each individual lib. part, is that right?
if so, it would be really useful. May be GS guys could extend the functionality of existing GET,PUT,USE commands with options like CREATE PERMANENT BUFFER and KILL PERMANENT BUFFER to avoid possible memory allocation problems I guess...
::rk
TomWaltz
Participant
Seeing your description, you could still build an array that has one value added to it every time a parameter is changed...

It would not be built in as easily as you describe, but it is possible.
Tom Waltz
Anonymous
Not applicable
that is what i meant
Learn and get certified!