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

Room Label - Can't get Paragraph/Textblock to work properly

Anonymous
Not applicable
Hi all,

I'm at my wit's end. I feel like I've tried everything. Please Help!

What I'm trying to create is a room label based on one that I found here in the Depository, by James Murray (called Shape Tag JM9). I want a piece of Centered Text over an elliptical room tag (client demands ellipses), with the option to have a text size for the Room Name, and a different one for the room number.

It seems to me that the only way to get nicely centered/broken text is with a TEXTBLOCK (so that the user can define the width and get their own desired linebreak... I find \n too clumsy for my users who aren't familiar enough with the program), and the only way to use a TEXTBLOCK is with a PARAGRAPH command. This seems to, in effect, negate any style commands, and I cannot get set/define style{2} to work. They only work if I am using static text, not a variable. The text always seems to go to a system default font/size. Has anyone run into this before?

See the attached object to see what I'm describing. Any help at all would be FANTASTIC... I've lost too much time over this already Will I need to resort to \n for breaks and abandon the textblock altogether?
10 REPLIES 10
Anonymous
Not applicable
Just an update:

If I take "room_name" in the 2D script and replace it with something like glob_id, or regular text (or even the variable name with quotes around it), everything works perfectly. if it's the variable room_name, however, it does not. the attached file is nearly perfect except for the fact that I can't get user-entered text into the label with the user-defined font.

ARGH!
Barry Kelly
Moderator
You define your text styles as normal.

Then you need to define the paragraph where you can set the text styles for the various bits of text and add the text content.

Now include the paragraph in a text block which is where you can set the size (width) of the text block - either as a user variable which can be linked to a stretchy hotspot (which is what I was using in my example below) or you can enquire the length of you text string and set it to that.

Finaly then you place the text block with the richtext command.



I haven't looked at your script (yet) but here is part of an object I did that is all stretchy.

!Define a paragraph
paragraph "note_1" 1,
0, left_indent, 0,
1,
tab_1

SET STYLE "BULLET"
"" + bullet_text

SET STYLE "TEXT"
"\t" + stringval_1
endParagraph

!Include the paragraph in a text block
!print (box_wid*10*(100/A_))
!print (box_wid*1000/A_)
! textBlock "text_block_1" (box_wid*10*(100/A_))-(2*bullet_swch),
textBlock "text_block_1" (box_wid*1000/A_)-(2*bullet_swch),
1, 0,
1, 1, 1,
"note_1"

rrr = REQUEST("Textblock_Info", "text_block_1", textblockwidth, textblockheight)
box_hgt = box_hgt + textblockheight*(A_/1000)+linespace*0.4

!Place the block using the richtext2 command
richText2 0, 0, "text_block_1"
ADD2 0, -textblockheight*(A_/1000)-linespace*0.4




This is the script for the first bulleted note in the attached image.
Barry.
note.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
Barry Kelly
Moderator
Just looked at your script - I probably should have done that first!

You need to put quotes in front of the roomname variable when you use a variable for the paragraph text.

i.e.

"" + roomname

If you don't add the quotes then it is not recognised as text string.
As you found if you add your own static text (i.e. "LOUNGE ROOM" then it will work.

Thanks to who ever it was that mentioned it somewhere here on the forum before.
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
Barry wrote:
Just looked at your script - I probably should have done that first!

You need to put quotes in front of the roomname variable when you use a variable for the paragraph text.

i.e.

"" + roomname

If you don't add the quotes then it is not recognised as text string.
As you found if you add your own static text (i.e. "LOUNGE ROOM" then it will work.

Thanks to who ever it was that mentioned it somewhere here on the forum before.
Barry.
Wow - brilliant! Can't believe it was so simple. That'll teach me to dive into GDL headfirst knowing nothing about it

I got the attached object working perfectly... is there any way to configure it so that it breaks lines according to words, like a textbox does?
And do you know how I might go about getting the variables to show
up in the Info Box, so that my users don't have to open the object and edit it just to change the room name?
Barry Kelly
Moderator
It will wrap the words unless the width you specify is too short and then it will have to break the word down as well.
What you have works just fine as you adjust the width.
You have set the width base on the "A" variable (A__=A*1000).
The default for "A" in your script is 1000 mm so the default width of you object text is 1,000,000 mm.

As you adjust the width of the object in the info box then all is good (as in the image below - width set to 80, 60 & 20).

As for the variables in the info box that is not possible unfortunately.
The only text variable you can use in the info box is the ID which you are already using any way.

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
Barry wrote:
It will wrap the words unless the width you specify is too short and then it will have to break the word down as well.
What you have works just fine as you adjust the width.
You have set the width base on the "A" variable (A__=A*1000).
The default for "A" in your script is 1000 mm so the default width of you object text is 1,000,000 mm.

As you adjust the width of the object in the info box then all is good (as in the image below - width set to 80, 60 & 20).

As for the variables in the info box that is not possible unfortunately.
The only text variable you can use in the info box is the ID which you are already using any way.

Barry.
Hi Barry,

Thanks for all your help so far! The width issue is really troubling me. The reason I made the *1000 thing was because of the attached image. Despite my blockwidth being defined as "A", and despite the fact that in this image A is 7200, the text is not really filling the outline of the box that it should be. Any idea what's up?

For what it's worth, I would *love* to be able to define A by dragging the hotspots, is there any way to accomplish this?
roomtag_width.jpg
Anonymous
Not applicable
here's the latest object which generated the image above
Barry Kelly
Moderator
Guitarchitect,
Sorry I haven't been around recently to reply.

Firstly the paragrah line in the 2D script needs amending.

paragraph "roompg" 2, 0, 0, 0, 1


There is something funny with the "blockwidth" variable - it seems to be getting reduced by a factor of 10 for the text but is OK for the hotspots.
That is why the hotspots are wider than the text.

I haven't had time to look into it too deeply and I won't have for the next week or so (sorry).


The object is already stretchy as the hotspots are based on the "A" width.
Or you could add in a moveable (stretchy) hotspot based on a "blockwidth" parameter which you could add into the parameter list (remove from the master script where you have the "blockwidth = A" so then it is independent of A.


If I can I will try to have a better look at it but it won't be in the next week - I am actually going to take a few days off!
Maybe someone else may have a look at it in the mean time.
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
andrewzarb
Booster
guitarchitect wrote:
...That'll teach me to dive into GDL headfirst knowing nothing about it .
IMHO it's the best way to learn.