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.

Label that reads any parameter on an object

Anonymous
Not applicable
Hi,

I've recently started working with Archicad (17) and I've come across a problem. At my workplace, we need to be able to display quite a lot of information on the drawing in 2D, information that is contained within objects. In Archicad I have only found the standard labeler that only displays the ID of the object and that it can only display 1 label per object.

For example I may need to show on the drawing that this object is a SINK and I would maybe also display that this object will have liquids and gases connected to it. For example I would have small texts saying
BL, KV, TL (Swedish so don't mind the letters). This is information that I store in the object and it would be very handy to have a label that could simply read from a chosen parameter.

So I'm looking for someone out there that knows alot about GDL, I've only had 1 days worth of a course on it and I'm very limited on the basics of it.

What I need is:
* Text label that reads 1 row of a parameter that is conatined within the selected object.
* Label can be moved and rotated manually
It is managable to say that for example a parameter-row that I've named Liquids1 can have it's own label connected to it so that I would have say a list of 20 different labels connected to a certain parameter.

What I'd like to be able to do:
* I select the textlabel, connect it to my object. Get a dropdown list of all the usermade parameters that I can just choose from. (So I only need 1 GDL object)
* Within the labeltool, change size and font of the text.
* That I can lock in this text to the object so when I move or rotate the object the labeltext will stick with it.

Anyone out there that has a solid idea how to atleast start this up and get it going?
25 REPLIES 25
Anonymous
Not applicable
Thanks again, this looks solid and simple enough to understand.

I do have some further questions, I'd like to be able to add a bunch of parameters to one mainparameter and use the label to display the mainparameter

I simply tried this,
In the object I have this written in the master script:

sampleParameter1 = sampleParameter2 + sampleParameter3 + sampleParameter4

after changing it up to look correctly in script with the label I can't quite get it to transfer over.

It displays correctly in the objects SampleText that you made but the label only displays something if I manually write something in the objects sampleParameter1

Does my addition above not work as I think it should?

Also, two more sidequestions.
Where can I change the texthight on the label?
If I want to add spaces between my sampleParameter2, 3 and 4 - how do I do this?
sinceV6
Advocate
Hi.

In the label, you are calling the value of the parameter as it appears in the parameter list, so what you wrote in the master script is working but is not passing that information to your parameter. For this, use the parameter script with the PARAMETERS keyword. The label should then be able to grab the contents of the combined values.

The text height might be defined within the script using style definition and parameters or the values from the label settings dialog. Read the keywords I pointed out earlier and the global variables regarding labels.

As for spaces, you might simply state:

sampleParameter1 = sampleParameter2 + " " + sampleParameter3 + " " + sampleParameter4
or add symbols in between.

sampleParameter1 = sampleParameter2 + " + " + sampleParameter3 + " + " + sampleParameter4
There are many ways you could move on from here as to how to approach building the parameters in each object and in the label. For instance, instead of creating parameters AND writing that code in each object to be labeled, I would organize it so that I just create as few parameters/code as needed in each object, and use the label to get values from them and build the output there, as maintaining the code in the label -a single object- will be simpler.

Best regards.
Anonymous
Not applicable
Thanks again for your time, I really appreciate it.

I'll dig down and work some more on this the coming week.
Anonymous
Not applicable
One thing that I just thought off.

if I just use the text2 command, and set it at 0,0 coordinates. Can I somehow give it hotspots so that they can be moved around individually from the object itself?
Anonymous
Not applicable
It is possible:

you must add a "diamant" hotspot. This is the code in 2D Script window:

circle2 0,0,0.10
hotspot2 0,0


!Text hotspots
unID = 1
HOTSPOT2 0, txty, unID, txtx, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txtx, 2 : unID=unID+1
HOTSPOT2 -1, txty, unID, txtx, 3 : unID=unID+1

HOTSPOT2 txtx, 0, unID, txty, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txty, 2 : unID=unID+1
HOTSPOT2 txtx, -1, unID, txty, 3 : unID=unID+1

IF showSampleText THEN text2 txtx, txty, sampleParameter



In the Parameters Window add 2 variables for text position:
" txtx" and "txty"
Anonymous
Not applicable
2D Script Window:
Object with parameters 1_Text Hotspot  02.jpg
Anonymous
Not applicable
Works like a charm!
Now I just need to sort out how I work it out for all of my parameter text2's individually from eachother but I guess that will just need some repeating and creations of a bunch of new txtx and y's parameters and more HOTSPOT2's.
Anonymous
Not applicable
andro55 wrote:
!Text hotspots
unID = 1
HOTSPOT2 0, txty, unID, txtx, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txtx, 2 : unID=unID+1
HOTSPOT2 -1, txty, unID, txtx, 3 : unID=unID+1

HOTSPOT2 txtx, 0, unID, txty, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txty, 2 : unID=unID+1
HOTSPOT2 txtx, -1, unID, txty, 3 : unID=unID+1

IF showSampleText THEN text2 txtx, txty, sampleParameter


In the Parameters Window add 2 variables for text position:
" txtx" and "txty"
I have done this, and it works. But I have several parameters that I would like to add individual hotspots to, is this possible?
Currently I have this:
unID = 1
HOTSPOT2 0, txty, unID, txtx, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txtx, 2 : unID=unID+1
HOTSPOT2 -1, txty, unID, txtx, 3 : unID=unID+1

HOTSPOT2 txtx, 0, unID, txty, 1+128 : unID=unID+1
HOTSPOT2 txtx, txty, unID, txty, 2 : unID=unID+1
HOTSPOT2 txtx, -1, unID, txty, 3 : unID=unID+1

IF showSampleText1 THEN text2 txtx+0.1, txty+0.1,sampleParameter1

IF showSampleText2 THEN text2 txtx+0.2, txty+0.2,sampleParameter2

IF showSampleText3 THEN text2 txtx+0.3, txty+0.3,sampleParameter3

And I have the 2 parameters for txtx and txty for the text positions

------
With this I have tried editing these to have multiple parameters, for example: txtx1, txtx2 etc. and adding several more rows for the hotspots but I can't seem to get it to work. Doing my head in here.

Is it possible to add hotspots to several text2 commands within 1 object?
Anonymous
Not applicable
You need only 1 Hotspot for several lines of text.
Here´s one example:

Master Script:

!!! ---------- text ----------
flag_1 = "%~" + STR(decimal, 3, 0) ! formatstring (myne)
! flag_2 = "%." + STR(decimal, 3, 0) ! formatstring (original)

DEFINE STYLE "4" fontType, hText, 3, 0
DEFINE STYLE "5" fontType, hText, 5, 0
DEFINE STYLE "6" fontType, hText, 1, 0

x = REQUEST("Height_of_style", "5", height)
height = height * GLOB_SCALE/1000








2D Script:

!!! ========== Shaft Description - OPIS JAŠKA (FI K.P. K.D.) ==========
symo = (SYMB_MIRRORED*2-1)

ROT2 SYMB_ROTANGLE*symo ! fixed position
MUL2 -symo, 1

!!! ------------ hotspot for Shaft Description location -----------------
ADD2 fi_jaska*0.25, -fi_jaska*0.25
HOTSPOT2 0, opis_y, unID, opis_x, 1+128 : unID = unID+1 ! base x
HOTSPOT2 opis_x, opis_y, unID, opis_x, 2 : unID = unID+1 ! moving x
HOTSPOT2 -1, opis_y, unID, opis_x, 3 : unID = unID+1 ! ref x

HOTSPOT2 opis_x, 0, unID, opis_y, 1+128 : unID = unID+1 ! base y
HOTSPOT2 opis_x, opis_y, unID, opis_y, 2 : unID = unID+1 ! moving y
HOTSPOT2 opis_x, -1, unID, opis_y, 3 : unID = unID+1 ! ref y

ADD2 opis_x, opis_y

STYLE "4"

len1 = STW("=") * GLOB_SCALE/1000

TEXT2 -len1, height*3, tip + " ¤"
TEXT2 -len1, height*2, "K.P.= "
TEXT2 -len1, height*1, "K.D.= "

len2 = STW("=")*GLOB_SCALE/1000

STYLE "6"

lenT1 = STW(STR(flag_1, fi_jaska)) * GLOB_SCALE/1000
lenT2 = STW(STR(flag_1, kota_pokrova)) * GLOB_SCALE/1000
lenT3 = STW(STR(flag_1, kota_dna)) * GLOB_SCALE/1000
lenT = MAX(lenT1, lenT2, lenT3)

len3 = len2 + lenT

TEXT2 len3, height*3, str(flag_1, fi_jaska * 100)
TEXT2 len3, height*2, str(flag_1, kota_pokrova)
TEXT2 len3, height*1, str(flag_1, kota_dna)

DEL 2
Text in GDL_02.jpg
sinceV6
Advocate
Hi.
If I understand correctly, you want your 3 texts to be independent, with a hotspot for each text element, right?

The best approach would be arrays. Each editable hotspot needs to have its associated parameter in the parameter list. If you want 3 text elements and each with 2 drag components (X and Y), you would need either 6 parameters to control every text element or an array that carries these values.

I would create a two dimension array, 3 rows, 2 columns. With this single parameter you could reference the needed coordinates for each text.

Best regards.