Jump to content

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


Recommended Posts

Posted

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

Posted
Hi,

 

Is it LWpolyline or 3Dpolyline?

 

2D polyline

Posted
With comma or space separated?

with comma please

Posted

Last question: what about the precision number of coordinates ?

Posted
Last question: what about the precision number of coordinates ?

 

3 number and i will be thank's for help

Posted

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)
 )

Posted
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

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

Posted
Tharwat being awesome as always. :D

 

That's too kind of you to say. :thumbsup:

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