Dynamic Blocks

Dynamic Blocks

Reply
*T Bennett
Message 1 of 196 (10,234 Views)
Accepted Solution

You gotta try visibility-add-eng-v1.1

10234 Views, 195 Replies
07-10-2009 09:33 AM
Ok, the instructions aren't the clearest, however, when you get the hang of
it you'll love it. Try to make my valve (attached) without using this lisp
routine, you'll spend 10X longer.


Here are the steps I figured out:
------------------------------------------------------------------------------
Elements:
Lines, arcs, splines, attributes, text, etc.

1) Place all the elements. The location doesn't matter at first, so make
them easy to select by not stacking things on top of each other.

2) Add all the parameters/actions you want - DO NOT add any visibility
states or lookups yet. Make sure your actions affect the things you want,
and don't affect the things you don't want them to.

3) Load visibility-add-eng.lsp.

4) Add a visibility parameter using (visibility_add). Rename the parameter
accordingly.

5) Set this new visibility parameter active using (visibility-up). There is
a little problem with the program here. When you have one visibility
parameter active and you set a new one active, it gets hung up. Use the
visibility state pulldown and select a state. Note the command line will
ask you for a visibility state. Type ? to see those available, then type in
any name you want.

6) Add the states to the list of visibilities - DO NOT change the visibility
of anything yet.

7) Using (element-sel-current-del) select all the elements you do not want
to be affected when you change this particular visibility state.
For example: If I'm working on the "actuator" visibility states, I don't
want my valve type to change if a person wants to use a different actuator,
therefore, I will select every element that is not an actuator.

8) Now you can make elements visible or invisible in the states you've
defined. Do not bother changing the visibility of the elements you've
removed.
NOTE: if you draw a new object or copy something, it will not be removed
from any visibility sets.

9) Repeat steps 4 thru 8.
-----------------------------------------------------------------------

I did not list all the functions in this routine. Many I don't even know
how to use yet, or why.

Todd

I wouldn't have a clue - Andre's lisp is way beyond me. However, I have been continuing on with multiple visibility blocks by using the 2011 version of the program (v1.3, 24.10.09) in AutoCAD 2011. I can then go ahead and use the finished blocks in AutoCAD 2012-2013 without issues. I have written a little epilogue to the program in order to simplify calling the functions. It is a lot easier to do something like this so that you are not encumbered with entering autolisp lines at the command prompt. I keep a printout of this next to my workstation so I can refer to what the commands do - it simplifies using the program sugnificantly.

 

;;;turn functions into commands with simple calls
(defun c:EGO () (eval_graf_output));get ACAD_EVALUATION_GRAPH dictionary from the block editor space
(defun c:VA () (visibility_add));add a new Visibility Set parameter
(defun c:VU () (visibility-up));set selected Visibility Set as current
(defun c:NCVS () (tecuch_visibility));find name of current visibility state
(defun c:GON () (eddedd));switch on grips of all the elements of the current Visibility Set
(defun c:RFV () (element-sel-current-del));remove selected elements from the current Visibility Set
(defun c:RAFV () (element-all-current-del));remove all elements from the current Visibility Set
(defun c:AVS () (element-sel-current-insert));add selected elements to current Visibility Set
(defun c:VC () (Visibility_clear));complete cleaning of current state from all the elements, dynamic properties and states
(defun c:'SVAA () (properties_add_all_visibility));set visibility of all the dynamic properties and grips in all the states of all Visibility Sets
(defun c:BSVS () (move-to-visibilityset));batch set visibility of selected entities in several chosen states of the current visibility set

[note: Remove ' from before SVAA command defun - the discussion group sees the colon and capitol S as code to add a smiley!]

 

I'll include the instructions (copied and edited for my changes), as well as the tips that I've learned after using this for a year now to create hundreds of Multipe Visibility Dynamic Blocks.

------------------------------------------------------------------------------------------------------

Elements:
Lines, arcs, splines, attributes, text, etc.

1) Place all the elements. The location doesn't matter at first, so make them easy to select by not stacking things on top of each other.

2) Add all the parameters/actions you want - DO NOT add any visibility states or lookups yet. Make sure your actions affect the things you want, and don't affect the things you don't want them to.

3) Load visibility-add-eng.lsp.

4) Add a visibility parameter using VA(visibility_add). Rename the parameter accordingly.

5) Set this new visibility parameter active using VU(visibility-up). There is a little problem with the program here. When you have one visibility parameter active and you set a new one active, it gets hung up. Use the visibility state pulldown and select a state. Note the command line will ask you for a visibility state. Type ? to see those available, then type in any name you want.

6) Add the states to the list of visibilities - DO NOT change the visibility of anything yet.

7) Using RFV(element-sel-current-del) select all the elements you do not want to be affected when you change this particular visibility state. I do this by typing RFV, then entering ALL for the selection set, then removing my choice entities from the ALL selection set so only my choice entities get into the visibility set. For example: If I'm working on the "actuator" visibility states, I don't want my valve type to change if a person wants to use a different actuator, therefore, I will select every element that is not an actuator.

