One of the most powerful features of AutoCAD is dynamic blocks. I mostly use this feature to create dynamic symbols that can be used in drawings, like Section arrows, 2D Pipe ends, North Arrows, etc. A Dynamic block allows you to dynamically change 2D Objects in various ways, like rotate, scale, move, show or hide.
The example below is one of my Dynamic blocks.
This Section Label can rotate in any direction and be used on any side using the grips identified on the image, but this is just a fraction of what dynamic blocks can do. I will try to demonstrate most of the functions I have used before by applying it to something a little bit more interesting than just creating drawing symbols.
Simple Dynamic Block:
So to begin with I created some 2D pipe sketches. I created an 80NB and 100NB Flange, Pipe, Tee and 90° Elbow. I could add every size available for a pipe specification, but for this example, two sizes are enough. My 2D Sketches look like the image shown below.
I create a normal block with my two flange front sketches in it and call it Flange_Front.
I do the same for my Flange, Pipe, Elbow and tee sketches and call them respectively Flange Side, Pipe, 90-Elbow and Tee so that I have five blocks in total. After that is completed I select my Flange Front block, right click and select Block Editor and the display should look something like this.
I will be using the Block Authoring Palettes highlighted to the left of the screen above. If it is not there click the Authoring Palettes button on the ribbon highlighted in the image above.
The first thing I am going to do is set up the Visibility Parameter on the Authoring Palettes to create grips that will let me pick between the two flange sizes. I select the Visibility Parameter on the Authoring Palettes and place it to one side of the flanges as seen below. I am going to move it later after the setup is complete.
Next, I go to the ribbon and select Visibility States option, which will open a new window where I can create the two sizes as shown below. I rename the first to 80NB and add a new one for the 100NB leaving the settings as is and click OK.
Now on the same visibility tab of the Ribbon, I make sure the 80NB is selected. Currently, everything is visible in the drawing area. Above the selection drop down there are three buttons.
The first button “Visibility Mode” enables or disables the visibility of all items. The second “Make Visible” is for selecting everything I want to make visible and the third “Make Invisible” is for selecting everything that I want to make invisible.
As everything is visible at the moment I will be using the third button to make the 100NB flange invisible under the 80NB selection. I click the button and select everything on the 100NB Flange Sketch.
When I press enter the 100NB flange disappears, leaving only the 80NB flange visible. I click on the first option “Visibility Mode” which allows me to still see the 100NB Flange but it appears darker than the 80NB Flange.
I can make anything visible again by selecting the second button and selecting the components that are dimmed out. Now I change the selection drop down on the ribbon to the 100NB selection and follow the same procedure as before but instead of selecting the 100NB sketch parts I select the 80NB sketch parts.
Now all I need to do is reposition the sketches and Visibility parameter at the block base point which us also the origin. For some reason, in the Block Editor, the move to @0,0,0 will not work so I always draw a line starting at 0,0,0 and then move my sketch to that point on the line and then delete that line.
I position the two sketches over each other at the origin of the block and move the Visibility Parameter to look something like the image shown below (Visibility Mode Enabled). I then select Close Block Editor option on the Ribbon and save the block.
My first dynamic block is complete. Now when I select my Flange_front block there is a square grip in the middle of the flange for moving the block around which is also the base point of the block. There is also an arrow drop down grip on its side for choosing the size of the flange. When I pick a size the block switches between the two sketches of my flange.
Making “Nested” dynamic blocks:
Now I do the same for all the other blocks, adding the Visibility Parameter to all of them and moving them over each other and to the Origin or Basepoint so I can change between the sizes and have a grip at a good place to easily move my blocks. Pay attention to the positions I placed the grips in the image below, the square grip is the Basepoint of the blocks and the down-pointing grip is the size drop down.
After adding the base point and visibility parameter I can start adding the other Parameters that will be needed to make this a basic dynamic pipe routing system.
Dynamic Blocks can be added to other dynamic blocks. We can add the two flange blocks together to create another dynamic block to select between the front and side view of the flange. The only drawback to this is if we want to change sizes then we will have to insert the block, select the view that we want, then explode it and then we can access the size (Only one visibility Parameter per block).
But if I go this route I could add all the different parts of a pipe specification into one block, insert it and select the component (Pipe, Tee, etc.) explode and select the view (Front, Side, etc.), explode and select the size and then place it at its desired place on the drawing so I only have to have the master dynamic block in my drawing and I will have my whole specification at hand.
Personally, I would prefer having the different pipe fittings & parts separate from each other and just choosing between the views, exploding and then choosing the size.
Any blocks can also be added to the Tool Palettes as well. All that is needed is a template drawing with all of the blocks in it saved to a folder that will not change and a drawing name that will not change.
Adding more parameters to Block:
For this next part, I am only going to work with the last 4 side view blocks. The front view flange block will not be used further in this exercise.
I open the Flange_Side dynamic block in the block editor. I am now going to make it rotate. To do this I click on the Visibility Mode button on the ribbon till I can see both of the side flanges over each other one dimmed out a bit. I need to set up the rotation for both sizes and make the Rotate grip visible for both.
Now I select the Rotate Parameter in the Authoring Palettes, I click on the midpoint of the front of the flange then I move out a bit and click again. Then I need to move the mouse cursor around the flange till it shows 360 degree rotation then click again. Now it should look something like the image shown below.
Notice the yellow exclamation box on the Rotation Parameter. This is because this Parameter requires an Action to go with it. Switch to the action tab on the Block Authoring Palettes, as shown in the image below.
I select the Rotate Action from the Actions tab of the Block Authoring Palettes. It prompts me to select the Parameter so I select the Rotation Parameter I just created. Then it will prompt to select all the items that we want to rotate. I select everything except the visibility Parameter and press enter. Remember that I need to see both flanges, both need to rotate, but not the Visibility Parameter, I want that to stay where it is.
Next step is to make sure that the Rotate grip is visible on both flanges. I am currently on the 80NB Flange so I change to the 100NB and use the Make Visible button and select the Rotation Parameter and the round grip and press enter to enable visibility for the rotation grip in the 100NB selection.
There is a Test Block Button on the ribbon as shown above that allows testing the Block in a new drawing window without closing the block editor. After testing the block you can close Test window and save the block, the final block should look like the image shown below.
I did same for the Pipe, Tee and 90-Elbow Blocks, to make them all rotate as shown in the image below.
Adding actions to the Block:
Now there is only one final step left to do before I can start assembling my dynamic pipeline using the parts I created. I open the Pipe Block in the block editor. On the Block Authoring Palette I go back to the Parameter tab and select the Linear Parameter.
Then with both of the pipe sizes visible I select the one endpoint of the top line and then the other endpoint of the top line of the 100NB Pipe sketch and move the mouse cursor up, like placing a dimension.
Then I go back to the Action tab on the Authoring Palettes and select the Stretch Action. It will prompt to select the parameter which I want to use, I select the Linear Parameter. Then it will prompt to select one of the two arrows on the Linear Parameter to indicate which direction I want to stretch in.
I choose the left one to keep the origin or basepoint at the end of the pipe sketch. After that, I need to select the object that needs to be stretched, similar to a normal stretch. Click below left of the bottom line of sketch and draw a box over all the left end points of my two pipe sketches just like the stretch command, so it looks like the image shown below.
You will notice that there is still an exclamation mark at the right arrow of the Linear Parameter. This is only because I can set up two stretch actions for one Linear Parameter if I want. For my purposes one is good. Remember to enable visibility on the linear stretch grip on both sides of the pipe so as to keep grips visible when we change the sizes of the pipe.
The Action function is represented by the small blue squares with a picture of its action. I will have to right click the rotation action to change my selection to include the Linear Parameter and stretch action so it will rotate with the sketch.
I just want to add a word of caution here, if you rotate or mirror a dynamic block with the normal commands it will make a mess of the dynamic features you added.
That’s it! My basic Dynamic 2D Pipe block is complete.
I can rotate all the components. I can change the size from 80NB to 100NB with minor position adjustments at the elbow that could be made easier by adding additional control points. I can stretch the pipe length to any length I want.
This is only the basics of what can be accomplished with dynamic blocks. The list of actions and parameters is long and they can be combined to form even more complex 2D blocks for use in AutoCAD.
3D dynamic Block:
Some of the parameters can also be used on 3D objects, but remember that a block is a 2D thing so you need to create the block in the correct view to perform the action you want on a 3D object.
If you create a block from a 3D object you need to be in one of the 2D views, Top, Left, Front, etc. and if you open the 3D block in the block editor you will only have that view you created to work with.
You can’t stretch a 3D object the same way you stretch a 2D object, so the Stretch action will not work. I have a 3D Manway/Access lid which I turned into a Dynamic Block to make the lid open and close.
I had to create the block in the left view and added the Rotation Parameter so the lid could open and close from the hinge. After it was created I could open and close the lid in 3D.
I think this is not something Autodesk envisioned when they added the Dynamic Block feature, but it is kind of cool to be able to do something like this in AutoCAD. It could be used for anything you want to rotate or any part you want to make visible or invisible.
I could just as easily have added a drop down to show the manway with the lid or without the lid or to remove the safety grating covering the hole.
I hope this will be of use to someone. It is something I learned in the beginning of my dealings with AutoCAD and it is one of the things I use every time I create a drawing in AutoCAD and something I almost miss in the Inventor drawing environment.
Do you have questions related to this article? Let us know in the comments below. This is a guest post, you can share your articles as well.