Replacement Text Macros
Any drawing in the project, for example a drawing sheet or panel drawing, can have a text that is linked to, and automatically updated by, the building data card or the active document data which are both Vertex editable databases.
You can use the replacement text macros in the title blocks of drawings, for example. See Create a Custom Title Block for Drawing Sheets.
Linking to the Building Data card
If you want to link to the building data card, navigate to Document Browser → Settings → Building data card. Activate the field you want to connect to, then right-click and choose Database info. In this example, we will use the field Contract No.
![image-20240601-172103.png](../__attachments/441516204/image-20240601-172103.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Note the (1) database name and (2) the database field name. The values are PROREG and CONTR_NUM respectively.
![image-20240601-173229.png](../__attachments/441516204/image-20240601-173229.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Add the Replacement Text Macro
On your drawing, add some text by selecting Text on the Drafting tab. In the top left box, you can enter any text. It will be replaced when the replacement texts are updated. In the Hidden Code box, you can enter the link to the vertex database.
The format is:
#DATABASE_NAME.DATABASE_FIELD#
In our example the code is #PROREG.CONTR_NUM#.
![image-20240601-172646.png](../__attachments/441516204/image-20240601-172646.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Place the text to the drawing. Use the Properties tab if you want to change the text macro size, color etc.
A quick way to match properties of the next text with existing text on the drawing is to click the magic wand at the start of the Properties tab and then click on the text you want to copy the properties from.
Linking to the Active Document Data card
If you want to link to the active document data card, right-click in the active drawing and select Edit Active Document. Activate the field you want to connect to, then right-click and choose Database info. In this example, we will use the field Drawn By.
![image-20240601-175458.png](../__attachments/441516204/image-20240601-175458.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Note the (1) database name and (2) the database field name. The values are FILEINFO and DRAWN_BY respectively.
![image-20240601-175655.png](../__attachments/441516204/image-20240601-175655.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Add the Replacement Text Macro
On your drawing, add some text by selecting Text on the Drafting tab. In the top left box, you can enter any text. It will be replaced when the replacement texts are updated. In the Hidden Code box, you can enter the link to the vertex database.
The format is:
#DATABASE_NAME.DATABASE_FIELD#
In our example we the code #FILEINFO.DRAWN_BY#.
![image-20240601-175908.png](../__attachments/441516204/image-20240601-175908.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Linking to the Local Data Card
If you want to link to the local data card, select Local Data on the System tab. Activate the field you want to connect to, then right-click and choose Database info. In this example, we will use the field Name.
In our example, the hidden code we need to add as text to a drawing is #LOCALDATA.LOC_COMPANY#.
![image-20240601-180602.png](../__attachments/441516204/image-20240601-180602.png?inst-v=e2317961-98f4-43b1-bb7b-5b7c5b59eeea)
Test the Replacement Text Macro
The replacement text macros can be run in several ways:
On the Drafting tab, select Text > ## Update.
In the open drawing, right-click and select Edit Active Document. The texts will update when the dialog box is closed.
Update the drawings sheets from the Document Browser.
Additional information
Any text not surrounded by the # symbol will not be updated when the replacement text macro is run. You can use this to build custom texts for special drawing sheet names, for example.
For example, we need the project id and a special text “-400”.
The hidden code of the text macro would be #PROREG.PROJ_ID#-400.