cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Revision table object

Anonymous
Not applicable
Hi All,

While I am a long time user of ArchiCAD (since version 6.5) I have never really gotten into GDL scripting. So my question may come off as incredibly obvious to regular users of this forum.

Kerdels has recently changed over to ArchiCAD at my urging and as such I am spearheading the set-up of the templates / libraries etc. We have purchased a locally produced library, so any GDL scripting I need to do it minimal to fill in some gaps.

One such gap is the title block. I am using some auto text for most of the title block however I wanted to create an object specifically for tracking revisions. I drew up the grid, etc and saved the selection as an object. I have then added in the variables for revision, description, date and drawn by in the parameters tab. I have also created a simple layout in the interface tab.

So my question ... How do I make the variables actually appear in the object ? In other words I have a blank grid, I have variables in the parameters tab, but it is unclear how I put those variables into the blank grid ?

Your help is greatly appreciated

Attached I have shown the grid and I have shown the parameter variables and where I want them to go in the object
10 REPLIES 10
Barry Kelly
Moderator
In your 2D script you will need to define a text STYLE.
Then use either the TEXT2 command or the RICHTEXT2 command to place the text.
i.e. TEXT2 0,0, rev1
Where 0,0 are the x & y co-ordinates for the loaction you want the text.

It is not quite as easy as that but this is the basic idea.
When defining the style you need to set the font, fontsize and anchor position (centre, left, top, etc.) and be mindful that it is that anchor point that will be placed at your text co-ordinates.

If you select what you have drawn in plan and save it as an object you will see the scripting required.
You will either need to follow this and add similar commands to your current object or add the parameters to this new object and substitute the quoted text values (i.e. "rev1") for the required parameter (i.e. rev1 - without the quotes).

I think the auto scripted object might use the RICHTEXT2 command which is a little more complex than the TEXT2 command.

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
thankyou for your help

I have been able to get the variables to show up as you suggested. As as you anticipated the font, size and justification of the text is way bigger than the original space.

You say I need to define the text style. Is that done through the parameters tab or is it code written directly into the 2D script ?
Barry Kelly
Moderator
It is scripted in the 2D script - at the beginning before you place any text.
You will use the DEFINE STYLE command - DEFINE STYLE name font, font_size, anchor, face_code.

i.e.
DEFINE STYLE "header_text" "Arial", 2.2, 5, 0
DEFINE STYLE "main_text" "Arial", 1.8, 5, 0

Then you SET the style before you place the text.

i.e.
SET STYLE "header_text"
TEXT2 0,0, "REV Nº"
SET STYLE "main_text"
TEXT2 0,-0.3, rev1


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
this is the code string as created by the application by default:

textblock "AC_TEXTBLOCK_46" 84, 1, 360, 1, 1, 1,
"AC_PRG_46"
richtext2 44.13235851354, 14.83447962425, "AC_TEXTBLOCK_46"

paragraph "AC_PRG_47" 2, 0, 0, 0, 1
rev1
endparagraph


I have added the set style string as you suggested:

SET STYLE "AC_STYLE_1"
TEXT2 0,-0.3, rev1
textblock "AC_TEXTBLOCK_46" 84, 1, 360, 1, 1, 1,
"AC_PRG_46"
richtext2 44.13235851354, 14.83447962425, "AC_TEXTBLOCK_46"

paragraph "AC_PRG_47" 2, 0, 0, 0, 1
rev1
endparagraph

I have added this string to the top of the code:
define style "AC_STYLE_1" "Arial",1.5,5,0

This is resulting in the Revision number not changing in size, but in fact moving away from the object by some distance

Help me Obiwan
Barry Kelly
Moderator
Hmmm - where to start.

The text you pasted here is a bit mixed up.
You have the text you placed for paragrah 46 and then you are setting the properties for paragragh 47

The richtext command should be someting like this.


DEFINE STYLE "AC_STYLE_1" "Arial",
1.5, 5, 0

!Define a paragraph
paragraph "AC_PRG_46" 1,
0, 0, 0,
1,
0.1

SET STYLE "AC_STYLE_1"
"" + rev1
endParagraph

!Include the paragraph in a text block
textBlock "AC_TEXTBLOCK_46" 84,
1, 0,
1, 1, 1,
"AC_PRG_46"

rrr = REQUEST("Textblock_Info", "text_block_head", textblockwidth, textblockheight)
box_hgt = box_hgt + textblockheight*(A_/1000)+textsize_head*(A_/1000)*2

!Place the block using the richtext2 command
richText2 44.13235851354, 14.83447962425, "AC_TEXTBLOCK_46"



As I mentioned the richtext command is a bit complicated.
It is great if you want notes that really have paragraphs and you want the words to wrap onto new lines based on the width of the note.

But for something like this title block with just little bits of text all over the place it is much easier to just use the TEXT2 command.

DEFINE STYLE "AC_STYLE_1" "Arial",
1.5, 5, 0

SET STYLE "AC_STYLE_1"

Text2 44.13235851354, 14.83447962425, rev1



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
Barry Kelly
Moderator
Here is a part of my title block for the revisions which may help you understand a little more.
If you paste this into a new object (2D script) this will work for you but you will see "0" for all the text variables (unless you want to create parameters for them).

