See the top rated post in this thread. Click here

Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30

Thread: Export X Coordinates only to note pad with Space Seperator

  1. #21
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Simply,

    (strcat (rtos (car x) 2 2) str_sep)
    became
    (strcat (rtos (/ (car x) 1000.0) 2 2) str_sep)
    Attached Files Attached Files

  2. #22
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Dear sir,

    Thank you for Modification and sorry for expressing my doubt. i want for y Coordinates also.

    Kindly make the modification for Y axis too.

    Thanking you sir.

  3. #23
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Dear sir,

    One little request. that is after producing X and Y coordinates. Some coordinates are repeated. kindly fix this bug.

    My condition is, if coordinates of points are repeated with same value, then produce single coordinates from those coordinates.

    Example For X coordinates

    1.20 1.20 1.30 1.40 1.40 to ----> 1.20 1.30 1.40 only ( Ascending order)

    Example For y coordinates:

    6.10 6.10 6.10 7.1 8.1 8.1 to ----> 6.10 7.10 8.1 only ( Ascending order)

    Kindly make the modification.

    Thanking you sir.

  4. #24
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    1

    Default Re: Export X Coordinates only to note pad with Space Seperator

    I have posted in #18 for remove double...?!?!
    For minor change try to do it your self!
    Code:
    ;; gc:distinct (gilles chanteau)
    ;; Suprime tous les doublons d'une liste
    ;;
    ;; Argument
    ;; l : une liste
    (defun gc:distinct (l)
    	(if l
    		(cons (car l) (gc:distinct (vl-remove (car l) l)))
    	)
    )
    (defun l-coor2l-pt (lst flag / )
    	(if lst
    		(cons
    			(list
    				(car lst)
    				(cadr lst)
    				(if flag
    					(+ (if (vlax-property-available-p ename 'Elevation) (vlax-get ename 'Elevation) 0.0) (caddr lst))
    					(if (vlax-property-available-p ename 'Elevation) (vlax-get ename 'Elevation) 0.0)
    				)
    			)
    			(l-coor2l-pt (if flag (cdddr lst) (cddr lst)) flag)
    		)
    	)
    )
    (defun c:ptdef2notepad ( / js dxf_cod mod_sel n lremov str_sep oldim ename l_pt l_pr pr l_x l_y tmp1 f_openx tmp2 f_openy)
      (princ "\nSelect model object for filtering: ")
      (while
        (null
          (setq js
            (ssget "_+.:E:S"
              (list
                '(0 . "*LINE,POINT,ARC,CIRCLE,ELLIPSE,INSERT")
                (cons 67 (if (eq (getvar "CVPORT") 1) 1 0))
                (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model"))
              )
            )
          )
        )
        (princ "\nIsn't an available object!")
      )
      (vl-load-com)
      (setq dxf_cod (entget (ssname js 0)))
      (foreach m (foreach n dxf_cod (if (not (member (car n) '(0 67 410 8 6 62 48 420 70))) (setq lremov (cons (car n) lremov))))
        (setq dxf_cod (vl-remove (assoc m dxf_cod) dxf_cod))
      )
      (initget "Single All Manual")
      (if (eq (setq mod_sel (getkword "\nSelect mode, [Single/All/Manual]<Manual>: ")) "Single")
        (setq n -1)
        (if (eq mod_sel "All")
            (setq js (ssget "_X" dxf_cod) n -1)
            (setq js (ssget dxf_cod) n -1)
        )
      )
      (setq
        str_sep ";"  ;-> **** YOU CAN CHANGE THIS STRING BY WHAT YOU WONT ! **** <-
        oldim (getvar "dimzin")
      )
      (setvar "dimzin" 0)
      (repeat (sslength js)
        (setq ename (vlax-ename->vla-object (ssname js (setq n (1+ n)))))
        (setq l_pr (list 'StartPoint 'EndPoint 'Center 'InsertionPoint 'Coordinates 'FitPoints))
        (foreach pr l_pr
          (if (vlax-property-available-p ename pr)
            (setq l_pt
              (if (or (eq pr 'Coordinates) (eq pr 'FitPoints))
                (append
                  (if (eq (vla-get-ObjectName ename) "AcDbPolyline")
                    (l-coor2l-pt (vlax-get ename pr) nil)
                    (if (and (eq pr 'FitPoints) (zerop (vlax-get ename 'FitTolerance)))
                      (l-coor2l-pt (vlax-get ename 'ControlPoints) T)
                      (l-coor2l-pt (vlax-get ename pr) T)
                    )
                  )
                  l_pt
                )
                (append (l-coor2l-pt (vlax-get ename pr) T) l_pt)
              )
            )
          )
        )
      )
      (setq l_x (gc:distinct (mapcar '(lambda (x) (rtos (/ x 1000.0) 2 2)) (vl-sort (mapcar 'car l_pt) '<))))  ;-> **** YOU CAN CHANGE UNIT AND PREC (rtos x unit prec) ! **** <-
      (setq l_y (gc:distinct (mapcar '(lambda (x) (rtos (/ x 1000.0) 2 2)) (vl-sort (mapcar 'cadr l_pt) '<))))  ;-> **** YOU CAN CHANGE UNIT AND PREC (rtos x unit prec) ! **** <-
      (setq
        tmp1 (vl-filename-mktemp "tmp_x.csv")
        f_openx (open tmp1 "w")
      )
      (write-line (apply 'strcat (mapcar '(lambda (x) (strcat x str_sep)) l_x)) f_openx)
      (close f_openx)
      (startapp "notepad" tmp1)
      (setq
        tmp2 (vl-filename-mktemp "tmp_y.csv")
        f_openy (open tmp2 "w")
      )
      (write-line (apply 'strcat (mapcar '(lambda (x) (strcat x str_sep)) l_y)) f_openy)
      (close f_openy)
      (startapp "notepad" tmp2)
      (setvar "dimzin" oldim)
      (prin1)
    )

  5. #25
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Question Re: Export X Coordinates only to note pad with Space Seperator

    Dear sir,

    Sorry for for your valuable time consuming by me. i am confused sending of correct code. your latest code is perfectly workable.

    Can i Expect Excel Version Of Same Code?it is final request from me.

    With help of your code producing as below to notepad:

    X coordinates is ---->>0.07;1.94;4.57;5.63;8.91;11.12;15.31;16.91;20.38;


    Y coordinates is ---->>1.40;3.49;4.32;4.86;7.91;12.53;

    please make Excel version by your amazing code.

    Please find Attachments of above input files (Auto cad) and Sample output file of Excel.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by prasadcivil; 2016-08-12 at 06:40 AM.

  6. #26
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    For me I stay in format CSV (I don't need API)
    If you want, consult for an exemple GetExcel.lsp and his possibility

  7. #27
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Thank you for your kind reply sir,

    is it possible by CSV format instead of excel? same as excel visibility which is as Excel format? any possibility in csv

    Best regards,

    Thanking you sir.
    Attached Images Attached Images

  8. #28
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Quote Originally Posted by Bruno.Valsecchi View Post
    Dear Master your code is really life saver, till date i have using this lisp program. i need small modification in your code. your code producing like this: 0.07;1.94;4.57;5.63;8.91;11.12;15.31;16.91;20.38;

    i need like this in notepad file one under one value instead of ";" separator:
    0.07
    1.94
    4.57
    5.63
    8.91
    11.12
    15.31
    16.91
    20.38

    Kindly modify yours brilliant code.

    Thanking you,
    With best regards.
    Attached Files Attached Files

  9. #29
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Change in the code
    Code:
     (setq
        str_sep ";"  ;-> **** YOU CAN CHANGE THIS STRING BY WHAT YOU WONT ! **** <-
        oldim (getvar "dimzin")
      )
    by
    Code:
      (setq
        str_sep (strcat (chr 13) (chr 10))  ;-> **** YOU CAN CHANGE THIS STRING BY WHAT YOU WONT ! **** <-
        oldim (getvar "dimzin")
      )

  10. #30
    Member
    Join Date
    2016-01
    Posts
    46
    Login to Give a bone
    0

    Default Re: Export X Coordinates only to note pad with Space Seperator

    Quote Originally Posted by Bruno.Valsecchi View Post
    Change in the code
    Dear Master,
    Thank you for your kind help. your code is well worked.

    Thanking you,
    Best regards.

Page 3 of 3 FirstFirst 123

Similar Threads

  1. export line coordinates
    By spamkiller433238 in forum AutoLISP
    Replies: 16
    Last Post: 2020-04-21, 04:35 PM
  2. Export coordinates to Excel
    By rputhenv in forum AutoCAD General
    Replies: 5
    Last Post: 2016-10-14, 02:09 PM
  3. 2013: How do I export to IFC with project coordinates and not real world coordinates?
    By m.knutsson in forum Revit Architecture - General
    Replies: 2
    Last Post: 2013-10-15, 06:54 AM
  4. Export Coordinates
    By Maastricht in forum AutoCAD Map 3D - General
    Replies: 3
    Last Post: 2009-08-19, 04:45 PM
  5. Reporting Family Coordinates in 3D Space
    By Dimitri Harvalias in forum Revit Architecture - General
    Replies: 7
    Last Post: 2007-03-19, 06:49 PM

Tags for this Thread

Posting Permissions

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