Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm currently looking for a lisp routine to change the visibility of a dynamic block.
My dynamic blocks name are "ansi_a", "ansi_b" & "arch_d"
The visibility parameter is called "VIS_LOGO"
The visibility state is called "FILTER VESSEL"
In another post, @Lee_Mac had stated if all these were known, you could use, "set dynamic block visibility state" by itself. This is what I think it should look like using his code, but I have no idea. I don't need to insert the blocks, just modify the visibility. I also don't know what I need to change in the code, like all the "blk" instances, do they need to be changed to the block name, "ansi_a"? and so on for "vis" and "var"?
Thanks in advance!
(defun c:changevis ( / idx lst obj sel vis )
(setq lst
'(
("ANSI_A" . "FILTER VESSEL")
("ANSI_B" . "FILTER VESSEL")
("ARCH_D" . "FILTER VESSEL")
)
)
(if
(setq sel
(ssget "_X"
(append
'(
(000 . "INSERT")
(-04 . "<OR")
(002 . "`*U*")
)
(mapcar '(lambda ( x ) (cons 2 (car x))) lst)
'(
(-004 . "OR>")
(410 . "~Model")
)
)
)
)
(repeat (setq idx (sslength sel))
(if (setq idx (1- idx)
obj (vlax-ename->vla-object (ssname sel idx))
vis (cdr (assoc (strcase (LM:blockname obj)) lst))
)
(LM:SetVisibilityState obj vis)
)
)
)
(princ)
)
;; Set Dynamic Block Visibility State - Lee Mac
;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed)
;; blk - [vla] VLA Dynamic Block Reference object
;; val - [str] Visibility State Parameter value
;; Returns: [str] New value of Visibility Parameter, else nil
(defun LM:SetVisibilityState ( blk val / vis )
(if
(and
(setq vis (LM:getvisibilityparametername blk))
(member (strcase val) (mapcar 'strcase (LM:getdynpropallowedvalues blk vis)))
)
(LM:setdynpropvalue blk vis val)
)
Solved! Go to Solution.