A lisp I wrote (with some help) a few years ago is no longer working properly.
It used to modify the block immediately after insertion to display the desired visibility state.
It will still insert the block appropriately, just will not modify now and I don't know why.
Note: I believe I was using Acad 09 when I made and used this lisp. I am at different company now and using Acad 2011.
I have removed some features to shorten the posted lisp and isolate the problem.
(Layer scale and resetting some variables)
Any help is appreciated.
Thanks,
Andre
Code:
(vl-load-com)
(defun c:rcp (/ bname props a blkobj rlay ortype visval)
(setq bname "receptacles_anno.dwg")
(if (not rtype) (setq rtype "Duplex"))
(setq ortype rtype)
(setq rtype (getstring (strcat "\n1.Duplex / 2.Double Duplex / 3.Above Counter Duplex / 4.Above Counter Double Duplex <" ortype ">: ")))
(if (= rtype "")
(setq rtype ortype))
(cond
((= rtype "1")
(setq rtype "Duplex"))
((= rtype "2")
(setq rtype "Double Duplex"))
((= rtype "3")
(setq rtype "Above Counter Duplex"))
((= rtype "4")
(setq rtype "Above Counter Double Duplex"))
)
(command "-insert" bname "s" 1 pause "")
(setq props (vlax-safearray->list
(variant-value
(vla-getdynamicblockproperties
(setq blkobj (vlax-ename->vla-object (entlast)))))))
(if (vl-catch-all-error-p
(setq res (vl-catch-all-apply
(function
(lambda ()
(foreach a props
(if (eq "Visibility" (vla-get-propertyname a))
(vlax-put-property a 'Value rtype))))))))
(vl-catch-all-error-message res))
(princ))