I have been working on a custom class called Advanced Blocks, it'll have elements from level 2 & level 3 classes. In that class I'm going to be showing people how to add attributes to blocks, how to extract them, and how to add Dynamic functions to blocks. With this in the back of my mind, I was looking through my archives and I realized that I haven't written about Dynamic Blocks yet.
So let me start out with something easy, and you can build on it from there. You could even call it building blocks...
When you first create a block, there is a an additional checkbox marked "Open in Block Editor", it's only been there since AutoCAD 2006. (I mentioned the block editor when I wrote about how you could edit blocks in AutoCAD LT without exploding them. Creating Dynamic Blocks is actually the original intended use for the Block Editor) Anyhow, check that box and as soon as you hit OK you'll be inside the Block Editor.
I drew a triangle with a circle on top of it and made that into a block, just for something to work with that was simple enough that you all could imagine it being something else, something you could use.
To give a block Dynamic Functions, and that cool lightning bolt in its preview, you need to add a Parameter, and to that Parameter you add an Action. That's about it, really. Let me show you with my simple shape here.
I chose the Parameters tab of the Dynamic Blocks Palette, and from the list I picked " Flip Parameter". Inserting this Parameter is a 2-click process. On my block I picked the edge where I want it to flip, and then picked directly above it to determine the direction it would go- in this case, my block will flip on a vertical axis. If I had picked a point to the right or left, the triangle would have flipped up and down.
The next step is to add a Flip Action to the Flip parameter (these two work together). Select the Flip Action from the palette; your command line will tell you to select a parameter. The Parameter is showing an exclamation mark until you give it an Action, so it's kind of hard to miss. Once you pick it, you're prompted to select the objects you want to flip. In this picture I'm selecting the 2 triangles. Then you just need to place the action someplace near the flip arrow.
Next, I selected the Parameter and opened up the Properties Palette. Under the Heading "Property Labels", I edited the Flip Description to read "Triangle Flipper". Whatever you type there is what you'll see when you hover over corresponding grip, in this case the flip grip.
I usually save and close the block at this point, and test it out in my drawing. It works!
Now, just for fun, I'm going to make that circle on top scalable, as if it might need to be adjustable. I double-click on the block ( that will open the Block Editor) and click OK after I check to make sure the correct block name is in the dialog box.
First I add a Linear Parameter, from the bottom quadrant of the circle to the top.
I'm adjusting it's Properties as you can see from the picture, very similar to what I did with the Flip parameter. This time, however, I want to adjust the Value Set - I set the Distance Type to Increments, the Distance Increments to 0.2, Minimum to 0.4, and Maximum to 1.2. This defines the sizes that my circle can become.
Next I add a Scale Action to the Linear Parameter, the one I renamed 'Diameter'. When I add the Action, I pick the circle when my command line asks me to Select objects, and then of course hit "Enter" to end the selection process.
Pick a spot for the Scale Action to sit, and you're done!
Save, close the block editor, and insert a few of your new fancy dynamic blocks to test them out.
In the picture on the right, I'm showing how the circle size can be adjusted. It works perfectly, just the way I wanted it to!
I hope this give you some idea of how easy it is to add Dynamic Functions to a block, and also that it gives you some ideas of how you could build some of your own. If AutoCAD has a Fun part, I promise you, this is it!