BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

GDL
About building parametric objects with GDL.
SOLVED!

Is <drawingscale> value a number or a string? [Drawing title with scale symbol based drawing scale]

adura
Booster

Hi to everyone,

I am designing a title object with "scale symbol" for drawings. I need <drawingscale> value for make this "scale symbol".

<drawingscale> is one of autotext. So, are autotexts number or string? Or not both?

If I can use <drawingscale> value as a number (or string) I can draw scale symbol. But I couldn't do that because -I guess- autotexts are not return a number or a string.

 

What can I do?

 

2022-09-15 Drawing Title with Scale Symbol Based Drawing Scale.png

a - d - u - r - a

Akif Duran / Architect
http://www.mimadu.com
AC21 INT, Win10 64Bit Asus N751JW
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Yves
Advocate

Hi,

It is possible by creating two variables :

AC_OriginalDrawingScale (Text) and AC_Magnification (Real number)

 

Here is the script of my object

 

!!!!!!!!Master script
EPS = 0.0001
unID = 1

ech_pla = SPLIT (AC_OriginalDrawingScale, "%n:%n", num1,sep,val_ech_orig)

dim_ech = 1

IF AC_Magnification > EPS THEN
dim_ech = val_ech_orig / (AC_Magnification/100)
ENDIF


!!!!!!!!!!Script 2D

long_esp = 1.00 
nb_div = 5
ep_ech_plan = 0.002
hach_symb = 64



PEN SYMB_VIEW_PEN


LINE2 0,0,(long_esp/dim_ech)* nb_div,0
HOTLINE2 0,0,(long_esp/dim_ech)* nb_div,0

LINE2 0, ep_ech_plan,(long_esp/dim_ech)* nb_div, ep_ech_plan
LINE2 0, -ep_ech_plan,(long_esp/dim_ech)* nb_div, -ep_ech_plan

HOTLINE2 0, ep_ech_plan,(long_esp/dim_ech)* nb_div, ep_ech_plan
HOTLINE2 0, -ep_ech_plan,(long_esp/dim_ech)* nb_div, -ep_ech_plan



FOR i=1 TO nb_div +1

LINE2 (long_esp/dim_ech)*(i-1), ep_ech_plan,(long_esp/dim_ech)*(i-1),-ep_ech_plan
HOTLINE2 (long_esp/dim_ech)*(i-1), ep_ech_plan/dim_ech,(long_esp/dim_ech)*(i-1),-ep_ech_plan/dim_ech


TEXT2 (long_esp/dim_ech)*(i-1),-ep_ech_plan, STR(long_esp*(i-1),1,0)


dist_der_num = (STW(STR(long_esp*nb_div,1,0))* GLOB_SCALE/1000)/2

IF i = nb_div +1 THEN
DEFINE STYLE "bb" pol_text,ht_text_symb,1,styl_text
SET STYLE "bb"
TEXT2 (long_esp/dim_ech)*(i-1)+dist_der_num,-ep_ech_plan, "m"

ENDIF


NEXT i

SET FILL hach_symb

FOR i=1 TO nb_div-1 STEP 2

POLY2 4, 2+4,
(long_esp/dim_ech)*(i),0,
(long_esp/dim_ech)*(i),ep_ech_plan,
(long_esp/dim_ech)*(i+1),ep_ech_plan,
(long_esp/dim_ech)*(i+1),0


NEXT i

FOR i=2 TO nb_div-1 STEP 2

POLY2 4, 2+4,
(long_esp/dim_ech)*(i),0,
(long_esp/dim_ech)*(i),-ep_ech_plan,
(long_esp/dim_ech)*(i+1),-ep_ech_plan,
(long_esp/dim_ech)*(i+1),0


NEXT i


FOR i=1 TO 10 STEP 2

POLY2 4, 2+4,
((long_esp/dim_ech)/10)*(i),0,
((long_esp/dim_ech)/10)*(i),-ep_ech_plan,
((long_esp/dim_ech)/10)*(i+1),-ep_ech_plan,
((long_esp/dim_ech)/10)*(i+1),0


NEXT i

 

Yves Houssier
Belgium
Archicad 19 -> 24
iMac - Mac Os 10,13

View solution in original post

5 REPLIES 5
Barry Kelly
Moderator

I am not sure how to explain this properly, but here goes.

Autotext values are nothing - neither string or number.

