Sunday
AutoLISP, Download, Programming, Visual LISPAn AutoLISP program that reads point list from file and puts them into drawing
Hello Daily AutoCAD readers,
This week, i have chosen an application came into my mind after a question from Ahmet who is studying Geodesy at Yıldız Techinal University. He came to my office and asked how he can read the output txt file of a laser coordinate instrument, that includes RGB color codes and point coordinates and use it as an input to the drawing. In this practice, I am not going to answer to the Ahmet’s question yet; I haven’t done anything about the RGB color codes. If anyone knows about this subject, please contact and assist Ahmet to resolve the issue.
Plase read my Managing basic file operations in AutoLISP article before start programming.
Let’s start with studying the txt file. Fig.1

Fig.1 The content of the txt file
Each line consists of a six digit value and corresponds to X,Y and Z coordinates of a point and the RGB color code. The space pattern between the values is irregular. The first thing to be done is to create a function that transforms the six digit values to real numbers and put them into an autolisp list. I prepared this function apart from the whole one because it can be used for any other purpose. The input parameter of the function is any line includes numerical values seperated by spaces. And as an output, it transforms the values into real numbers and put them into an autolisp list in order. The important point here is eliminating the spaces. Fig.2

Fig.2 The function that transforms the lines into a list
Examine and write down the function. Now we can proceed to the main function.

Fig.3 The main function
Write the function I showed above into the main function’s bottom. Do not forget to arrange the line that includes the path of the txt file according to your own file. This application is very useful if you do everyting correct.
Have a nice day,
impts.zip (1.4 KiB, 348 hits)
You need to be a registered user to download this file.
Post Tags: AutoLISP, Download
Related Posts
Popular
- Hip tip: Increasing view resolution with VIEWRES system variable
07/03/2009 04:39 am
7 Comments - Sirince – IZMIR
07/02/2009 11:02 am
1 Comment - Visual LISP: Programming user interfaces with OpenDCL
07/01/2009 10:15 pm
10 Comments - 3D Modeling 7: EXTRUDE
06/30/2009 02:14 pm
10 Comments - Ask DailyAutoCAD: Which Notebook to Buy?
06/30/2009 12:17 pm
1 Comment
Featured Articles
- AutoCAD 2009 Update 3 Released
- Speed Up As AutoCAD 2009 Ribbon Menu Helps You!
- MEP Analysis Extension for AutoCAD MEP extended to March 31, 2009
- Recap of AutoCAD-related technologies on Autodesk Labs
- Technology Preview of MEP Analysis Extension extended to 12/31/08
- Autodesk Labs: Forward and Backward utility for AutoCAD
|


Nov 15, 2007
Reply
To map the true color to the object take the RGB values, run them through the formula below, and map it to DXF code 420:
(+ B (* 256 G)(* 65536 R))
The code for this implementation would be:
(cons 420 (+ (nth 5 lst:list) (* 256 (nth 4 lst:list))(* 65536 (nth 3 lst:list))))
…and should appear below (or in the vicinity of) the line:
(cons 10 pt)
…which appears at line 44 of the main function in Fig.3
Out of curiosity, why did you include the line (cons 100 “AcDbPoint”), as it is not really necessary?
Nov 16, 2007
Reply
Hi,
i had the same problem when I started to work with 3D laser scanners and solved it with similar lisp but the problem is not in the data input but in the AutoCADs capability of handling large amount od points. AutoCAD can handle maybe 200k of point and some scaners colect that many points in few seconds of scanning. Only way to work with such large datasets of points in AutoCAD is to use 3rd party addins that provide (like Trimble Lasergen, Leica Cyclone etc.) such handling.
Nov 19, 2007
Reply
Hello,
I get error “bad argument type: FILE nil”.
Somebody have same problem with this code or I did something wrong?
Nov 28, 2007
Reply
I would like to talk to you about lists.
First thing how would you get the first element in 9 different lists? (list named row1 …. row9)
send me an email m82626@gamil.com
Thanks
Mar 24, 2008
Reply
Hello ,
Thansk for this important Auto lisp.
I get error “bad argument type: FILE nil”.
Jul 15, 2008
Reply
Hello!
I’m quite new to programmimg in AutoCAD.
Could you please explain which is better for connecting entities’ parameters to Excel:
1) dbconnect function
2) vlisp
3) VBA
4) ObjectARX
5) other
?
And where can I find info on this issue?
Many thanks,
Den
Jul 15, 2008
Reply
Hello Denis,
VBA is the best solution for your situation.
Regards