cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Design forum

Array with numeric value

Anonymous
Not applicable
Hi,

i'm trying to make my first gdl script for a rainwater tank in Archicad. I'm able to change the text in the object after people select a predefined value but I also want to change the size of the object according with the tank size.

I defined an array but when i try to adjust the size I get the following error: Numeric type expression required at line 77 in the 2D script of file ....

I tried deleting the quotes but then there's an error in the array. I tried the ABS() function, but that didn't work either. I also searched the GDL reference guide but couldn't find anything.

Can you guys please take a look at my code?
Thanks in advance!

!
!   Name     : 17.71 regenwaterput.gsm
!   Date     : dinsdag 3 januari 2017
!   Version  : 1.00
!   Written by GJS 
!

mul2	A/2.150000, B/2.150000

DIM typePut[][]

	typePut[1500][1] = "1500"	!inhoud
	typePut[1500][2] = "-.75"	!straal

	typePut[2000][1] = "2000"	!inhoud
	typePut[2000][2] = "-.75"	!straal

	typePut[3000][1] = "3000"	!inhoud
	typePut[3000][2] = "-.875"	!straal

	typePut[5000][1] = "5000"	!inhoud
	typePut[5000][2] = "-1.075"	!straal

	typePut[7000][1] = "7000"	!inhoud
	typePut[7000][2] = "-1.225"	!straal

	typePut[10000][1] = "10 000"	!inhoud
	typePut[10000][2] = "-1.500"		!straal

	typePut[15000][1] = "15 000"	!inhoud
	typePut[15000][2] = "-1.500"		!straal

	typePut[20000][1] = "20 000"	!inhoud
	typePut[15000][2] = "-1.725"		!straal

DEFINE STYLE "tekstVetMiddel" "Arial Narrow Bold", 2.5,1,0
DEFINE STYLE "tekstKlein" "Arial Narrow", 1.5,1,0

Volume = typePut[putVolume][1]

PARAGRAPH "putTekstPara" 2,
	0, 
	0, 
	0, 
	1.15,
	0
	PEN 2
	STYLE "tekstVetMiddel"
 	"Regenwaterput ("+ Volume +" liter)\n"
	STYLE "tekstKlein"
 	"volgens verordening hemelwater"
ENDPARAGRAPH

TEXTBLOCK "putTekst" 0, 
	5, 	!anchor
	0,	!angle
	1,	!width_factor
	1,	!charspace_factor
	1,	!fixed_height 1=mm, 0=m
  "putTekstPara"

RICHTEXT2 0,0, "putTekst"

straal = typePut[putVolume][2]

fill putFill	
poly2_b{5}       9,      3,      1,      3, putSolid, putEmpty, 
                   0,            0,            1,            0,            0,            1,            0, 
              straal, -4.440892098501E-16,     33, 
        1.110223024625E-16, -5.551115123126E-16,    900, 
                   0,          -90,   4033, 
        1.110223024625E-16, -3.330669073875E-16,    900, 
                   0,          -90,   4033, 
        -2.22044604925E-16,            0,    900, 
                   0,          -90,   4033, 
        -1.110223024625E-16, -2.22044604925E-16,    900, 
                   0,          -90,   4033
1 REPLY 1

Anonymous
Not applicable
Hi,

remove
mul2 A/2.150000, B/2.150000
this scales the object when you change the width and height


The putvolume parameter needs to be a number greater than 1, as arrays start at 1 in GDL, a values list in parameter script or master script can solve this...
VALUES "parameter_name" [,]value_definition1 [, value_definition2, ...]
i.e. values "putVolume" 1500,2000,3000,5000,7000,10000,15000,20000


straal needs to be a number, not text (as you can't use text for the poly2_b{5} command)
define the numbers without Quotes
i.e.
typePut[2000][1] = 2000 !inhoud
typePut[2000][2] = -0.75 !straal
(no gaps in the numbers or it will error, 20 000 does not work)

STR (numeric_expression, length, fractions)
this will convert numbers to text for use in the paragraph (length is actually minimum length of text)
i.e. Volume = str(typePut[putVolume][1] ,1,0)

or if you want to keep your system formatting
STR (format_string, numeric_expression)
i.e.Volume = str("%#.0",typePut[putVolume][1])


get rid of the exponent numbers and change them to 0...to have the center of the circle an atoms width off center annoys me...

poly2_b{5} 9, 3, 1, 3, putSolid, putEmpty,
0, 0, 1, 0, 0, 1, 0,
straal, 0, 33,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033

if you still have errors...then try
when you make the parameters in the parameters list
putfill needs to be a Fill type
putSolid needs to be a Pen Type
putEmpty needs to be a Pen Type
putVolume needs to be a Real number or Interger type, as the actual number for length is based on meters and the displayed number may be mm or another unit. this would mean you have a much larger number i.e.1500000 for the smallest tank.
or just asign intergers
for putSolid pen 1 to 255
for putEmpty pen -1 to 255
for putfill 65(background or empty fill) or 64(solid or foreground fill)


i hope this helps



in parameter script
values "putVolume" 1500,2000,3000,5000,7000,10000,15000,20000

in 2d script
DIM typePut[][]

typePut[1500][1] = 1500 !inhoud
typePut[1500][2] = -0.75 !straal

typePut[2000][1] = 2000 !inhoud
typePut[2000][2] = -0.75 !straal

typePut[3000][1] = 3000 !inhoud
typePut[3000][2] = -0.875 !straal

typePut[5000][1] = 5000 !inhoud
typePut[5000][2] = -1.075 !straal

typePut[7000][1] = 7000 !inhoud
typePut[7000][2] = -1.225 !straal

typePut[10000][1] = 10000 !inhoud
typePut[10000][2] = -1.500 !straal

typePut[15000][1] = 15000 !inhoud
typePut[15000][2] = -1.500 !straal

typePut[20000][1] = 20000 !inhoud
typePut[20000][2] = -1.725 !straal

DEFINE STYLE "tekstVetMiddel" "Arial Narrow Bold", 2.5,1,0
DEFINE STYLE "tekstKlein" "Arial Narrow", 1.5,1,0
Volume = str("%#.0",typePut[putVolume][1])

PARAGRAPH "putTekstPara" 2,
0,
0,
0,
1.15,
0
PEN 2
STYLE "tekstVetMiddel"
"Regenwaterput ("+ Volume +" liter)\n"
STYLE "tekstKlein"
"volgens verordening hemelwater"
ENDPARAGRAPH

TEXTBLOCK "putTekst" 0,
5, !anchor
0, !angle
1, !width_factor
1, !charspace_factor
1, !fixed_height 1=mm, 0=m
"putTekstPara"

RICHTEXT2 0,0, "putTekst"




!!!!!!!!!!!!!!!!!!!!!!!Needs to be a number
straal = typePut[putVolume][2]


fill putFill
poly2_b{5} 9, 3, 1, 3, putSolid, putEmpty,
0, 0, 1, 0, 0, 1, 0,
straal, 0, 33,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033,
0, 0, 900,
0, -90, 4033

Didn't find the answer? Start a new discussion

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!