Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.
SOLVED!

Passing Global settings from Library Global settings to Object

vdentello
Advocate
Hello!

That's something i've been trying to make work for a reasonable while but without success. I've checked all other posts, opened many local libray objects, but still, something is off.

I've created a object and set it as "Documentation Element>Library Global Settings".
I'll call it ob_A

There's another object which i'll call ob_B.

In ob_A i've set a boolean parameter that can be changed through model view.
At its 2D script, i'll do:
end bool_A
(So it'll return parameter bool_A after the code)

In ob_B 2D script, i'll do "call ob_a parameters returned_parameters bool_A"

But, whenever i set a value true to bool_A through model view options, it's not pulled to ob_B.


What am I doing wrong?
Archicad User Since 2013
GDL Developer
Experimenting with API
from Brazil
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator
Your Library Global Settings object does not need to do anything in the 2D script - it can be left blank.
All it needs to do is to set the parameter and display it in the MVO settings via the interface script.

So now you have a parameter that you can change in the MVO.

In any object you want to use this setting (your object B), you must 'REQUEST' the value of this library Global parameter.
  req_zone_cat = ""
  _bSuccess = LIBRARYGLOBAL ("My_LibraryGlobals", "my_glob_lib_variable", req_my_glob_lib_variable)
  if _bSuccess > 0 then
    my_object_variable = req_my_glob_lib_variable
  else
    zone_type = "default backup value"
  endif

'bsuccess' will be 0 if it fails (i.e. Library Global variable is not there, so you can set a default value if it fails.

'req_my_glob_lib_variable" will contain the value of the Library Global Variable you are after.


This is best done in the 2D and/or 3D script of object B, as it is what they call view dependent.
You can use this in the master and/or parameter script, but it is not wise to try to set an object parameter to this value as the parameter script of your object is not run when you change the MVO value - you must open the settings and OK to force it to update.
The 2D and 3D views however will update based on the change of the MVO setting.

I hope this makes sense.
It took me a little while to get around this.

Barry.
One of the forum moderators.
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

View solution in original post

3 REPLIES 3
Lingwisyer
Guru
Edit: Woops. I got confused by the names, call and the whole 2D script thing... Whelp...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Solution
Barry Kelly
Moderator
Your Library Global Settings object does not need to do anything in the 2D script - it can be left blank.
All it needs to do is to set the parameter and display it in the MVO settings via the interface script.

So now you have a parameter that you can change in the MVO.

In any object you want to use this setting (your object B), you must 'REQUEST' the value of this library Global parameter.
  req_zone_cat = ""
  _bSuccess = LIBRARYGLOBAL ("My_LibraryGlobals", "my_glob_lib_variable", req_my_glob_lib_variable)
  if _bSuccess > 0 then
    my_object_variable = req_my_glob_lib_variable
  else
    zone_type = "default backup value"
  endif

'bsuccess' will be 0 if it fails (i.e. Library Global variable is not there, so you can set a default value if it fails.

'req_my_glob_lib_variable" will contain the value of the Library Global Variable you are after.


This is best done in the 2D and/or 3D script of object B, as it is what they call view dependent.
You can use this in the master and/or parameter script, but it is not wise to try to set an object parameter to this value as the parameter script of your object is not run when you change the MVO value - you must open the settings and OK to force it to update.
The 2D and 3D views however will update based on the change of the MVO setting.

I hope this makes sense.
It took me a little while to get around this.

Barry.
One of the forum moderators.
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
vdentello
Advocate
Finally! Thanks, Barry! I could get it to work! I Did a little different than you said, yet it worked as i wished!
 
  _bSuccess = LIBRARYGLOBAL ("My_LibraryGlobals", "my_glob_lib_variable", req_my_glob_lib_variable)
  if _bSuccess > 0 then
    my_object_variable = req_my_glob_lib_variable
  else
    my_object_variable = "default backup value"
  endif
Used "my_object_variable" as desired

After finding out about "_bSuccess = LIBRARYGLOBAL" i could find a topic answered by Dominika Bobály inside the GDL forum that also pointed to the GDL center section referring to that subject. That will also be helpful!
https://gdl.graphisoft.com/tips-and-tricks/model-view-options-in-general
Archicad User Since 2013
GDL Developer
Experimenting with API
from Brazil