Walid Khalid
Guest
|
Posted:
Tue Nov 30, 2004 7:31 am Post subject:
Import Points from Ascii File? |
|
|
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
|
|
Philippe
Guest
|
Posted:
Tue Nov 30, 2004 3:50 pm Post subject:
Re: Import Points from Ascii File? |
|
|
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
|
|
|