8) Now you can make elements visible or invisible in the states you've defined. Do not bother changing the visibility of the elements you've removed.
NOTE: if you draw a new object or copy something, it will not be removed
from any visibility sets.

9) Repeat steps 4 thru 8.

 

TIPS:

You can add new entities to an existing MVDB (multiple visibility dynamic block) by inserting, copy pasting or drawing them, then using SVAA to include them in the visibility sets. I find that this seems to add the new entities to every visibility set, so I have to make each one active (VU) and make unneeded entities invisible, or RVF them.

 

If after you add an additional visual parameter, you have trouble setting it current, just test the block and close the test window. VU will now accept it as the current state.

 

I can get a misbehaving block to recover sometimes by testing it in the test window, renaming it there with the rename command, copy-pasting it out and pasting it into a new drawing where I can open it in the block editor, reload the visibility engine and it will often work again.

 

Although we are not supposed to be able to, I can add a block table (block properties table) and still get multiple view parameters to work.  The trick is to add the table and not populate it with anything but one simple parameter – something like a linear move, just to get the grip to show up. Then once you have the block functioning correctly with every other parameter, test the block, rename it as a “build mule” (a good copy that you can fall back and restart on) in the test window, copy that mule out to a safe drawing, then go back to the block in the editor and populate the table with all the parameters you need. MVDB’s cannot tolerate user parameters (the kind that block property tables allow you to add ), so once you add some, you will not be able to do further editing  unless you open that block property table, delete the user parameters you made, wipe out the data in the table (I copy-paste my data to an excel spreadsheet for safekeeping, and paste it back in once I have the columns redefined properly), then close the block property table and use the parameter manager to delete the user parameters. Now you can edit the MVDB further and when you are ready, add the user parameters and data (from excel) back in and test. Once a block table is populated, the block will cease to function properly if further editing occurs, but further editing can be accomplished with the workaround.

 

I always use the test window and then rename my MVDB and then copy-paste out to my master drawing (called my dynamic block gene pool). The gene pool contains every MVDB I have in various stages of working iteration until completion. I have found this to be the best way to back up since using this lisp a lot can cause crashes when you try new ideas sometimes. I crash it 3 or 4 times a week, sometimes in a problem block, I might crash AutoCAD 10 times that day. But that’s how I learned enough to write these tips.


Hope this helps contuous use of this very helpful program.

Ron

 

 

*Jim Dee
Message 2 of 196 (10,219 Views)

Re: You gotta try visibility-add-eng-v1.1

07-10-2009 10:30 AM in reply to: *T Bennett
This is really cool! There are so many blocks where I need multiple
visibility states. I only discovered this two days ago and I've already
started making more powerful DB's. I too have notice that you need to
construct the DB in a very deliberate way for it to work, but once you
figure that out its great!



Thank you,

Jim Dee

www.caddee.com



"T Bennett" wrote in message
news:6216794@discussion.autodesk.com...
Ok, the instructions aren't the clearest, however, when you get the hang of
it you'll love it. Try to make my valve (attached) without using this lisp
routine, you'll spend 10X longer.


Here are the steps I figured out:
------------------------------------------------------------------------------
Elements:
Lines, arcs, splines, attributes, text, etc.

1) Place all the elements. The location doesn't matter at first, so make
them easy to select by not stacking things on top of each other.

2) Add all the parameters/actions you want - DO NOT add any visibility
states or lookups yet. Make sure your actions affect the things you want,
and don't affect the things you don't want them to.

3) Load visibility-add-eng.lsp.

4) Add a visibility parameter using (visibility_add). Rename the parameter
accordingly.

5) Set this new visibility parameter active using (visibility-up). There is
a little problem with the program here. When you have one visibility
parameter active and you set a new one active, it gets hung up. Use the
visibility state pulldown and select a state. Note the command line will
ask you for a visibility state. Type ? to see those available, then type in
any name you want.

6) Add the states to the list of visibilities - DO NOT change the visibility
of anything yet.

7) Using (element-sel-current-del) select all the elements you do not want
to be affected when you change this particular visibility state.
For example: If I'm working on the "actuator" visibility states, I don't
want my valve type to change if a person wants to use a different actuator,
therefore, I will select every element that is not an actuator.

8) Now you can make elements visible or invisible in the states you've
defined. Do not bother changing the visibility of the elements you've
removed.
NOTE: if you draw a new object or copy something, it will not be removed
from any visibility sets.

9) Repeat steps 4 thru 8.
-----------------------------------------------------------------------

I did not list all the functions in this routine. Many I don't even know
how to use yet, or why.

Todd
*Jason Piercey
Message 3 of 196 (10,218 Views)

Re: You gotta try visibility-add-eng-v1.1

