TheSwamp
CAD Forums => CAD General => Topic started by: nivuahc on November 21, 2005, 09:59:17 AM
-
We've just updated to AutoCAD 2006 from 2002 and I'm going through setting up our menus/customizations/etc
I've decided to take advantage of the dynamic blocks for things like our receptacles and what-not (we're an electrical firm) and was pleased to see that Autodesk put an option on the tool palettes that allowed me to pre-set the visibility state of a dynamic block when a user chooses it. That's great. Really handy. But let's talk about toolbars for a second...
I'd like the same functionality in toolbars, it's going to be a bit of a struggle to get everyone here used to using palettes in the first place and it seems, to me at least, that it's a bit easier to control something like toolbars using the enterprise cui than it is to control tool palettes. So how do I set the visibility state of a dynamic block when a user selects it off of a toolbar?
I've been through the help files, the customization guide, and quite a bunch of other things and I can't imagine this is the first time this has been asked. In fact, I asked it a loooooong time ago, before 2006 hit the retail shelves. ;)
Anyone?
-
Chuck,
What is the macro or command you are using in the toolbar button to insert your block?
I know if the tool palettes once you get your block in the palette you just right-click it and change the properties for that tool only.
Im not sure about toolbars. Send me your sequence and Ill test it out here.
Will
-
-insert \\location\\of\\block;
:D
Lemme 'splain...
I have, for example, a dynamic block for a receptacle. In that block I have 2 options, a duplex receptacle and a quadruplex receptacle. I have the tool palette setup to have each one visible (i.e. the user sees both receptacles in the palette) and I achieve that by simply copying the dynamic block thinger from the palette and changing the visibility state in the properties of that button.
I want to have a toolbar that has a duplex receptacle and a quadruplex receptacle. I want to use the dynamic block I have just setup. I want the user to be able to select the duplex receptacle and it come in as a duplex receptacle (the default visibility state, so that's not a problem). But, this is where it gets tricky... I want the user to be able to select the quadruplex receptacle (same dynamic block as the duplex, mind you) and have it come in as a quadruplex receptacle. I want to be able to change the visibility state of a block on insertion from the toolbar.
Simple enough with palettes, but not so simple with a toolbar (at least, not so far as I have found)
-
Don't know if this will help but, it's worth a shot.
http://discussion.autodesk.com/thread.jspa?messageID=4841498
-
Thanks Murphy,
I actually worked through discovering what the different visibility states are in this thread (http://www.theswamp.org/forum/index.php?topic=5177.0) a while back (with mucho help from Kerry I might add) but the situation is changing the visibility state. Okay, so I've got 50 different visibility states in a dynamic block. Swell. I want it to insert as visibility state 3. From a toolbar. Or the command line. Or something other than a palette.
-
See if this helps:
http://www.theswamp.org/forum/index.php?topic=7340.msg91197#msg91197
-
Chuck,
Try this and see if works for you:
(defun c:vis (ent)
(foreach prop (vlax-safearray->list
(vlax-variant-value
(vla-getdynamicblockproperties
(vlax-ename->vla-object ent)
)
)
)
(if (eq (vla-get-propertyname prop) "VISIBILITY") ;this string should match the name
;of your visibility property.
(vla-put-value (vlax-make-variant "put name here")) ;this string should match the value
;of the string you want to show.
)
)
)
Load this and then put a call to it in you button. Make sure you change the appropriate strings as indicated in the code.
Let me know if it works or not.
Maybe something like this:
-insert \\location\\of\\block;;;;(c:vis (entlast))
The only issue I see is whether a valid insert was made before calling the 'vis' code.
-
isn't the first state in the list always the default state upon insertion?
-
If that works Chuck then you might want to include the strings in the original call to make the function more universal.
-
If that works Chuck then you might want to include the strings in the original call to make the function more universal.
error: bad argument type: lentityp #<VLA-OBJECT IAcadBlockReference2 01144c64>
:-(
See if this helps:
http://www.theswamp.org/forum/index.php?topic=7340.msg91197#msg91197
Tried it on a lighting fixture
(PushDBProps (vlax-ename->vla-object (car (entsel))) '(("Visibility" . "2x4 Emergency")))
worked flawlessly
thanks :)
Now to Frankenstein this bit o' work a bit, make it a little user friendly for my purposes ;)
-
worked flawlessly
Coolness! Have fun Dr.Frankenstein. 8-)
-
All I did was add this to my MNL
(defun SetVisState (state /) (PushDBProps (vlax-ename->vla-object (entlast)) (list (cons "Visibility" state))))
so, now, when I insert a dynamic block via a toolbar I just put one of these on the end
(SetVisState "2x2 Emergency")
and the world is a happier place ;)
Thanks! :)
-
I just realized that you can simplify a little more by eliminating 'vlax-ename->vla-object' from the argument list, since this conversion is handled in PushDBProp:
(defun SetVisState (state /) (PushDBProps (entlast) (list (cons "Visibility" state))))
Saves some screen space! :-)
-
I just realized that you can simplify a little more by eliminating 'vlax-ename->vla-object' from the argument list, since this conversion is handled in PushDBProp:
(defun SetVisState (state /) (PushDBProps (entlast) (list (cons "Visibility" state))))
Saves some screen space! :-)
I actually considered doing that, because I'm drawn to the method by habit. But I'm trying to get into the habit of seeing things in a VLA kinda way so I left it that way on porpoise :D
I'm actually gonna setup an entire popin-popout sequence to simplify things a bit more as it's not exactly a simple task to cut-n-paste one symbol's code into the next like I've been doing for the past 15 years :x
(thank you Autodesk) :realmad: