Extract Points Coordinates by picking

Discussion in 'AutoCAD' started by cadptbr, Sep 10, 2004.

  1. cadptbr

    cadptbr Guest

    A friend of mine ask me if there is a lisp or arx routine that could
    extract the coordinates of picked points in autocad or autodesk
    vertical products to an excel or access file. In other words the output
    of the ID command will be redirect to a file compatible with excel or
    access.

    Hoping to hear from you soon.

    Have a nice weekend.
     
    cadptbr, Sep 10, 2004
    #1
  2. Some lines LISP write the coordinates into a text file:

    (defun c:WriteCoordinates (/ f p0 px py pz)
    (setq f (open "MyFile.txt" "w"))
    (while (setq p0 (getpoint "\nPick a point"))
    (setq px (rtos (car p0) 2 4))
    (setq py (rtos (cadr p0) 2 4))
    (setq pz (rtos (caddr p0) 2 4))
    (write-line (strcat px "," py "," pz) f)
    )
    (close f)
    (princ)
    )

    Now you can read this file (CDF-format) with EXCEL.

    HTH
    Juergen
     
    Jürgen Palme, Sep 10, 2004
    #2
  3. Nice job, Juergen! This txt file ends up where exactly, and why?
    Is there any way to aim the output more precisely?
     
    Michael Bulatovich, Sep 10, 2004
    #3
  4. cadptbr

    Paul Turvill Guest

    (setq f (open "C:\\MyPath\\MyFile.txt" "w"))

    ....modify MyPath and MyFile to suit.
    ___
     
    Paul Turvill, Sep 10, 2004
    #4
  5. Run the lisp and search the file ;-)
    Hmm, a good question. The next question please ... ;-)
    This was an example. You can/have to specify the output file name
    and path


    Juergen
     
    Jürgen Palme, Sep 10, 2004
    #5
  6. I did.
    : }
     
    Michael Bulatovich, Sep 10, 2004
    #6
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.