Jump to content

lisp needed : extract poly line vertex X,Y into txt file


ayman_48

Recommended Posts

hi everybody i will be thank's if someone help me:-

i have poly line with 50 vertex i need lisp to extract this vertex coordinates X,Y into text file

Link to comment
Share on other sites

Try it and let me know:

 

(defun c:Test (/ ss fl op)
 ;; Tharwat. 11.May.16	;;
 (princ "\nSelect LWpolylines:")
 (and (setq ss (ssget '((0 . "LWPOLYLINE"))))
      (setq fl (getfiled "Specify txt file name:" (getvar 'DWGPREFIX) "txt" 1))
      (setq op (open fl "w"))
      (progn
        ((lambda (i / sn p)
           (while (setq sn (ssname ss (setq i (1+ i))))
             (mapcar '(lambda (x) (and (= (car x) 10)
                                       (setq p (cdr x))
                                       (write-line (strcat (rtos (car p) 2 3) "," (rtos (cadr p) 2 3)) op ) )
                        )
                     (entget sn)
                     )
             )
           )
          -1
          )
        (close op)
        )
      )
 (princ)
 )

Link to comment
Share on other sites

Try it and let me know:

 

(defun c:Test (/ ss fl op)
 ;; Tharwat. 11.May.16	;;
 (princ "\nSelect LWpolylines:")
 (and (setq ss (ssget '((0 . "LWPOLYLINE"))))
      (setq fl (getfiled "Specify txt file name:" (getvar 'DWGPREFIX) "txt" 1))
      (setq op (open fl "w"))
      (progn
        ((lambda (i / sn p)
           (while (setq sn (ssname ss (setq i (1+ i))))
             (mapcar '(lambda (x) (and (= (car x) 10)
                                       (setq p (cdr x))
                                       (write-line (strcat (rtos (car p) 2 3) "," (rtos (cadr p) 2 3)) op ) )
                        )
                     (entget sn)
                     )
             )
           )
          -1
          )
        (close op)
        )
      )
 (princ)
 )

 

perfect work man thank's very much

جزاك الله خيرا

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...