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

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

how to make editable GDL Script ?

Anonymous
Not applicable
!ADD2 0.5, 0.4
hotspot2 0,0
hotspot2 a,0
PEN epn
LINE2 -0.5, 0.0, a, 0.0
PEN cpn
LINE2 0.0, 0.0, -0.4, 0.4
LINE2 -0.4, 0.4, 0.4, 0.4
LINE2 0.4, 0.4, 0.0, 0.0
DEFINE STYLE "AC_STYLE_1" "arial",
100*tsize/a_, 7, 0
pen tpn
SET STYLE "AC_STYLE_1"
C=""
C=str(int((y~*100)+.5)/100,3,2)
TEXT2 0.0, 0.377143, "C "+C

this is my script. i want to make it auto editable. my c value generate automatically when i copied an object.
anyone please help me
19 REPLIES 19
Laszlo Nagy
Community Admin
Community Admin
I cannot help in greater detail because I never tackled scripting it myself, but you will need to use the HOTSPOT command in GDL.
Check in the GDL Reference Guide the "GRAPHICAL EDITING USING HOTSPOTS" section that talks about it.
There are also some examples here on the forum if you search for them. It is also possible to open a GDL Object in ArchiCAD that has this capability and check its 2D Script and 3D Script to see how it was achieved in these default Library Objects.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
Barry Kelly
Moderator
This script seems to work fine.
It will show the 'Y' value (height in elevation) and changes automatically as you drag it or place new objects.
What is it exactly that you need help with?
Barry.
height_object.jpg
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
Anonymous
Not applicable
hey thanks. let me try first
Anonymous
Not applicable
@Barry Kelly. actually i want that amount editable. it takes automatically.. but i want script where can i put my own value...for example you gave me an example take value c15.49 from them and that place can we change 15 to 17. is it possible?.. can i change my value in GUI screen? appart from coding part. directly where the triangle.
Barry Kelly
Moderator
To make it completely editable you will need to comment out the lines in the script that refer to the C parameter.
Then create a text parameter "C" in the parameter list.

Now in your object you can type any value you want - but it will not change automatically as you move the object.

hotspot2 0,0
hotspot2 a,0
PEN epn
LINE2 -0.5, 0.0, a, 0.0
PEN cpn
LINE2 0.0, 0.0, -0.4, 0.4
LINE2 -0.4, 0.4, 0.4, 0.4
LINE2 0.4, 0.4, 0.0, 0.0
DEFINE STYLE "AC_STYLE_1" "arial",
100*tsize/a_, 7, 0
pen tpn
SET STYLE "AC_STYLE_1"
!!C=""
!!C=str(int((y~*100)+.5)/100,3,2)

TEXT2 0.0, 0.377143, "C "+C



If you want the best of both worlds you can add a boolean (on/off) parameter to switch between automatic and maual input.

Create a boolean parameter called "auto_input".
Also create a text parameter called "manual_text"

Then change your script to this.

hotspot2 0,0
hotspot2 a,0
PEN epn
LINE2 -0.5, 0.0, a, 0.0
PEN cpn
LINE2 0.0, 0.0, -0.4, 0.4
LINE2 -0.4, 0.4, 0.4, 0.4
LINE2 0.4, 0.4, 0.0, 0.0
DEFINE STYLE "AC_STYLE_1" "arial",
100*tsize/a_, 7, 0
pen tpn
SET STYLE "AC_STYLE_1"

if auto_input = 1 then
C=""
C=str(int((y~*100)+.5)/100,3,2)
else
C = manual_text
endif


TEXT2 0.0, 0.377143, "C "+C

Now in the parameters you will have a switch where you can change between automatic or manual input.

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
Anonymous
Not applicable
ok.. thanks let me try.. i will tell u further
Anonymous
Not applicable
Thank you... its working with your help... thank u so much
Anonymous
Not applicable
hi
a applied code it was working but when i merge with my existing code it will generate error... on two lines
if auto_input = 1 then
TEXT2 0.0, 0.377143, "C "+C
... now what should i do ? want to see mine full code ?
Barry Kelly
Moderator
Can you attach the whole object file.
You will need to ZIP it otherwise you won't be able to attach it.
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