Import Points from Ascii File?

Discussion in 'AutoCAD' started by Walid Khalid, Nov 30, 2004.

  1. Walid Khalid

    Walid Khalid Guest

    Hi,

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

    Regards


    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
     
    Walid Khalid, Nov 30, 2004
    #1
  2. Walid Khalid

    Philippe Guest

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

    Regards
    Philippe


     
    Philippe, Nov 30, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.