0% found this document useful (0 votes)
81 views

A Visual LISP Exercise: Application That Reads Point List From A

This document describes a Visual LISP application that reads point data from a text file, including position coordinates and RGB color codes, and places the points in an AutoCAD drawing. It explains how the application uses functions like UTL:READ:FILE to read the file, UTL:DRAW:POINT-WITH-TRUECOLOR to draw the points with the correct colors, and UTL:IS:COMMENT to check for comment lines. Global variables are also defined to store point data. The overall process involves loading the Visual LISP libraries, reading the file, passing the data to functions to draw the colored points in the drawing.

Uploaded by

elhohito
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

A Visual LISP Exercise: Application That Reads Point List From A

This document describes a Visual LISP application that reads point data from a text file, including position coordinates and RGB color codes, and places the points in an AutoCAD drawing. It explains how the application uses functions like UTL:READ:FILE to read the file, UTL:DRAW:POINT-WITH-TRUECOLOR to draw the points with the correct colors, and UTL:IS:COMMENT to check for comment lines. Global variables are also defined to store point data. The overall process involves loading the Visual LISP libraries, reading the file, passing the data to functions to draw the colored points in the drawing.

Uploaded by

elhohito
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

A Visual LISP Exercise: Application That Reads Point List From a TXT...

1 of 3

http://www.dailyautocad.com/2008/12/visual-lisp-exercise-application...

A Visual LISP Exercise: Application That Reads Point List


From a TXT File
2/05/2010 Muharrem Koyiit in AutoLISP , Download , Visual LISP labels.

0 yorum

Today we will work on Orhan's article AutoLISP application that reads points from a list and places
them in the drawing". First of all, we will convert it to VisualLISP language, and then give you detailed
explanation. Our application will (or I hope it will :-) read the positions of points and their associated
RGB color codes and then place them in our drawing. We can now use RGB codes in our applications.
(R=Red, G=Green, B=Blue).
You can see some part of the Text file in Fig.1. Comment lines are seperated from command lines
using semi-colons ";".There is also a control commmand in case there are such comment lines in an
application: UTL:READ:FILE.

Fig.1 Contents of the Text file.


Command: KM_PT2S (You can also run the program by pressing "X" )
Makro: KM_PT2S programed by M. Kocyigit, 19.05.07
File successfully opened: AG-POINTLIST.txt
(A short message is displayed to inform the user that all is well with the program..)
Please wait points will be loaded
(Notification message is displayed, as you may have to wait for some time.) OK

Fig.2 - Main Function C:KM_PT2S or C:X


The data brougth is then passed on to the next line using the eval command. It works in a similar
manner to the CALL command in BASIC language. Fig.3.

11/18/2010 2:01 PM

A Visual LISP Exercise: Application That Reads Point List From a TXT...

2 of 3

http://www.dailyautocad.com/2008/12/visual-lisp-exercise-application...

Fig.3 - Sub-functionUTL:READ:FILE

Fig.4 Sub-Function UTL:DRAW:POINT-WITH-TRUECOLOR


The function in Fig.5 checks whether the contents of a certain line are comments or not. The ;
charecter is important here.

Fig.5 - Sub-Function UTL:IS:COMMENT


Another command that you need to include in the beginning of the program is the (vl-load-com)
command that loads Visual LISP libraries onto AutoCAD. Another method can be to define the global
variables after this step. To be able to differentiate them from other values, I use the prefix: GLV: and
write the inital values for them.

11/18/2010 2:01 PM

A Visual LISP Exercise: Application That Reads Point List From a TXT...

3 of 3

http://www.dailyautocad.com/2008/12/visual-lisp-exercise-application...

Fig.6 Global variables.


Writing letters, of course, is not the only application for such a program. You can also use it to export
the positions of the joints in a steel construction and then use them in an analysis program.
Visual LISP commands that were using in the making:
vl-load-com
vla-get-ObjectName
vla-AddPoint
vla-get-Coordinates, vlax-3d-point
vla-get-TrueColor, vlax-put-TrueColor
vla-SetRGB

11/18/2010 2:01 PM

You might also like