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
Didn't find your answer? Ask the community — no account required.
R
Roy Knapp
"What-a-Tool" wrote in news:2gT1b.16138$Zw4.3347@lakeread03:
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
W
What-a-Tool
Thanks
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.