Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I am trying to select all dynamic blocks of one type and get from each the "SPLICE GRIP X" and "SPLICE GRIP Y" properties. I'm using the same group select function I always use, and using the LM:getdynpropvalue function, I'm not seeing why I'm getting this -
; error: bad argument type: VLA-OBJECT nil
I assume this means the blocks aren't being recognized as dynamic?
The LISP is here:
(defun c:FixSC ( / SnapHold out Sp_blk GripDistX GripDistY Insert_X Insert_Y Insert_Z AnnoGripDist )
(vl-load-com)
(setvar 'attdia 0)
(setq SnapHold (getvar 'osmode))
(setvar 'osmode 0)
(defun SelSpCs (/ e name n ss)
(if (setq name "SPLICE CLOSURE";;;selecting all dynamic blocks of this name
ss (ssget "_X" '((0 . "INSERT")))
n -1
out (ssadd)
) ;end setq
(while (setq e (ssname ss (setq n (1+ n))))
(if (= :vlax-true (vla-get-IsDynamicBlock (vlax-ename->vla-object e)))
(if (= (strcase (vla-get-Effectivename (vlax-ename->vla-object e))) (strcase name))
(ssadd e out)
) ;end if
) ;end if
) ;end while
) ;end if
(sssetfirst nil out)
) ;end SelSpCs
(defun LM:getdynpropvalue ( blk prp / x) ;;get grip X, get grip Y
(setq prp (strcase prp))
(vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
(vlax-invoke blk 'getdynamicblockproperties)
)
)
(defun core ( / sb OldIns NewIns TrgIns_X TrgIns_Y)
(SelSpCs)
(foreach sb (vl-remove-if 'listp (mapcar 'cadr (ssnamex out)))
(progn
(setq GripDistX (LM:getdynpropvalue sb "SPLICE GRIP X"))
(setq GripDistY (LM:getdynpropvalue sb "SPLICE GRIP Y"))
(princ GripDistX)
(princ GripDistY)
) ;end progn
) ;end foreach
) ;end core
(core)
(setvar 'osmode SnapHold)
)
I've attached the block below
Thanks for any help
Solved! Go to Solution.