It "should" work.
Code:
(vl-load-com)
(if (setq ss (ssget "x" (list (cons 0 "INSERT") (cons 2 "zi3042sht"))))
;; This is the then portion
(vla-put-Name
(vla-item
(vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
"zi3042sht" ;<-- old block name
)
"abcde" ;< -- new block name
)
;; This is the Else portion
(if (setq ss (ssget "x" (list (cons 0 "INSERT") (cons 2 "i3042sht"))))
(vla-put-Name
(vla-item
(vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
"i3042sht"
)
"abcde"
)
)
)
;; No need to do the selection again, just check if it has found any objects
;; (either of the 2 blocks) - since in both cases the same actions are performed
(if ss
(progn
(setq ename1 (ssname ss 0))
(setq InsPt (cdr (assoc 10 (entget ename1))))
(command "._move" "all" "" InsPt '(0.0 0.0))
)
)