We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-07-20 09:43 AM
I have a label that I have setup to only run associated to a door. When not a door, it ends quite quickly with a warning message. This it turn creates a problem in the library editor because it is not yet associated with a door. I can have a variable that I turn on temporarily while coding but wonder if there is a global variable or request I can use to see if the script is run in the library editor and therefore automate it.
GLOB_ELEM_TYPE can't be used because it is 0 both when not placed AND when as an independent label.
2023-07-20 09:52 AM
I haven't used, but possible it works:
GLOB_DIAGNOSTICS_MODE together with Developer Menu.
or GLOB_CONTEXT = 1 (but it is depracted and only works in 2D, 3D and UI)
2023-07-20 02:29 PM - edited 2023-07-22 07:53 AM
Thanks Joachim,
I used to use glob_context back in the day but worry it is deprecated now so might be unstable.
I was looking into glob_diagnostic_mode with the developer menu but couldn't work it out. Will look into it further.
2023-07-21 01:05 AM
Got the GLOB_DIAGNOSTICS_MODE working. But only works outside of library editor.....
2023-07-28 11:47 AM - edited 2023-07-28 11:50 AM
Hi,
Archicad Library uses this:
bDefaultElem = (GLOB_INTGUID = "" | GLOB_INTGUID = "{00000000-0000-0000-0000-000000000000}")
_isEnabledContent = (bDefaultElem | GLOB_ELEM_TYPE = ...)
if not(_isEnabledContent) then
... ! show message on plan / UI
end
endif
2023-08-04 08:01 AM
Thanks Peter, this works in the library editor. But it also turns on the default element type when the user has not yet placed the label as a GUID has not yet been assigned. Ideally I want it to trigger in the library editor only. GLOB_DIAGNOSTICS_MODE seems like the best method if it worked in the library editor also. Would be good if this made it into an update.
2023-08-04 03:09 PM
There is a very stupid workaround:
Make a new parameter called AC_ProgramVersion
(type being "integer").
As soon as the object is placed a number (e.g. 26) will be assigned, so you can just test if that param is zero.
2023-08-17 09:20 AM
Try GLOB_PREVIEW_MODE, it is 1 in the settings dialog, and 0 in GDL editor. I am not sure it works according to your needs with the infobox and favorites.
2023-09-15 03:07 AM
Thanks @runexel, sorry for the delayed response, nice workaround for managing placement, will use this for other instances. In my case I want to be able to initiate some code when in the library editor but turn off for the user, be it placed or not.
2023-09-15 06:58 AM
Sorry for the late reply, thanks @Peter. I just did a quick test, I put this line of code in the 2d script
if GLOB_PREVIEW_MODE = 0 then text2 0,0,"GDL Editor only."
the text appeared in plan view also (outside of gdl editor).
I think i give up, I will just comment in and out what I need to do while coding and rely on QA to ensure commented out in final release.