Jump to content

Selecting objects in blocks


Recommended Posts

Posted

Hello Everyone

 

I use this lisp to calculate total length of selected lines. But now, with use of dynamic blocks, it has become useless.

 

Can it be edited so it is possible to select objects inside of a block? Like for trim or extend.

 

Thanks in advance!

 

;TLEN.LSP - Total LENgth of selected objects
;(c) 1998 Tee Square Graphics

(defun C:TLEN (/ ss tl n ent itm obj l)
 (setq ss (ssget)
       tl 0
       n (1- (sslength ss)))
 (while (>= n 0)
   (setq ent (entget (setq itm (ssname ss n)))
         obj (cdr (assoc 0 ent))
         l (cond
             ((= obj "LINE")
               (distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
             ((= obj "ARC")
               (* (cdr (assoc 40 ent))
                  (if (minusp (setq l (- (cdr (assoc 51 ent))
                                         (cdr (assoc 50 ent)))))
                    (+ pi pi l) l)))
             ((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
                  (= obj "LWPOLYLINE")(= obj "ELLIPSE"))
               (command "_.area" "_o" itm)
               (getvar "perimeter"))
             (T 0))
         tl (+ tl l)
         n (1- n)))
 (alert (strcat "Total length of selected objects is " (rtos tl)))
 (princ)
)

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