Results 1 to 2 of 2

Thread: Import Points from Ascii File?

  1. #1
    Walid Khalid Guest

    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:

    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

  2. #2
    Philippe Guest
    Hi
    you can take a look here: http://rapiddxf.free.fr

    Regards
    Philippe


    Walid Khalid wrote:

    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

Similar Threads

  1. help with file import
    By Don Ketcham in forum AutoCAD
    Replies: 4
    Last Post: 02-13-2009, 10:22 AM
  2. X-Y ascii file from Spectre
    By mayank in forum Cadence
    Replies: 9
    Last Post: 11-29-2005, 01:10 PM
  3. idf file import
    By bb in forum SolidWorks
    Replies: 1
    Last Post: 09-30-2005, 05:10 PM
  4. import ascii files, import georeferenced points
    By Philippe Thoiron in forum AutoCAD
    Replies: 0
    Last Post: 04-26-2005, 09:10 AM
  5. Import points into cad and draw
    By Rogerio_Brazil in forum Customization
    Replies: 4
    Last Post: 01-19-2005, 04:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum