See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 30

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

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

    Question Export X Coordinates only to note pad with Space Seperator

    Dear all Well Wishers,

    Please provide a code for Exporting X coordinates only to Notepad with space separator or comma separator only. and i need Exporting Y coordinates only to Notepad with space separator. sorry for my poor English.so kindly suggest and provide Auto lisp as soon as possible.

    example of X coordinates in note pad is= 0 2 3.5 6 8.2 10 13 14 17
    example of Y coordinates in note pad is= 0 1.5 3.2 4 6.3 9 12.5 19

    thank you for Supporting.

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

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

    Welcome to AUGI; your English is very good.

    If you're not adept at coding LISP yourself, you might try DATAEXTRACTION Command.

    If you'd like to try coding the LISP yourself, consider the iterations a Selection Set using FOREACH, and write the desired content to a Text File using OPEN, and WRITE-LINE Functions. Don't forget to use the CLOSE Function even if there's an *error*.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    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 your kind reply. i am not expert in Auto cad. but i am using many lisp programs.if you dont mine can you provide direct auto lisp program to achieve my requirement.iam tried data extraction command but that is very lengthy task.i want generate the note pad file as mention above for x coordinates only or Y coordinates only.

    Thanking you.

  4. #4
    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 all Masters,
    Please respond to this simple task and provide yours valuable effort.

  5. #5
    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

    Hi,

    Try this code and see comments ;-> **** xxxxx **** <- for adapt to your convenient

    Code:
    (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 tmp1 f_openx tmp2 f_openy)
      (princ "\nSelect a 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 WANT ! **** <-
        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 n l_pr
          (if (vlax-property-available-p ename n)
            (setq l_pt
              (if (or (eq n 'Coordinates) (eq n 'FitPoints))
                (append
                  (if (eq (vla-get-ObjectName ename) "AcDbPolyline")
                    (l-coor2l-pt (vlax-get ename n) nil)
                    (if (and (eq n 'FitPoints) (zerop (vlax-get ename 'FitTolerance)))
                      (l-coor2l-pt (vlax-get ename 'ControlPoints) T)
                      (l-coor2l-pt (vlax-get ename n) T)
                    )
                  )
                  l_pt
                )
                (cons (vlax-get ename n) l_pt)
              )
            )
          )
        )
      )
      (setq
        tmp1 (vl-filename-mktemp "tmp_x.csv")
        f_openx (open tmp1 "w")
      )
      (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (car x) 2 3) str_sep)) l_pt)) f_openx)  ;-> **** YOU CAN CHANGE UNIT AND PRECISION (rtos x unit prec) ! **** <-
      (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 (rtos (cadr x) 2 3) str_sep)) l_pt)) f_openy)  ;-> **** YOU CAN CHANGE UNIT AND PRECISION (rtos x unit prec) ! **** <-
      (close f_openy)
      (setvar "dimzin" oldim)
      (startapp "notepad" tmp2)
      (prin1)
    )

  6. #6
    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
    Hi,

    Try this code and see comments ;-> **** xxxxx **** <- for adapt to your convenient

    Code:
    (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 tmp1 f_openx tmp2 f_openy)
      (princ "\nSelect a 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 WANT ! **** <-
        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 n l_pr
          (if (vlax-property-available-p ename n)
            (setq l_pt
              (if (or (eq n 'Coordinates) (eq n 'FitPoints))
                (append
                  (if (eq (vla-get-ObjectName ename) "AcDbPolyline")
                    (l-coor2l-pt (vlax-get ename n) nil)
                    (if (and (eq n 'FitPoints) (zerop (vlax-get ename 'FitTolerance)))
                      (l-coor2l-pt (vlax-get ename 'ControlPoints) T)
                      (l-coor2l-pt (vlax-get ename n) T)
                    )
                  )
                  l_pt
                )
                (cons (vlax-get ename n) l_pt)
              )
            )
          )
        )
      )
      (setq
        tmp1 (vl-filename-mktemp "tmp_x.csv")
        f_openx (open tmp1 "w")
      )
      (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (car x) 2 3) str_sep)) l_pt)) f_openx)  ;-> **** YOU CAN CHANGE UNIT AND PRECISION (rtos x unit prec) ! **** <-
      (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 (rtos (cadr x) 2 3) str_sep)) l_pt)) f_openy)  ;-> **** YOU CAN CHANGE UNIT AND PRECISION (rtos x unit prec) ! **** <-
      (close f_openy)
      (setvar "dimzin" oldim)
      (startapp "notepad" tmp2)
      (prin1)
    )
    Thank you very much amazing code sir,
    with help of your code only exporting y coordinates.if i want Export X coordinates only? what is the modification in your code? kindly arrange the code for X coordinates only also.

    Thanking you for your support.

  7. #7
    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

    Quote Originally Posted by prasadcivil View Post
    Thank you very much amazing code sir,
    with help of your code only exporting y coordinates.if i want Export X coordinates only? what is the modification in your code? kindly arrange the code for X coordinates only also.

    Thanking you for your support.

    ?!?!
    There are two open notepad!
    (startapp "notepad" tmp1) for X
    (startapp "notepad" tmp2) for Y

    If you don't want Y comment the line with semi-colon
    ;(startapp "notepad" tmp2)

  8. #8
    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

    Quote Originally Posted by Bruno.Valsecchi View Post
    ?!?!
    There are two open notepad!
    (startapp "notepad" tmp1) for X
    (startapp "notepad" tmp2) for Y

    If you don't want Y comment the line with semi-colon
    ;(startapp "notepad" tmp2)
    Dear sir,
    really sorry for wrong observation.yes i got my super code from you. really i am appreciating your effort.thank you very much sir. you saved my time a lot.

    sir kindly arrange another code from you. can i expect? my requirement as below
    *I need two lisp programs in one code. one is Place lines as a stack with some minor offset see the pic-1. because some of my lines are merged and combined each other.highest length of a line should be bottom or top and remaining lines are stacked by descending order by its length of line.please find attachment for clarity.

    2nd lisp for length Labeling of a Poly lines or Ordinary lines with leader based upon my units meter or feet.please find attachment for clarity.

    Please provide suitable Lisp code for this lengthy task for me.
    Attached Images Attached Images

  9. #9
    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

    Quote Originally Posted by prasadcivil View Post
    Dear sir,
    really sorry for wrong observation.yes i got my super code from you. really i am appreciating your effort.thank you very much sir. you saved my time a lot.

    sir kindly arrange another code from you. can i expect? my requirement as below
    *I need two lisp programs in one code. one is Place lines as a stack with some minor offset see the pic-1. because some of my lines are merged and combined each other.highest length of a line should be bottom or top and remaining lines are stacked by descending order by its length of line.please find attachment for clarity.

    2nd lisp for length Labeling of a Poly lines or Ordinary lines with leader based upon my units meter or feet.please find attachment for clarity.

    Please provide suitable Lisp code for this lengthy task for me.
    I have seen your other post, but for me, the rules isn't clear and lot of time for coding this. Perhaps other one person!
    And my language is french and easy answer is difficult for me!

  10. #10
    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
    ?!?!
    There are two open notepad!
    (startapp "notepad" tmp1) for X
    (startapp "notepad" tmp2) for Y

    If you don't want Y comment the line with semi-colon
    ;(startapp "notepad" tmp2)
    Dear sir after Exporting to note pad my values are showing for Y coordinates are like below

    15.85 17.49 12.69 9.30 6.29 1.33 0.00

    As per above out put i need ascending order like a 0.00 1.33 6.29 9.30 12.69 17.49 15.85.

    But X coordinates file is ok.problem with Y coordinates file.

    So please modify the code.

    Thanking you sir.

Page 1 of 3 123 LastLast

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
  •