Import Points from Ascii File?
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Import Points from Ascii File?

 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD
Author Message
Walid Khalid
Guest





Posted: Tue Nov 30, 2004 7:31 am    Post subject: Import Points from Ascii File? Reply with quote

Hi,

You can download freeware software to do what you are looking for.
www.gisplus.co.nz

Regards


"What-a-Tool" <What-a-ToolNoFreakinGroundUpMysteryMeat@cox.net> wrote in
news:2gT1b.16138$Zw4.3347@lakeread03:

Quote:
Have a list of points given in XYZ Coordinates.
My CAM application can import these from a text file if given in the
correct format.
Anyone know of a way to do this in AutoCad 2000?

Also, am involved in a little mind exercise on another news group
which involves finding the shortest path between 400 points scattered
at random across a plane. Anyone know of a method in AutoCad to
accomplish this. Thanks, Sean




lisp will do it.

you want something like....

(setq thefile (file open "c:\whereitsat\thusnsuch.txt"))
and something like
(readline thefile)
in a (while thefile ......
(setq point
(cons.....
[dxf list]
)
(entmake point)

)

LOOP.

check out the help files in vlisp.

I did it once for a fella at Burns & Mac, he wanted ascii data into
autocad
it looked like this that time:

(defun c:andy (/)
(setq file (open "c:/file.txt" "r")
from (read-line file)
to (read-line file)
)
(setq pt1 (cons (atof (substr from 1 6)) (atof (substr from 8 6)))
pt2 (cons (atof (substr to 1 6)) (atof (substr to 8 6)))
)
(setq ent (list (cons 0 "line")
(cons 100 "AcDbEntity")
(cons 8 "0")
(cons 100 "AcDbLine")
(list 10 (car pt1) (cdr pt1))
(list 11 (car pt2) (cdr pt2))
)
)
(entmake ent)
(repeat 1000
(setq from to
to (read-line file)
pt1 (cons (atof (substr from 1 6)) (atof (substr from 8 6)))
pt2 (cons (atof (substr to 1 6)) (atof (substr to 8 6)))
ent (list (cons 0 "line")
(cons 100 "AcDbEntity")
(cons 8 "0")
(cons 100 "AcDbLine")
(list 10 (car pt1) (cdr pt1))
(list 11 (car pt2) (cdr pt2))
)
)
(entmake ent)
)
(close file)
)

ugly code, that, but it worked with the way his data was formatted, and
we only needed it once.

cheers.

roy

Back to top
Philippe
Guest





Posted: Tue Nov 30, 2004 3:50 pm    Post subject: Re: Import Points from Ascii File? Reply with quote

Hi
you can take a look here: http://rapiddxf.free.fr

Regards
Philippe


Walid Khalid wrote:

Quote:
Hi,

You can download freeware software to do what you are looking for.
www.gisplus.co.nz

Regards


"What-a-Tool" <What-a-ToolNoFreakinGroundUpMysteryMeat@cox.net> wrote in
news:2gT1b.16138$Zw4.3347@lakeread03:



Have a list of points given in XYZ Coordinates.
My CAM application can import these from a text file if given in the
correct format.
Anyone know of a way to do this in AutoCad 2000?

Also, am involved in a little mind exercise on another news group
which involves finding the shortest path between 400 points scattered
at random across a plane. Anyone know of a method in AutoCad to
accomplish this. Thanks, Sean






lisp will do it.

you want something like....

(setq thefile (file open "c:\whereitsat\thusnsuch.txt"))
and something like
(readline thefile)
in a (while thefile ......
(setq point
(cons.....
[dxf list]
)
(entmake point)

)

LOOP.

check out the help files in vlisp.

I did it once for a fella at Burns & Mac, he wanted ascii data into
autocad
it looked like this that time:

(defun c:andy (/)
(setq file (open "c:/file.txt" "r")
from (read-line file)
to (read-line file)
)
(setq pt1 (cons (atof (substr from 1 6)) (atof (substr from 8 6)))
pt2 (cons (atof (substr to 1 6)) (atof (substr to 8 6)))
)
(setq ent (list (cons 0 "line")
(cons 100 "AcDbEntity")
(cons 8 "0")
(cons 100 "AcDbLine")
(list 10 (car pt1) (cdr pt1))
(list 11 (car pt2) (cdr pt2))
)
)
(entmake ent)
(repeat 1000
(setq from to
to (read-line file)
pt1 (cons (atof (substr from 1 6)) (atof (substr from 8 6)))
pt2 (cons (atof (substr to 1 6)) (atof (substr to 8 6)))
ent (list (cons 0 "line")
(cons 100 "AcDbEntity")
(cons 8 "0")
(cons 100 "AcDbLine")
(list 10 (car pt1) (cdr pt1))
(list 11 (car pt2) (cdr pt2))
)
)
(entmake ent)
)
(close file)
)

ugly code, that, but it worked with the way his data was formatted, and
we only needed it once.

cheers.

roy

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB