We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.

setting gdl globals from apx

Anonymous
Not applicable
Hello,

In my companies very customized ArchiCAD setup, we have used the glob_user global variables to share certain global data between various library parts. I have a library part that exists on every job which sets these values (I call it the 'data block'). The idea was that my apx would only need to set parameters of this one part, it populates the globals in its master script and all other library parts can use these variables.

This approach has been mostly working fine, but recently I have noticed that sometimes the global values get reset. One example being when ArchiCAD is first opened. Since the values are not there any parts that use them don't work and dimensions that run off them get deleted on the regen. I posted another example of this problem to the GDL forum last week (http://archicad-talk.graphisoft.com/viewtopic.php?t=6553) but have since thought its more of a developer issue.

Is a way to set these globals programmatically (in my apx)?
Is there a way to guarantee that on a regen the data block script will run before any other scripts?
Has anybody had similar problems?

I am thinking about removing glob_user variables completely, and either sharing using a file or maybe updating parameters of all relevant library parts on change of the data block. I'm interested of any other solutions that have worked for people?

Thanks,
Adam
5 REPLIES 5
Ralph Wessel
Mentor
adambutler wrote:
Is a way to set these globals programmatically (in my apx)?
Is there a way to guarantee that on a regen the data block script will run before any other scripts?
Has anybody had similar problems?
Have you tried calling the data block script as a macro from the objects which rely on the global values?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
This will not work because the instance of the data block on the drawing has parameters set which are used to set the globals. If I call it like a macro I will be getting the values of the default parameters.
Ralph Wessel
Mentor
adambutler wrote:
This will not work because the instance of the data block on the drawing has parameters set which are used to set the globals. If I call it like a macro I will be getting the values of the default parameters.
What if you passed the parameters of the object instance to the macro? Can it be written to set the globals according to the input it receives?

BTW, in answer to your original question; I don't know of a way to directly set GDL globals through the API. There is a separate API for GDL, but I don't know if GS is releasing it publicly or even actively developing it. I employ a technique for indirectly exchanging data between the API and GDL, but I think there may be an easier route in your case.
Ralph Wessel BArch
Software Engineer Speckle Systems
Andras Babos
Graphisoft Alumni
Graphisoft Alumni
Hi Adam,

I'm not sure I understand your problem in all its details, but here's how GDL globals are set up in AC:

- GDL globals are not stored in the plan.
- GDL globals are reset to a default value at every startup and "New and Reset".
- After startup, "New and Reset" and library change the master scripts are run (which can then manipulate the globals).

So if you want to preserve the value of a GDL global then you have to store it somewhere yourself.

HTH:
Andras.
Anonymous
Not applicable
Thanks guys for your input.

I managed to fix the problem - tracked it down to the way parameters of this object were set by my apx. I think I was restoring the default values of the library part before setting the new parameters which caused the master script to get run with outdated values. I'll have to look into the way I set parameters a bit more sometime. Its working fine now, but maybe not as efficiently as it could be.