07-13-2009 07:37 AM in reply to: *T Bennett
Are you confident such modifications will survive in other versions of
AutoCAD? I glanced at the code which all seemed very confusing.
I didn't spend enough time with it to determine what it is actually doing
but I hope for the sake of your time, all your new and improved blocks
don't fall apart or cause corruption.

Good luck.



"T Bennett" wrote in message
news:6216794@discussion.autodesk.com...
Ok, the instructions aren't the clearest, however, when you get the hang of
it you'll love it.
*T Bennett
Message 4 of 196 (10,218 Views)

Re: You gotta try visibility-add-eng-v1.1

07-20-2009 10:59 AM in reply to: *T Bennett
No problem. At the pace our company upgrades, we shouldn't have to worry
about it for about 10 years.

Win XP Pro SP2
P4 3.06
AutoCAD 2006

Todd


"Jason Piercey" wrote in message
news:6217508@discussion.autodesk.com...
Are you confident such modifications will survive in other versions of
AutoCAD? I glanced at the code which all seemed very confusing.
I didn't spend enough time with it to determine what it is actually doing
but I hope for the sake of your time, all your new and improved blocks
don't fall apart or cause corruption.

Good luck.



"T Bennett" wrote in message
news:6216794@discussion.autodesk.com...
Ok, the instructions aren't the clearest, however, when you get the hang of
it you'll love it.
*T Bennett
Message 5 of 196 (10,218 Views)

Re: You gotta try visibility-add-eng-v1.1

07-20-2009 04:17 PM in reply to: *T Bennett
The best solution is for AutoDesk to just add the flexibility of multiple
visibility states. Until then, I'm going with this.

Is anyone using it in AutoCAD 2010 or later?

Todd


"Jason Piercey" wrote in message
news:6217508@discussion.autodesk.com...
Are you confident such modifications will survive in other versions of
AutoCAD? I glanced at the code which all seemed very confusing.
I didn't spend enough time with it to determine what it is actually doing
but I hope for the sake of your time, all your new and improved blocks
don't fall apart or cause corruption.

Good luck.



"T Bennett" wrote in message
news:6216794@discussion.autodesk.com...
Ok, the instructions aren't the clearest, however, when you get the hang of
it you'll love it.
Valued Contributor
NikolayPoleshchuk
Posts: 60
Registered: ‎06-27-2006
Message 6 of 196 (10,218 Views)

Re: You gotta try visibility-add-eng-v1.1

07-20-2009 11:14 PM in reply to: *T Bennett
In AutoCAD 2010 it is OK.
I'm preparing visibility-add-eng-v1.2 where some inaccuracies will be removed.
Nikolay Poleshchuk
http://poleshchuk.spb.ru/cad/eng.html
Valued Contributor
NikolayPoleshchuk
Posts: 60
Registered: ‎06-27-2006
Message 7 of 196 (10,218 Views)

Re: You gotta try visibility-add-eng-v1.1

07-28-2009 02:29 AM in reply to: *T Bennett
Version 1.2 is added. See commentary here: http://poleshchuk.spb.ru/cad/2009/tainypod12e.htm
Nikolay Poleshchuk
http://poleshchuk.spb.ru/cad/eng.html
*T Bennett
Message 8 of 196 (10,219 Views)

Re: You gotta try visibility-add-eng-v1.1

07-31-2009 05:11 AM in reply to: *T Bennett
Cool, I'll try it when I get a chance.


wrote in message news:6225878@discussion.autodesk.com...
Version 1.2 is added. See commentary here:
http://poleshchuk.spb.ru/cad/2009/tainypod12e.htm
New Member
rafa.fiss
Posts: 1
Registered: ‎07-29-2009
Message 9 of 196 (10,219 Views)

Re: You gotta try visibility-add-eng-v1.1

07-31-2009 10:57 AM in reply to: *T Bennett
Hello,

This is what I was looking for!

well, I have some doubts. still cannot make this work.

after I add a visibility with visibility_add, what should I do?

if I try to use the visibility up, I can not select the visibility parameter that I added before.

if I try to add another parameter visibility, the program returns error.

what am I doing wrong?

I sending the file that I'm working. I want select what the elements in the legend I want.

Sorry for the errors, I'm brazilian and I don't speak english very well. Google Translate help me #) Edited by: rafa.fiss on Jul 31, 2009 5:58 PM
Valued Contributor
NikolayPoleshchuk
Posts: 60
Registered: ‎06-27-2006
Message 10 of 196 (10,219 Views)

Re: You gotta try visibility-add-eng-v1.1

08-01-2009 01:20 AM in reply to: *T Bennett
AutoCAD sees only one visibilty parameter in the Block Editor while editing its visibility states. This parameter is at the top of an internal vis-parameters list.
So you cannot edit visibility parameter until it becames up on the top in the block definition. If you want to do something with a parameter you should first make it uppest (use visibility-up) and only then edit it. After that you can put another vis-parameter to the top (use visibility-up again but pick another parameter) and then edit it.
And so on.
Nikolay Poleshchuk
http://poleshchuk.spb.ru/cad/eng.html
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.