The <autotext> is just some kind of place-holder that can display the value of the autotext field, but does not actually convert the value into a usable string or number.

So you can display the value, but you can not use it.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Solution
Yves
Advocate

Hi,

It is possible by creating two variables :

AC_OriginalDrawingScale (Text) and AC_Magnification (Real number)

 

Here is the script of my object

 

!!!!!!!!Master script
EPS = 0.0001
unID = 1

ech_pla = SPLIT (AC_OriginalDrawingScale, "%n:%n", num1,sep,val_ech_orig)

dim_ech = 1

IF AC_Magnification > EPS THEN
dim_ech = val_ech_orig / (AC_Magnification/100)
ENDIF


!!!!!!!!!!Script 2D

long_esp = 1.00 
nb_div = 5
ep_ech_plan = 0.002
hach_symb = 64



PEN SYMB_VIEW_PEN


LINE2 0,0,(long_esp/dim_ech)* nb_div,0
HOTLINE2 0,0,(long_esp/dim_ech)* nb_div,0

LINE2 0, ep_ech_plan,(long_esp/dim_ech)* nb_div, ep_ech_plan
LINE2 0, -ep_ech_plan,(long_esp/dim_ech)* nb_div, -ep_ech_plan

HOTLINE2 0, ep_ech_plan,(long_esp/dim_ech)* nb_div, ep_ech_plan
HOTLINE2 0, -ep_ech_plan,(long_esp/dim_ech)* nb_div, -ep_ech_plan



FOR i=1 TO nb_div +1

LINE2 (long_esp/dim_ech)*(i-1), ep_ech_plan,(long_esp/dim_ech)*(i-1),-ep_ech_plan
HOTLINE2 (long_esp/dim_ech)*(i-1), ep_ech_plan/dim_ech,(long_esp/dim_ech)*(i-1),-ep_ech_plan/dim_ech


TEXT2 (long_esp/dim_ech)*(i-1),-ep_ech_plan, STR(long_esp*(i-1),1,0)


dist_der_num = (STW(STR(long_esp*nb_div,1,0))* GLOB_SCALE/1000)/2

IF i = nb_div +1 THEN
DEFINE STYLE "bb" pol_text,ht_text_symb,1,styl_text
SET STYLE "bb"
TEXT2 (long_esp/dim_ech)*(i-1)+dist_der_num,-ep_ech_plan, "m"

ENDIF


NEXT i

SET FILL hach_symb

FOR i=1 TO nb_div-1 STEP 2

POLY2 4, 2+4,
(long_esp/dim_ech)*(i),0,
(long_esp/dim_ech)*(i),ep_ech_plan,
(long_esp/dim_ech)*(i+1),ep_ech_plan,
(long_esp/dim_ech)*(i+1),0


NEXT i

FOR i=2 TO nb_div-1 STEP 2

POLY2 4, 2+4,
(long_esp/dim_ech)*(i),0,
(long_esp/dim_ech)*(i),-ep_ech_plan,
(long_esp/dim_ech)*(i+1),-ep_ech_plan,
(long_esp/dim_ech)*(i+1),0


NEXT i


FOR i=1 TO 10 STEP 2

POLY2 4, 2+4,
((long_esp/dim_ech)/10)*(i),0,
((long_esp/dim_ech)/10)*(i),-ep_ech_plan,
((long_esp/dim_ech)/10)*(i+1),-ep_ech_plan,
((long_esp/dim_ech)/10)*(i+1),0


NEXT i

 

Yves Houssier
Belgium
Archicad 19 -> 24
iMac - Mac Os 10,13
DGSketcher
Legend

@adura It looks like @Yves has probably given you a solution, but for reference there is also GLOB_SCALE which can be used in the drawing space to set the size of text and other objects to paper space sizes. It wouldn't be suitable for a title block referencing the drawing.

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

Thanks a lot for your reply/solution @Yves ... I will adapt your code to my own.

a - d - u - r - a

Akif Duran / Architect
http://www.mimadu.com
AC21 INT, Win10 64Bit Asus N751JW

Thanks for your reply @DGSketcher.
I think GLOB_SCALE will not work here because the object will play on the layout.

a - d - u - r - a

Akif Duran / Architect
http://www.mimadu.com
AC21 INT, Win10 64Bit Asus N751JW
Learn and get certified!

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!