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

GDL
About building parametric objects with GDL.

GDL Question - Paragraph Linking

GDL Enthusiast
Enthusiast
Hi GDL Experts,

Here is my GDL code for PARAGRAPH syntax below. I can enter the text manually in the code by opening the GDL object and overwriting the text in it. Currently that works on one off basis, but I have a project where I need to add several different variations of the paragraph using the same GDL object.

!!!Sample PARAGRAPH syntax (Start):
!===PARAGRAPH
define style{2} "AC_STYLE_1" "Arial", 3, 0 

paragraph "AC_PRG_1" 1, 0, 0, 0, 1
pen 1
set style "AC_STYLE_1" 

"This is an example of paragraph text. I have to manually open the GDL Object and enter this paragraph text in the code each time I want to change my GDL object."

endparagraph 

textblock "AC_TEXTBLOCK_1" 30, 4, 0, 1, 1, 1, "AC_PRG_1" 

richtext2 0,0,"AC_TEXTBLOCK_1" 
!!!Sample PARAGRAPH syntax (End)

Is it possible to build a list of commonly used paragraphs in a separate tab delimited .TXT file, and have the GDL object retrieve the relevant paragraphs just by typing their reference. I have found an example where GDL can import the following notes from a text file:

SHEETS.TXT File Contents:
A01 Ground Floor 1:50
A02 First Floor 1:50
A03 Roofs 1:50
A04 Section A 1:20
A05 Section B 1:20

GDL Script to extract a specific line from the SHEETS.TXT file:

!!!Sample DATA EXTRACT syntax (Start):
!********* RECORD SEARCH (DATA ADD-ON)
ch=OPEN("DATA",”SHEETS.TXT”,"MODE=RO, DIALOG")
searchfield="A03"
nr=INPUT(ch,searchfield,1,
sheetname, sheetscale)
text2 0,0,searchfield
text2 1,0,sheetname
text2 2,0,sheetscale
CLOSE ch
!!!Sample DATA EXTRACT syntax (Endt):

Result:
A03 Roofs 1:50

Is it possible to write a piece of code inside the PARAGRAPH "____" syntax that can be used to link the code to a specific line in a TXT file for instance? Perhaps the ID# could be used and the same ID# number in the start of the TXT file to tell the code which text to extract?

Ideally my goal is to have a simple TXT file (or excel file which I can export to TXT) and then just by entering a number, the GDL Paragraph Object can enter the relevant text from the TXT file. This would be a huge benefit to me and so appreciated if anyone has a way to do this.

Thank you in advance,
1 REPLY 1
Podolsky
Ace
I don't see any problems doing that. You just need to set variables for your paragraph - like paragraphText01, paragraphText02... paragraphTextn
You also can have variables for break: break01, break02, break03...
So your paragraph text will look like:
paragraphText01
break01
paragraphText02
break02
etc

Before actual script you need to define will your variables be equal nothing ("") or need string.
Breaks can be checked - for example if paragraphText01 doesn't equal "" and paragraphText02 doesn't equal "" then break01 equals "/n"

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!