The code below is supposed to add a 150' diameter circle to a dynamic block (it groups the two objects) of a wireless access point. When I use the ALL command, sometimes it works, sometimes it doesn't. The current workaround is to copy the WAPs from the project file into a clean file and run the program and it will add the 150' diameter circles. Then bring those back into the project file. Can anyone shed any light on this? I've also attached a "clean" sample drawing with the WAPs saved as 2007.
;;;=================================================================================================
;;; Function: ADDWAPCIRCLE
;;;
;;; Description: Adds a 150' diameter circle to a selected WAP device and groups the objects
;;;=================================================================================================
(defun C:AddWapCircle ( / lista ent obj entName insPT WapGrp strKeyWord len)
(setvar "pickstyle" 1)
(setvar "osmode" 0)
(setvar "cmdecho" 0)
(initget 1 "S s A a X x")
(setq strKeyWord (getkword "\n Single wap/All wap/eXit: "))
(cond
((= strKeyWord "S")
(while
(setq ent (car (entsel "\n Select a WAP device...")))
(if
(and
(setq obj (vlax-ename->vla-object ent))
(eq "AcDbBlockReference" (vlax-get obj 'ObjectName))
)
(if (= -1 (vlax-get obj 'IsDynamicBlock))
(progn
(setq entName (vlax-get obj 'EffectiveName))
(setq insPT (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint obj))))
(setq WapGrp (ssadd))
(cond
((= entName "DB_GC_ClngWAP")
(ssadd ent WapGrp)
(command "circle" insPT "d" "75'")
(ssadd (entlast) WapGrp)
(command "-group" "c" "*" "" WapGrp "")
(princ "\n Cricle added...")
)
((= entName "DB_GC_WallWAP")
(ssadd ent WapGrp)
(command "circle" insPT "d" "75'")
(ssadd (entlast) WapGrp)
(command "-group" "c" "*" "" WapGrp "")
(princ "\n Cricle added...")
)
((= T)
(alert "Selected object is not a WAP device!")
)
)
)
(alert "Selected object is not a dynamic block!")
)
(alert "Selected object is not a block!")
)
)
)
((= strKeyWord "A")
(setq ss (ssget "X" '((0 . "INSERT"))))
(setq len (sslength ss))
(setq cnt 0)
(repeat len
(setq e (ssname ss cnt))
(setq obj (vlax-ename->vla-object e))
(if (= -1 (vlax-get obj 'IsDynamicBlock))
(progn
(setq entName (vlax-get obj 'EffectiveName))
(setq insPT (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint obj))))
(setq WapGrp (ssadd))
(cond
((= entName "DB_GC_ClngWAP")
(ssadd e WapGrp)
(command "circle" insPT "d" "75'")
(ssadd (entlast) WapGrp)
(command "-group" "c" "*" "" WapGrp "")
)
((= entName "DB_GC_WallWAP")
(ssadd e WapGrp)
(command "circle" insPT "d" "75'")
(ssadd (entlast) WapGrp)
(command "-group" "c" "*" "" WapGrp "")
)
)
(setq cnt (+ cnt 1))
)
)
)
)
((= strKeyWord "X")
(princ "\n")
)
)
(princ)
)
Thanks.