Fields are a very powerful way to keep annotation information up-to-date. Simple fields can display all sorts of data including, object data properties, AEC project data, Sheet Set data, etc. These fields are well known, and most people are comfortable using them, so for this blog post, I would like to speak about nested fields that some may find useful.
In this example, my goal is to create a total parking count field that is dynamically linked to the drawing data so that we do not have to recount all parking counts manually.
I am using a custom block that automatically displays parking counts by utilizing an attribute composed of a field, after which I am going to use the DATAEXTRACTION command to pull the attribute data to be used in our field.
I will not go through the data extraction process in great detail in this post, however I do want to mention that during the data extraction wizard I made sure that identical rows were not combined, and I also created a new formula column with a sum footer added to it. This ensures that every time I re-run the data extraction, parking totals are at the bottom regardless of how many rows are in my data extraction table. An example of this is shown below but remember that data extraction is not imperative to the concept of fields within fields and are only shown for clarification for this exercise. For more information on the DATAEXTRACTION command, please refer to Civil 3D help files by pressing F1 from within AutoCAD.
Upon completing the Data Extraction wizard, I am presented with the option to drop a table into my current drawing, which I have done, allowing me to target the sum footer in our field.
In the example above, you can see that we are creating a field at the end of our text string “TOTAL PARKING COUNT = ”. In the field dialog box on the right, you can see that I am using the Objects field category, Formula/Cell. This gives us the formula ending, in this case, with B4. The B4 is in reference to the tables columns and rows, B referencing the second column, 4 referencing the fourth row. Keeping in mind that this table could add or remove rows based on the number of blocks found within the drawing, we need the B4 element to change based on how many rows there are, which means that the 4 needs to update based on how many rows the table has. To achieve this, we are going to convert the 4 into a field that updates semi-automatically.
To make this semi-dynamic field, highlight the 4, right-click and choose “Insert field…” which brings up another field dialog box. In this new field dialog box, chose “Objects” for the field category, Object for the field names, chose the table, then used the Rows property. Keep in mind that which properties you choose depends on your situation.
After clicking on OK, you should now see that the 4 has a grey background indicating that it is a field.
Now that our field within a field has been created, we can now get totals quickly and accurately. One thing to keep in mind anytime dealing with fields; you must regenerate your drawing to force fields to update their data. This means that anytime you change the data, in my case, the number of parking spaces, you may need to regen before and after updating your data extraction link, hence the previous use of the phrase “semi-dynamic”.
Now that the TOTAL PARKING COUNT field within a field has been created, the following workflow is used to update it:
- Execute the REGENALL command
- This initial REGENALL updates the parking count indicator within the block itself.
- This step is not needed if your data extraction does not extract data from a field as my example does.
- Update the data extraction
- Select the table, right-click and choose “Update Table Data Links”
- Or, select and right-click on the data extraction via the external references palette and choose “Update Data Extraction”
- Execute the REGENALL command
- This final REGENALL is used to update the TOTAL PARKING COUNT MText field, our end goal.
Below are 3 examples of the same field and data extraction semi-dynamically updated.
As you can see, fields can utilize other fields to help you cope with any dynamically changing information needed for field creation. In this example I used a combination of custom blocks with attributes, but the general idea of using fields within other fields opens the doors to some unique applications for these complex fields.
About the Author
Follow on Linkedin More Content by Archie Dodge