Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Gdl and read file

Anonymous
Not applicable
Here TXT file filling:

K30.00K62.00K5757.13
K130.00K267.00K5493.25
K230.00K472.00K5229.36
K454.00K932.00K4638.25
K554.00K1137.00K4374.36
K654.00K1341.00K4111.27

And my script:

!--> file names added
f1= "ARMDATA.txt"

!--> LIBRARY keyword added
ch1 = open ("TEXT", f1, "mode = ro,LIBRARY" )

!--> script continues as before

1:
n = input (ch1, "K", 1, var1,var2,var3)
if n <> -1 then

ADDX var1/1000
ADDY var2/1000
ROTX 90
CYLIND 12,var3/1000
ROTX 270
IF VAR1/1000<0 then ADDX VAR1/1000
IF VAR1/1000>0 then ADDX -VAR1/1000
IF VAR2/1000<0 then ADDY VAR2/1000
IF VAR2/1000>0 then ADDY -VAR2/1000
IF VAR3/1000<0 then ADDX VAR3/1000
IF VAR3/1000>0 then ADDX -VAR3/1000

goto 1
else
goto 2
endif
2:
close ch1

But he does not want to build my figure.

24 REPLIES 24
Anonymous
Not applicable
How can I draw a solid line if I have only x1,y1,x2,y,2
Laszlo Nagy
Community Admin
Community Admin
Use the PEN command as suggested to set the color.
Use the LINETYPE command to set the linetype.
Then use the LINE2 command.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Anonymous
Not applicable
I would like to build a 3D cylinder having co-ordinates of his beginning and end co-ordinate.
ztaskai
Graphisoft Alumni
Graphisoft Alumni
Alexonus wrote:
I would like to build a 3D cylinder having co-ordinates of his beginning and end co-ordinate.
There is no explicit command for it in GDL. You have to do some coordinate geometry then:) You have to compute the actual length and the rotation angle of the cylinder based on the difference of coordinates. A nice task for returning to school memories:)
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
ztaskai wrote:
Alexonus wrote:
I would like to build a 3D cylinder having co-ordinates of his beginning and end co-ordinate.
There is no explicit command for it in GDL. You have to do some coordinate geometry then:) You have to compute the actual length and the rotation angle of the cylinder based on the difference of coordinates. A nice task for returning to school memories:)
I thought there were predefined function for that ^_^
Anonymous
Not applicable
Ruled?
ztaskai
Graphisoft Alumni
Graphisoft Alumni
Juha wrote:
Ruled?
Good point. I didn't explicitly check it but I think ruled doesn't support curved edges. tube could work though. We usually don't use these commands whenever not absolutely necessary because they are less effective than the simple body generators.

Regards,
Zsolt
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
David Maudlin
Rockstar
ztaskai wrote:
tube could work though.
The problem with TUBE is that you need a minimum of 4 points for the path (the first and last points are not part of the model itself, but determine the angle of the start and end planes), so this is not as simple a solution as Alexonus is looking for.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
ztaskai
Graphisoft Alumni
Graphisoft Alumni
David wrote:
The problem with TUBE is that you need a minimum of 4 points for the path (the first and last points are not part of the model itself, but determine the angle of the start and end planes), so this is not as simple a solution as Alexonus is looking for.
Exactly. Another reason why we don't use tube much 🙂

Thanks,
Zsolt
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
Ok. I make my gdl with CYLINER, but i not undarstand where problem. Not work conditions sum=6

!--> file names added 
f1= "ARMDATA.txt" 

ch1 = open ("TEXT", f1, "separator = 'K'; mode = ro,LIBRARY" ) 

n = input (ch1, 1, 1,dummy, var1,var2,var3,var4,var5,var6) 
i = 1 

while n > 2 do 
sum=var1+var2+var3+var4+var5+var6
IF sum=6 THEN 

i = i+1  
n = input (ch1, i, 1, dummy,var7)
FOR I=1 TO var7
i = i+1  
n = input (ch1, i, 1, dummy,var8,var9)
ADDX var9/1000
ROTZ -90 
CYLIND var8,0.006
ADDX -var9/1000
ROTZ 90 
NEXT I

ENDIF

IF sum<>6 THEN   
   ADDX var1/1000 
   ADDY var2/1000 
  ROTZ var4  
  IF var4=0 and var2<>var6 THEN ROTZ 90
  ROTY 90
   
CYLIND var3/1000,0.006 
  
 ROTY 270  
 IF var4=0 and var2<>var6 THEN ROTZ -90
ROTZ -var4 

LINE2 var1/1000,var2/1000,var5/1000,var6/1000


IF var1>0 THEN ADDX -var1/1000
IF var1<0 THEN ADDX -var1/1000
IF var2>0 THEN ADDY -var2/1000
IF var2<0 THEN ADDY -var2/1000
ENDIF
   i = i+1 
   n = input (ch1, i, 1, dummy,var1,var2,var3,var4,var5,var6) 

endwhile 

close ch1 
and my file:

K62.00K-30.00K5757.13K0.00K5819.13K-30.00
K267.00K-130.00K5493.25K0.00K5760.25K-130.00
K472.00K-230.00K5229.36K0.00K5701.36K-230.00
K932.00K-454.00K4638.25K0.00K5570.25K-454.00
K1137.00K-554.00K4374.36K0.00K5511.36K-554.00
K1341.00K-654.00K4111.27K0.00K5452.27K-654.00
K1K1K1K1K1K1
K7
K0.68K901.20
K0.68K1401.20
K0.68K1901.20
K0.68K2933.20
K0.68K3433.20
K0.68K3933.20
K0.68K4433.20

Please help me ! I want make this GDL file