We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-09-15 11:06 PM
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?
Solved! Go to Solution.
2022-09-16 04:32 PM
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
2022-09-16 02:58 AM
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.
2022-09-16 04:32 PM
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
2022-09-16 05:00 PM
@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.
2022-09-18 08:43 PM
Thanks a lot for your reply/solution @Yves ... I will adapt your code to my own.
2022-09-18 08:49 PM
Thanks for your reply @DGSketcher.
I think GLOB_SCALE will not work here because the object will play on the layout.