The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

GDL language and objects, API, Add-ons, Script…

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy

What is your opinion about this Wish?

No votes
No votes
Not Important
No votes
Not Needed
No votes
Please consider adding the following global variable...
a. OUTPUT SCALE as a number (1/4"-1'-0" would return 48, etc)
I am in need of using the output scale to create a graphic scale
currently this variable only returns a STRING "1/4:=1'-0"

This number is already available to the system as evidenced in the scale dialog itself.
Hi Duane! Just to clarify... when you say 'this variable' returning the text string (for Imperial users - it would be the number for non-imperial) - do you mean GLOB_SCALE (previously known as A_)?

I agree that a numeric global would be useful. They seem to have introduced 1,000 new globals for stairs and railings, so adding what you're asking for seems like it would be easy for them. :-)

BTW - did you look at the existing drawing labels that display a scale to see how they do it?
Karl Ottenstein wrote:
Fri Nov 16, 2018 6:46 pm
BTW - did you look at the existing drawing labels that display a scale to see how they do it?
In the macro Graphic_Sc_NCS_drawTit they look for a match to the scale name, then GoSub a routine to set the scale numbers, for both imperial and metric units. The code is very lengthy (1364 lines, but some are commented out).

Hello vfrontiers,

Sorry, but it is not quite clear to me what it is you are asking for. As the guys before me mentioned, GLOB_SCALE does just that - it takes the current scale, and returns the scale factor as a number, so that you can make calculations/comparisons with it.

1:100 ------> GLOB_SCALE = 100
1/4"-1'-0" -> GLOB_SCALE = 48

Is that not what you are looking for?

Just to make sure, I have tried this in ARCHICAD 22 USA, on macOS 10.14. I attached a picture of my result.

If you have an object that works differently, please send it to me, so that I can see if this is a bug.

Kind Regards,
scale object.png
Right.... I mis typed... I am looking for the AC_DrawingScale to produce an INTEGER (like GLOB_SCALE)...

I am needing this to calculate the layout of a GRAPHIC SCALE element in my own TITLE TYPE.

Any Ideas?
I believe AC_DrawingScale returns "1:x", or what ever the imperial equivalent is. So if you are wanting to break AC_DrawingScale into it's two parts, you will need something like this:

Code: Select all
string = Bar_Scale1
len = STRLEN (string)
iDotPos = STRSTR (string, ":")
v1 = STRSUB (string, iDotPos + 1, 6)
v2 = SPLIT (v1, "%n", vl)						!v2 = dummy    return = vl

I would assume that since you are working in Imperial, you will need to divide this by your left figure?


OK, that is something else indeed. That is actually a string parameter (the GDL guide calls it a fixed name optional parameter). I forwarded your request to the gdl team, we will see what they think of it.

I am not sure what you need it for but my guess would be that you want to put a graphic scale in your drawing title. If so, then I think your best option would be to call the same macro the NCS drawing titles use:
Code: Select all
CALL "Graphic_Sc_NCS_drawTit" PARAMETERS gs_cont_pen=thinpen, gs_text_pen=gs_drawing_scale_font_pen, gs_text_size=gsfs,
                                         gs_text_style=fontType, ut=ut, cs=0, tr=1, drawingScale=drawingScale
But even if that is not the case, you can use a similar method the aforementioned macro uses to get the scale factor for the graphic scale - get it from the string.

Here's a way to do it with 1/4" = 1'-0" (but I am sure there are plenty of other ways):
Code: Select all
if AC_DrawingScale = `1/4" = 1'-0"` then scale = 48
I hope this helped. Maybe you can even look into the script of "Graphic_Sc_NCS_drawTit" to see how it does it.


Edit: I see Ling was faster than me. But his way of breaking down the string seems smarter than just matching it like I did. Go with that! :D
All good tips.. and I will attempt them...

Unfortunately, I can see a circumstance where if it is a TYPICAL SCALE, it may work... but there are too many possibles...
1/4" = 1'-0"

etc.... etc...
I may just try and cover the normal scales.....
but clearly, the INTEGER version works more easily...

Thanks for the input!