See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

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

  1. #11
    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 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.
    Try to replace:
    (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt)) f_openy)

    by

    (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) (reverse l_pt))) f_openy)

  2. #12
    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
    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!
    Thank you for your reply sir,
    ok please make one by one.

    1st one is see my embedded lines.those are merging like a single line. so separate line by line. my rule is highest length line is bottom one next highest line is with some offset like a 0.02m. and all next lines with 0.02m. so kindly try for me. see my first pic. those blue lines are combined. and see 2nd pic.this pic is after i moved manually with some gap.highest length line is near to yellow border line. next lines are ascending order, this is the rule.

    thanking you sir.
    Attached Images Attached Images

  3. #13
    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
    Try to replace:
    (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt)) f_openy)

    by

    (write-line (apply 'strcat (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) (reverse l_pt))) f_openy)
    Dear sir thank you for modification. after modification again shows like this=50.296 46.731 43.730 39.697 35.945 33.037 29.472 25.439 22.344 19.436.

    it is Highest to lowest values showing.So kindly make rule for ascending order for Y coordinates file. as well as X coordinate.

    Thanking you for your kind reply.

  4. #14
    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
    So kindly make rule for ascending order for Y coordinates file. as well as X coordinate.
    If you want ascending order for Y change to:

    (write-line (apply 'strcat (vl-sort (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt) '<)) f_openy)

    Make same with X if you want. Isn't sorted by default...

  5. #15
    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
    If you want ascending order for Y change to:

    (write-line (apply 'strcat (vl-sort (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt) '<)) f_openy)

    Make same with X if you want. Isn't sorted by default...
    Sir thank you for your kind reply..yes your modification is greatly worked for Y coordinates. and i i am tried and modified for X coordinates, but fail because i am not expert in lisp program. kindly provide the modification for X coordinates also for Ascending order sorting. becuase some times x Not working properly.

    Thanking you sir.

  6. #16
    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
    because i am not expert in lisp program
    Ok, I understand why you don't mesure your ask and the task that generating...

    The last one

    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 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 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
                )
              )
            )
          )
        )
      )
      (setq
        tmp1 (vl-filename-mktemp "tmp_x.csv")
        f_openx (open tmp1 "w")
      )
      (write-line (apply 'strcat (vl-sort (mapcar '(lambda (x) (strcat (rtos (car x) 2 3) str_sep)) l_pt) '<)) f_openx)  ;-> **** YOU CAN CHANGE UNIT AND PREC (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 (vl-sort (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt) '<)) f_openy)  ;-> **** YOU CAN CHANGE UNIT AND PREC (rtos x unit prec) ! **** <-
      (close f_openy)
      (setvar "dimzin" oldim)
      (startapp "notepad" tmp2)
      (prin1)
    )

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

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

    Quote Originally Posted by Bruno.Valsecchi View Post
    Ok, I understand why you don't mesure your ask and the task that generating...

    The last one

    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 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 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
                )
              )
            )
          )
        )
      )
      (setq
        tmp1 (vl-filename-mktemp "tmp_x.csv")
        f_openx (open tmp1 "w")
      )
      (write-line (apply 'strcat (vl-sort (mapcar '(lambda (x) (strcat (rtos (car x) 2 3) str_sep)) l_pt) '<)) f_openx)  ;-> **** YOU CAN CHANGE UNIT AND PREC (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 (vl-sort (mapcar '(lambda (x) (strcat (rtos (cadr x) 2 3) str_sep)) l_pt) '<)) f_openy)  ;-> **** YOU CAN CHANGE UNIT AND PREC (rtos x unit prec) ! **** <-
      (close f_openy)
      (setvar "dimzin" oldim)
      (startapp "notepad" tmp2)
      (prin1)
    )

    Dear sir, with help of your code, i hav getting like as below, please observe the output results:

    X=109.329;31.573;40.830;53.084;69.129;77.592;86.937;98.221;

    Y=10.092;110.198;116.178;20.784;37.869;59.796;78.021;99.947;

    As per above results missing Ascending order. so kindly correct the modification to achieve required output. please find my attachment drawing also. this drawing points producing as a above mentioned values.

    thanking you sir.
    Attached Files Attached Files

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

    I'am not sure to understand! you want to remove the multiple coordinate which are the same?

    Try this!
    Attached Files Attached Files

  9. #19
    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
    I'am not sure to understand! you want to remove the multiple coordinate which are the same?

    Try this!
    Wow Amazing Now perfectly working. thank you very much sir. God bless you.
    Feeling Happy.

    Thank you sir.

  10. #20
    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
    I'am not sure to understand! you want to remove the multiple coordinate which are the same?

    Try this!
    Dear sir,
    thank you for providing amazing code for me. still i am using your code.

    I need small help from you.

    Kindly make the modification to your amazing code.right now i am obtaining the results as 5630.00 5630.00 5630.00 1940.00.
    So i want to produce those values to note pad as 5.63 5.63 5.63 1.94 (I.e Thousand multiples, so divide all values by 1000.) kindly make the modification.

    Please find the Sample files of Cad drawing, Your lisp code, And Output Notepad files.
    Attached Files Attached Files

Page 2 of 3 FirstFirst 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
  •