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.

IF 'parameter begins with xxx' THEN ...

jakubc7
Advocate
I'm in a process of making an object for typical notes.
I want to select a category, then particular note from that category and call it out as 2d script.

I want to have a this sort of structure.
NOTE TYPE:
Regulations
Council
General
Custom etc

Once I select the note category I want it to list only the relevant notes/parameters.

My idea was to have text parameters called:
reg1, reg2,reg3 etc.
cou1,cou2 etc.
gen1, gen2 etc.
custom1, custom2 etc.

In my parameters I was hoping to do something like this:

IF note_type BEGINS WITH reg THEN
VALUES 'note_list' ALL PARAMETERS THAT BEGIN WITH reg
IF note_type begins WITH gen THEN
VALUES 'note_list' ALL PARAMETERS THAT BEGIN WITH gen
ETC
ENDIF

The idea was to have this ongoing list of parameters that I can manage without having to edit the PARAMETERS VALUES script each time I add a new note.

Is such command possible ... IF PARAMETER BEGINS WITH ...

Otherwise can anyone suggest a better way of achieving a similar result?

Thanks,

Jakub
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation
4 REPLIES 4
Karl Ottenstein
Moderator
Using individual names like reg1, reg2, ... is not the way to go.

Look into arrays. The notes would then be reg[1], reg[2], etc...

But, I'm not sure that embedding this info in a GDL object is an efficient solution. How many typical notes do you have? Consider adding your notes to the Project Info as additional fields... You can then place the notes anywhere in your project using Autotext... and updating the note in Project Info will update the text everywhere. Note, too, that Project Info can be imported/exported.
One of the forum moderators
AC 28 USA and earlier   •   macOS Sonoma 14.7.1, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
STR command would help

Best Regards,
Piotr
Jochen Suehlo
Moderator
I think you can solve this with the STRSUB command.
See:
http://www.selfgdl.de/7_function/str_funktion/STRSUB/kompendium.php
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
jakubc7
Advocate
Thanks for the help guys, I did manage to grasp the concept of the ARRAY. I've used it in some instances but the rest of the code could probably be written bit smarter.

(I didn't check the STRSUB command Joachim ... I got your post after I figured out the ARRAY method).

I do have a follow up question I would like sorted.

So I have my NOTE object now. Works a treat. I used a bit of code from Cookbook 3 and other parts from GLD Reference ... one thing I cannot figure out is how to keep my text block the same width (on paper in mm) rather then keeping the same 'true width' in model space and hence changing the number of lines and overall width on paper depending on scale.

I've attached the object for reference ... if you place it on a layout sheet at scale 1:100 and 1:20 you will see what I mean.

I amended this part of code (based on cookbook) from:

TEXTBLOCK "AC_TEXTBLOCK_2" A*1000/GLOB_SCALE, 1, 0, 1, 1, 1,"para_head", "para_note"

(Usually I use A/1000*GLOB_SCALE ... this seems to be other way around??? I'm a little confused as to the logic.)

to:
TEXTBLOCK "AC_TEXTBLOCK_2" A, 1, 0, 1, 1, 1,"para_head", "para_note"

and it does the trick but then the width is 10 times less then actual 'A' dimension? but it keeps it the same width and number of lines at all scales.

I also can manage to keep my hotspot in the correct place and keeping it adjustable.

I seem to have lost myself in this code??? Help would be much appreciated. The object itself is quite useful as is, I just really want to fix this one problem.

Thanks for your help as always.
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation