Message 1 of 14

Not applicable
04-24-2016
11:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I got a lisp for counting total length of dynamic block (Distance1). But it is working only in horizontal type blocks not for vertical type. I want to quantify total length of the pipes in a drawing, all pipes are stretchable type dynamic block. Any body know how to get total Distance1 value of multiple dynamic blocks (stretchable type block) which is any rotation.
Here is the lisp..
(defun c:Test
(/ total selectionset count intger selectionsetname a b)
(vl-load-com)
;;; Tharwat 02 . April . 2012 ;;;
;; Count number of selected Dynamic blocks and length of selected dynamic blocks
(if (setq total 0
selectionset
(ssget '((0 . "INSERT")
(-4 . "<or")
(2 . "`*U*")
(2 . "_P1000")
(-4 . "or>")
)
)
)
(progn
(setq count (sslength selectionset))
(repeat (setq intger (sslength selectionset))
(setq selectionsetname
(ssname selectionset
(setq intger (1- intger))
)
)
(vla-getboundingbox
(vlax-ename->vla-object selectionsetname)
'a
'b
)
(setq total (+ total
(distance (list (car (vlax-safearray->list b))
(cadr (vlax-safearray->list a))
)
(vlax-safearray->list a)
)
)
)
)
(alert (strcat " Total number of Dynamic Blocks :"
"< "
(itoa count)
" >"
"\n"
" Total lengths of Dynamic Blocks :"
"< "
(rtos total 2)
" >"
)
)
)
(princ)
)
(princ)
)
Solved! Go to Solution.