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.

Style Definition / Height Request Order

owen
Newcomer
I have come across some odd behaviour when defining a text style and then requesting the height of that style.

The first example image uses the following script to define and set the style and get its height. The appearance is correct:

DEFINE STYLE 'fjmt_txt_style' fjmt_txt_fontstd, fjmt_txt_size1, 1, 0
SET STYLE fjmt_txt_style
xx=REQUEST ('Height_of_style', fjmt_txt_style, fjmt_fjmt_txt_style_ht)

The second uses:

DEFINE STYLE 'fjmt_txt_style' fjmt_txt_fontstd, fjmt_txt_size1, 1, 0
xx=REQUEST ('Height_of_style', fjmt_txt_style, fjmt_fjmt_txt_style_ht)
SET STYLE fjmt_txt_style

The only difference in the entire script is the order of the SET STYLE and REQUEST lines are switched. Having the the REQUEST before the SET STYLE obviously breaks the latter and AC just uses the default style ... but why? I can't find this documented anywhere and no luck with posts here.

I've run into this on and off for a while but never really looked into it as it can be worked around easily enough. I'm just interested to know

(btw the text is just feedback on ASSOCLP_PARVALUEs while im working on the script to position the label relative to the leaf & frame)

Picture.png
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
2 REPLIES 2
Frank Beister
Moderator
You use the name fjmt_txt_style twice: First as variable/ parameter name, second as name for a text style.

Names of text styles are raw string-names or an index which do have an internal pointer to the content, the definition parameters. You can substitute them in commands by string or numerical varaibales, which contain the name or index. If you use

SET STYLE fjmt_txt_style

AC tries to find a variable of this name. If it is not found, it takes the name itself as string and tries to find the text style of this name. If it is found and it is a numeric value, it points to the define style block.

In your first example. No variable is defined, AC takes 'fjmt_txt_style' as name.

In the second example fjmt_txt_style is declared out of the REQUEST before and has a numeric value with obvisious not defined value of an index pointer. It contains any height value. So AC uses STYLE 0, which means standard style: Arial, height 5mm.

You should use it like this:
SET STYLE 'fjmt_txt_style'

Does this make sense for you?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
owen
Newcomer
Makes perfect sense

Thanks for your very clear response! I think i must have used 'fjmt_txt_style' before as I have not always had this problem - im getting sloppy
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5