+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2008
    Posts
    32

    Default import data from autocad to excel-little only

    Registered forum members do not see this ad.

    Dear all,

    I have a auto cad drg. in which there are few lines (drawn with pline command - not with line command).
    I want to get its length into excel

    Also, I want to select all the lines in the current drg. with same length. It will be a better if i can export all the lines with no. and its length individually to excel sheet.
    Another problem I am facing here is as under:
    I know my drawing is having 6140.0000mm. length with at least 3 lines. but when I run quick select option with pline>length>equal to 6140.0000, it doesn't select any line
    pl. help me
    Last edited by vipulgos; 5th May 2010 at 12:01 pm. Reason: something found

  2. #2
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2008
    Posts
    32

    Default

    I do have this code with me, but it doesn't working for pline which is not closed.
    ;| Program to export properties of ARC, CIRCLE and LINE entities
    into a CSV file
    mfuccaro@hotmail.com
    the UNIT command should use before using this lisp
    ---------------------------August 2004
    |;

    ;REVISIONS: September 2004
    ; - Added CIRCLES to the list
    ; - Length calculation for all recorded entities
    ; - Handle the error if nothing is selected
    ;
    ;January 2010
    ; - numbering entities

    (defun putno(n p)
    (setq txtheight 200)
    (entmake (list '(0 . "TEXT") (cons 1 (rtos n)) (cons 10 p) (cons 40 txtheight) '(50 . 0.78539))
    (eval n)
    )

    (defun c:LST( / name file ss ssi enl ln ar ci c2s)

    ;----------------------------
    (defun ln (l f n / p) ;To record a LINE l in the file f
    (write-line (strcat "LINE,"
    (c2s (cdr (assoc 10 l)))
    (c2s (cdr (assoc 11 l)))
    (rtos (distance
    (cdr (assoc 10 l))
    (cdr (assoc 11 l))))) f)
    (setq p (mapcar '* (mapcar '+ (cdr (assoc 10 l)) (cdr (assoc 11 l))) '(0.5 0.5 0.5)))
    (putno n p)
    )

    ;----------------------------
    (defun ar (l f n / c r u1 u2) ;Record an ARC
    (setq c (cdr (assoc 10 l)) ;Center
    r (cdr (assoc 40 l)) ;Radius
    u1 (cdr (assoc 50 l)) ;Start...
    u2 (cdr (assoc 51 l)) ;...and End angle
    )
    (write-line (strcat "ARC,"
    (c2s (polar c u1 r))
    (c2s (polar c u2 r))
    (rtos (* r (abs (- u2 u1)))) ","
    (c2s c) (rtos r)) f)
    (putno n c)
    )

    ;-----------------------------
    (defun ci (l f n / r) ;To record a CIRCLE
    (setq r (cdr (assoc 40 l))) ;Radius
    (write-line (strcat "CIRCLE,,,,,,,"
    (rtos (* 2 PI r)) ","
    (c2s (cdr (assoc 10 l)))
    (rtos (cdr (assoc 40 l)))) f)
    (putno n (cdr (assoc 10 l)))
    )

    ;----------------------------
    (defun c2s (x) ;Used to transform Coords in String
    (strcat (rtos (car x)) "," (rtos (cadr x)) "," (rtos (caddr x)) ",")
    )

    ;----------------------------

    (setq name (getvar "dwgname"))
    (if (= "." (substr name (- (strlen name) 3) 1))
    (setq name (substr name 1 (- (strlen name) 4))))
    (setq file (open (getfiled "Output file..." name "CSV" 1) "w")
    ss (ssget) ssi -1)
    (write-line
    "Type,Start X,Start Y,Start Z,End X,End Y,EndZ,Length,cen X,cen Y,cenZ,Radius"
    file)
    (setq n 1)
    (if ss
    (progn
    (repeat (sslength ss)
    (setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
    (cond
    ((= "LINE" (cdr (assoc 0 enl))) (ln enl file (setq n (1+ n))))
    ((= "ARC" (cdr (assoc 0 enl))) (ar enl file (setq n (1+ n))))
    ((= "CIRCLE" (cdr (assoc 0 enl))) (ci enl file (setq n (1+ n))))
    )
    ))) ;end IF SS
    (close file)
    (princ)
    )

  3. #3
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2008
    Posts
    32

    Default

    my drawing is just like as attached. I need total length of this pline and it is to be exported to excel
    Attached Images

  4. #4
    Super Member MikeScott's Avatar
    Computer Details
    MikeScott's Computer Details
    Operating System:
    XP Pro
    Computer:
    Dell Precision T3400
    CPU:
    2.67 gigahertz Intel Core2 Duo
    RAM:
    2046 Mb
    Graphics:
    NVIDIA Quadro NVS 290/ 256MB DDR2
    Primary Storage:
    ST3500418AS/ 500gb (450gb free)
    Monitor:
    DELL G2410 (24.0"vis)
    Using
    AutoCAD 2004
    Join Date
    Mar 2010
    Location
    Clearwater, Florida
    Posts
    558

    Default

    This question should be in the LISP area, rather than AutoCAD beginners, but..

    I can take a stab at the quick select failure. If the polylines go around a corner, the length will include the overall length of the entire polyline (the sum of each part of that polyline), not just one of it's sides.

    If you click on the polyline, the entire polyline will highlight at the same time.

  5. #5
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2008
    Posts
    32

    Default

    Registered forum members do not see this ad.

    Yes, I need full length of polyline only - not in part.
    pl. furnish the solution for my other problems too, i.e.

    2) cannot able to select (by quick select) the polyline with the length 6140, even if it is there in drg.

    3) another problem i came across is ( I have tried to open tools>quick select >object type as polyline>properties>length), I can't operate this macro

    Sub quick()
    SendKeys ("%T")
    SendKeys ("k")
    SendKeys ("{TAB}")
    SendKeys ("p")
    SendKeys ("{TAB}")
    SendKeys ("{l 5}")
    SendKeys ("{TAB}")
    SendKeys ("{TAB}")

    End Sub

    What is wrong in this macro?

Similar Threads

  1. How to import Excel x,y,z data into AutoCAD
    By sjm in forum AutoCAD Drawing Management & Output
    Replies: 24
    Last Post: 16th Nov 2012, 09:35 pm
  2. Can I import data from excel to a AutoCAD table? Ver 2007.
    By muck in forum AutoCAD Drawing Management & Output
    Replies: 19
    Last Post: 1st Oct 2010, 02:27 pm
  3. Replies: 2
    Last Post: 5th Jan 2010, 05:04 pm
  4. Import X,Y Coordinates from Excel into AutoCAD
    By Between the Lines in forum AutoCAD RSS Feeds
    Replies: 1
    Last Post: 1st Jul 2009, 01:13 am
  5. Best Way To Import An Excel File To AutoCAD?
    By AQucsaiJr in forum AutoCAD General
    Replies: 10
    Last Post: 8th Dec 2008, 10:08 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts