Gdl and read file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-13 02:10 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-14 02:44 PM
Your script has two fundamental problems.
- The 'K' separator should be passed to the 'OPEN' command.
- The 'INPUT' command need a proper row number to read.
I created the following equivalent script but seeing the result I doubt that this is what you aim for.
!--> file names added f1= "ARMDATA.txt" ch1 = open ("TEXT", f1, "separator = 'K'; mode = ro,LIBRARY" ) n = input (ch1, 1, 1, var1,var2,var3) i = 1 while n > 2 do ADDX var1/1000 ADDY var2/1000 ROTX 90 CYLIND 12, var3/1000 ROTX 270 add -abs(var1/1000)-abs(var3/1000), -abs(var2/1000), 0 i = i+1 n = input (ch1, i, 1, var1,var2,var3) endwhile close ch1HTH,
Zsolt
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-14 04:39 PM
Similar problem.
Text file read write>
Is there any way (but using random no. generator) to get the "open" dialog box (always) when some switch is trigered?
And is there any way to create the file on saving via dialog box? (in database addon - it is possible but not in text addon) - the workaround is to create the new text file inside the save dialog (Win) - I do not know reliable workaround for Mac.
Best Regards,
Piotr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-15 10:55 AM
ztaskai wrote:That not so works well, as I thought.
Hi,
Your script has two fundamental problems.
- The 'K' separator should be passed to the 'OPEN' command.
- The 'INPUT' command need a proper row number to read.
I created the following equivalent script but seeing the result I doubt that this is what you aim for.
!--> file names added f1= "ARMDATA.txt" ch1 = open ("TEXT", f1, "separator = 'K'; mode = ro,LIBRARY" ) n = input (ch1, 1, 1, var1,var2,var3) i = 1 while n > 2 do ADDX var1/1000 ADDY var2/1000 ROTX 90 CYLIND 12, var3/1000 ROTX 270 add -abs(var1/1000)-abs(var3/1000), -abs(var2/1000), 0 i = i+1 n = input (ch1, i, 1, var1,var2,var3) endwhile close ch1HTH,
Zsolt
I did a verification script, but a condition malfunctions....
!--> file names added f1= "ARMDATA.txt" ch1 = open ("TEXT", f1, "separator = 'K'; mode = ro,LIBRARY" ) n = input (ch1, 1, 1, var1,var2,var3) IF var1=30.00 THEN CYLIND 10,0.006 IF var2=62.00 THEN CYLIND 10,0.006 IF var3=5757.13 THEN CYLIND 10,0.006 close ch1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-16 12:33 PM
Alexonus wrote:Well, since you defined K as a separator and you begin your data lines with a K, the first value read is an empty string which is converted to 0.
That not so works well, as I thought.
I did a verification script, but a condition malfunctions....!--> file names added f1= "ARMDATA.txt" ch1 = open ("TEXT", f1, "separator = 'K'; mode = ro,LIBRARY" ) n = input (ch1, 1, 1, var1,var2,var3) IF var1=30.00 THEN CYLIND 10,0.006 IF var2=62.00 THEN CYLIND 10,0.006 IF var3=5757.13 THEN CYLIND 10,0.006 close ch1
You have 2 options: (1) drop the first K from the beginning of your lines in the data file, (2) read the starting 0s into a dummy variable like this: n = input (ch1, 1, 1, dummy,var1,var2,var3).
I still don't think this is the end result you'd like to get you may have got closer to it.
Regards,
Zsolt
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-19 08:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-19 09:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-19 09:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-20 10:48 AM
LINE2 x1, y1, x2, y2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-10-20 02:55 PM
Alexonus wrote:Alexonus:
How to set the thickness of lines?
LINE2 x1, y1, x2, y2
Use the PEN statement, this will set the pen by number, the thickness will depend on the thickness of that pen number set in the Pen Set, see the GDL Reference Guide for more information.
You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this forum.
David
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