Barry.



DEFINE STYLE "AC_STYLE_2" "Arial",
2.0, 5, 0


pen 12
SET STYLE "AC_STYLE_2"
TEXT2 0.4, 4.44, "REV"
TEXT2 1.75, 4.44, "VO #"
TEXT2 3.15, 4.80, "DRN"
TEXT2 4.6, 4.80, "DATE"
TEXT2 6.0, 4.80, "CHK"

TEXT2 3.2, 0.35, "Sub-contractors to verify all dimensions on site."

!vertical
PEN 1
LINE2 0.8, 0.66, 0.8, 4.26
LINE2 2.7, 0.66, 2.7, 4.26
LINE2 3.6, 0.66, 3.6, 4.62
LINE2 5.6, 0.66, 5.6, 4.62

!horizontal
LINE2 0.0, 1.02, 6.4, 1.02
LINE2 0.0, 1.38, 6.4, 1.38
LINE2 0.0, 1.74, 6.4, 1.74
LINE2 0.0, 2.1, 6.4, 2.1
LINE2 0.0, 2.46, 6.4, 2.46
LINE2 0.0, 2.82, 6.4, 2.82
LINE2 0.0, 3.18, 6.4, 3.18
LINE2 0.0, 3.54, 6.4, 3.54
LINE2 0.0, 3.9, 6.4, 3.9

PEN 2
LINE2 2.7, 4.62, 6.4, 4.62
LINE2 2.7, 4.26, 2.7, 4.62
LINE2 0.0, 4.26, 6.4, 4.26
LINE2 0.0, .66, 6.4, .66


! vo info

pen 12
SET STYLE "AC_STYLE_2"

add2 0,4.44
TEXT2 3.15, 0, in_con
TEXT2 4.6, 0, date_con
TEXT2 6.0, 0, in_ch_con
add2 0,-0.36
TEXT2 0.4, 0, rev1
TEXT2 1.75, 0, vo1
TEXT2 3.15, 0, drn1
TEXT2 4.6, 0, date1
TEXT2 6.0, 0, chk1
add2 0,-0.36
TEXT2 0.4, 0, rev2
TEXT2 1.75, 0, vo2
TEXT2 3.15, 0, drn2
TEXT2 4.6, 0, date2
TEXT2 6.0, 0, chk2
add2 0,-0.36
TEXT2 0.4, 0, rev3
TEXT2 1.75, 0, vo3
TEXT2 3.15, 0, drn3
TEXT2 4.6, 0, date3
TEXT2 6.0, 0, chk3
add2 0,-0.36
TEXT2 0.4, 0, rev4
TEXT2 1.75, 0, vo4
TEXT2 3.15, 0, drn4
TEXT2 4.6, 0, date4
TEXT2 6.0, 0, chk4
add2 0,-0.36
TEXT2 0.4, 0, rev5
TEXT2 1.75, 0, vo5
TEXT2 3.15, 0, drn5
TEXT2 4.6, 0, date5
TEXT2 6.0, 0, chk5
add2 0,-0.36
TEXT2 0.4, 0, rev6
TEXT2 1.75, 0, vo6
TEXT2 3.15, 0, drn6
TEXT2 4.6, 0, date6
TEXT2 6.0, 0, chk6
add2 0,-0.36
TEXT2 0.4, 0, rev7
TEXT2 1.75, 0, vo7
TEXT2 3.15, 0, drn7
TEXT2 4.6, 0, date7
TEXT2 6.0, 0, chk7
add2 0,-0.36
TEXT2 0.4, 0, rev8
TEXT2 1.75, 0, vo8
TEXT2 3.15, 0, drn8
TEXT2 4.6, 0, date8
TEXT2 6.0, 0, chk8
add2 0,-0.36
TEXT2 0.4, 0, rev9
TEXT2 1.75, 0, vo9
TEXT2 3.15, 0, drn9
TEXT2 4.6, 0, date9
TEXT2 6.0, 0, chk9
add2 0,-0.36
TEXT2 0.4, 0, rev10
TEXT2 1.75, 0, vo10
TEXT2 3.15, 0, drn10
TEXT2 4.6, 0, date10
TEXT2 6.0, 0, chk10
del 11
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
Thankyou for your help Barry. i was able to use your (TEXT2) code and change it to suit our titleblock needs. I have also added the user interface without a hitch.

One last question. Can I put options for font size and font type with this code ?
Barry Kelly
Moderator
Sure just create parameters for them.
For the font type (text type parameter) I use a VALUE list (in parameter script) for just the few fonts I want to use rather than all of the system fonts.
There is a way to get all of the system fonts but I can't think of it off the top of my head but I find there are way too many and I get tired of scrolling through the list.
So I limit it will just a dozen or so choices in the VALUE list.

The font size needs to be a "Real Number" parameter type.

Then you will want ...
DEFINE STYLE "AC_STYLE_2" font_name,
font_size, 5, 0

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
David Maudlin
Rockstar
Barry wrote:
There is a way to get all of the system fonts but I can't think of it off the top of my head...
In the Parameter script:
Dim FontNames[]
request("FONTNAMES_LIST", "", FontNames)
values "Font_Name" FontNames, custom
In this example Font_Name is the Variable of the Font parameter.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14