Repeat insert dynamic block and choose visibility state at command line.

Repeat insert dynamic block and choose visibility state at command line.

s_johnstoneTRTLG
Explorer Explorer
474 Views
2 Replies
Message 1 of 3

Repeat insert dynamic block and choose visibility state at command line.

s_johnstoneTRTLG
Explorer
Explorer

Hello,  Completely new to Lisp. Does anyone have any ideas on how to repeat insert a dynamic block and choose the visibility state at the command line each time you place it. It should Default to one state unless you hit the hot key for another visibility state. at which point it should switch to that new state as default. Something tells me this will be difficult.

0 Likes
Accepted solutions (1)
475 Views
2 Replies
Replies (2)
Message 2 of 3

Sea-Haven
Mentor
Mentor
Accepted solution

Start with this maybe. Big thanks to Lee-mac.

 

 

; Change dynamic block properties when inserting look at properties available.
; By Alan H June 2022

;; Get Dynamic Block Property Allowed Values  -  Lee Mac
;; Returns the allowed values for a specific Dynamic Block property.
;; Set Dynamic Block Visibility State  -  Lee Mac
;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed)
;; Get Visibility Parameter Name  -  Lee Mac
;; Returns the name of the Visibility Parameter of a Dynamic Block (if present)

(defun insdynv (blkname / pt obj lst ans)
(if (not LM:setdynpropvalue )(load "Lee-mac Dynamic block get-put"))
(setq pt (getpoint "\nPick a pt for block "))
(command "-insert" blkname "s" 1.0  pt 0)
(setq obj (vlax-ename->vla-object (entlast)))
(setq visval (LM:getvisibilityparametername obj))
(setq lst (LM:getdynpropallowedvalues obj visval))
(setq lst (cons "Please choose" lst))
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (not AHbut)(setq AHbut 1))
(setq ans (ah:butts 1 "v"  lst))
(LM:SetVisibilityState obj ans)
(princ)
)

 

0 Likes
Message 3 of 3

s_johnstoneTRTLG
Explorer
Explorer
Thank You for your help!
0 Likes