Jump to content

Insert dynamic block and choose Visibility


BIGAL

Recommended Posts

I have noticed a few insert dynamic block and set the dynamic parameters and how to choose a Visibilty state as part of a lisp program rather than 2 steps, insert block and then update the visibility parameter by picking the new block.

 

This allows you to read the visibilty states and display them in a dcl. It will dynamically match the number of states to around 20 max. It is screen dependent.

 

You must down load the Edit dynamic block functions from Lee-mac.com 

 

I have them in a saved lisp file so load on demand or you can put in your code the correct functions. http://www.lee-mac.com/dynamicblockfunctions.html 

(if (not LM:getvisibilityparametername)(Load "lee-mac dynamic block functions"))

Multi radio buttons is at Cadtutor\downloads.

; insert a dynamic block bname at a point X Y scale 1 rotation 0 with 1 attribute also being supplied 
;add or remove attribute values
(command "-Insert"  bname point  1 1  0 "" val0)

; get block object for further processing
(setq blk (vlax-ename->vla-object (entlast)))

; use lee-mac dynamic block functions to set the width and height
(LM:setdynpropvalue blk "Width" wid)
(LM:setdynpropvalue blk "Height" ht )

; get the visibilty parameter names
(setq visval (LM:getvisibilityparametername blk ))

; make a list of the allowed values
(setq winlst (LM:getdynpropallowedvalues  blk visval))

; add "please choose" to start of list
(setq winlst (cons "Please Choose" winlst))

; load Multi Radio buttons.lsp a library dcl routine for any code
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))

; set defualt button to pick note can be amended so = last button picked 
(if (not AHbut)(setq AHbut 1))

; run the multi radio buttons and choose a visibilty
(setq ans (ah:butts2 1 "v" winlst))

; set the visibility state
(LM:SetVisibilityState blk ans)

 

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Thanks for sharing @BIGAL - I'm pleased that you could make use of my Dynamic Block Functions.

 

To offer some food for thought, some time ago I created something similar posted here (refer to the second half of that answer for an example program).

Link to comment
Share on other sites

Hi lee, using the list box method as you suggest is also the way to go when you have a lot of states as it supports scrolling, the multi radio has some spacing parameters in the current version, to make it more visually pleasing but if you have a lot of values squeezes the dcl so user could pick the wrong one.

 

Just a side note if you have only a few states say 3 can also change the "V" to "H" in the code and will display dcl horizontal.

 

The post being to show how it can be done and now have 2 choices thanks to you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...