Jump to content

Polyline to text


jan_ek

Recommended Posts

A quick example:

(defun bearings ( ent / enx lst )
   (setq enx (entget ent)
         lst (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) enx))
   )
   (if (= 1 (logand 1 (cdr (assoc 70 enx))))
       (setq lst (append lst (list (car lst))))
   )
   (if (cdr lst)
       (cons (distance (car lst) (cadr lst))
           (apply 'append
               (mapcar
                   (function
                       (lambda ( a b c )
                           (list (* 180.0 (/ (- (rem (+ pi pi (- (angle b a) (angle b c))) (+ pi pi)) pi) pi)) (distance b c))
                       )
                   )
                   lst (cdr  lst) (cddr lst)
               )
           )
       )
   )
)

 

To test:

(defun c:test ( / sel )
   (if (setq sel (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "<>") (42 . 0.0) (-4 . "NOT>"))))
       (print (bearings (ssname sel 0)))
   )
   (princ)
)

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks 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...