BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
GDL
About building parametric objects with GDL.
SOLVED!

subroutines library / macro interpretation

s_p_b
Booster

Hi everyone,

I'm developing a library of furniture/millwork objects for my office, and for each of them I'd like to use a subroutine to set up and position a section plane, to be used together with PROJECT2 to create the millwork details right from the object. (I can't use a macro in this case, because section planes created in a macro only apply to geometry in that macro). My objects should not be duplicating the same code, so my question is whether there's a way to create a subroutine library? I had a few ideas:

  • Could subroutines be defined in a master_gdl.gdl file? I would like to try this but the rather minimal documentation gives no details of how one is actually created - Archicad's gdl editor doesn't allow saving a .gdl file, only a .gsm object. And can it be used in the project's embedded library? Or does it have to be in an .lcf library file?
  • I suppose a GDL add-on could be written similar to Polygon Operations but it seems insane to do all that just to get a library of functions. 
  • One could call a macro together with a 'sub' parameter, which will select and run a specific subroutine in the macro. Won't work with SECTION but might be useful otherwise...

The last option brings up the question of how macro calls relate to the different GDL scripts. With a bit of experimentation it appears to me that if a macro is called from a master script, then the entire macro is also called. But a macro call from a 2D script runs just the 2D script of the macro, and similar behavior with all the other scripts. Is that more or less correct? I can't find any documentation on this, but many GS objects seem to do this to set up parameters, or draw 2D symbols, for example.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

subroutines can only be called from within the object.

The third option works well, you can return values from a macro or just PUT them if they are used for the same command.

Called macro's master script is always executed. A macro could be called from 2d in one object and from 3d in another, the master script is executed in both cases, the 2d and 3d only once each.

 

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

View solution in original post

4 REPLIES 4
DGSketcher
Legend

@s_p_b Just a quick thought because I may be encountering similar challenges. I am increasingly moving away from wrestling with AC's standard 2D projection and relying more on axonometric 3D documents. For isolated objects this removes many of the 2D plan coding issues. The downside is 2D dimensioning in 3D documents is in need of a major refresh; it works but could be better. The upside is each 3D document can have its own cut plane location settings.

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Joachim Suehlo
Advisor

@s_p_b wrote:

(I can't use a macro in this case, because section planes created in a macro only apply to geometry in that macro).

 


Why is this so? Can't the cutting planes be calculated within the macro and returned via RETURNED_PARAMETERS?

  • master_gdl.file: You can create it with a Texteditor.
 I don’t think you can place a subroutine there because either the script will be processed for all objects or if you try to set a flag in the „caller“ object, this will not arrive, because the master_gdl-files were processed before all other scripts in other objects.

Have you tried it with an object from the subtype „Library Master“ which only has a Master-Script? I think it works similar to a master_gdl.file and I am afraid it has the same limitations (and unfortunately no documentation)

Try to look at examples of both types how Graphisoft uses those. Unfortunately, I have never seen a script that you have in focus. The main function of master_gdl.files is to define attributes and for library-master-files to set global VALUS-Lists.

And last: Yes the macro call from a Master-Script calls all other Scrips from the Macro and a call from any other script only calls that special script within then macro.

Joachim Suehlo . AC12-27 . MAC OSX 13.5 . WIN11
GDL object creation: b-prisma.de
Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

subroutines can only be called from within the object.

The third option works well, you can return values from a macro or just PUT them if they are used for the same command.

Called macro's master script is always executed. A macro could be called from 2d in one object and from 3d in another, the master script is executed in both cases, the 2d and 3d only once each.

 

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
s_p_b
Booster

Thanks everyone! I will go with a macro to set up the cutting plane as Peter and Joachim suggest. I didn't realize that the stack is shared between the caller and the macro, that could be useful in all kinds of ways.

@DGSketcher 
I really like axos, but the millworkers I work with still ask for conventional orthographic drawings. So I use the 3D views more as illustrations to help them understand a design. My hope is to set up a macro that takes care of all the 2D generation / section plane setup, and then the individual furniture objects should need minimal boilerplate code.

Screenshot 2022-01-11 103222.png

Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!