The Reference Template Tool in Civil 3D employs provides us a different approach to the consistent delivery of effective, production Civil 3D Templates and Known Good Style collection resources. The Reference Template (TREF) Tool allows us to assemble Civil 3D resource targets, partially manage them, and deliver standardized resource targets by reference.
The Reference Template (TREF) Tool is one excellent reason we employ the term target to help differentiate the various drawing forms utilized to construct and manage Civil 3D Style collection container drawings and assembled Civil 3D Templates.
Our initial target Civil 3D Reference Template is demonstrably a Minimum Viable Product (MVP) - A functional collection of Civil 3D Styles Civil 3D Labels Styles, Civil 3D Sets, and other Civil 3D resources that embrace the various necessary conditions to support our production work in Autodesk Civil 3D.
Styles Delivery in Civil 3D
In the Civil 3D Reference Template (TREF) implementations, project and publication drawings inherit one or more Reference Template Style and Settings collections and AutoCAD Style resource drawings from a Civil 3D Template (.dwt) file on creation. Project drawings inherit the attached TREF references to Style collections via one or more TREF target(s).
Use of the Reference Template (TREF) Tool functionality increases initial drawing open time, but increases the consistency of the Style resources delivered.
The Civil 3D Template Classic Targets post discusses the methods, major tools, processes, and nuances we need to understand to begin the construct better resource drawings (Style collection targets) that may be employed in Reference Template Targets.
The earlier Civil 3D Template Targets post covered recommendations for the details of Reference Template stack structure and mechanics for building Reference Template Targets in considerable detail.
Let’s review some important Civil 3D TREF behavioral nuances not covered in-depth there.
Reference Template Targets
If we employ Template targets that employ the Reference Template Tool and one or more resources in the Reference Template stack, the managed Civil 3D and AutoCAD Styles referenced are always dependent and conform to those in the attached source drawings.
TREF target implementation can substantially increase Civil 3D standards consistency and simultaneously reduce Style maintenance man-hours in the Civil 3D project environment.
The TREF target availability, naming conventions, and storage structure each play significant roles in our Reference Template implementations in our Civil 3D production environment(s).
Proper System Management of the Template targets and of the external target resource drawings means our project drawing Style resources will remain current with those external resources.
The Reference Template Tool’s Settings options for each resource may create the illusion that By Selection on the Tool’s Settings tabs is a best practice. This is not necessarily so.
The overuse of Settings By Selection tends to create a garbage in and garbage out problems and confusion about the real Known Good sources. Visualize a complex Venn diagram with 5 or more over-lapping circles and many intersection areas.
Simply put, By Selection may substantially complicate the where the Known Good resources come from problem for Civil 3D users.
See the above-mentioned Civil 3D Template Targets post for solutions.
These issues do not mean that the use of Settings By Selection isn’t a good way to test and identify those same selections in your TREF target development efforts. We do not want to stop there because cleaner and clearer separations of resources tend to work better for Civil 3D users. The software doesn’t care.
Reference Update Mechanics
Let’s recall that Civil 3D will inject the Object Model and default code-built Standard Styles and Settings into any drawing that does not include it. Therefore, the Reference Template (TREF) Tool must be employed in a .dwt that is already setup with Civil 3D’s typical requirements.
Practically, it is important to recognize that the Reference Template target (.dwt) itself should contain:
- Units and optional Coordinate System setup
- Civil 3D code-constructed Standard Styles and Settings
- Layer Standards and Layer States resources
- Base AutoCAD Styles - Shared Block libraries, Shared Textstyles, and other standard AutoCAD Style resources – Dimstyles etc
- Then…a TREF or stack of TREF of resources
In effect, the target container Reference Template (.dwt) file is an acad dwt file in the appropriate STB or CTB publish system with some Civil 3D base specifics set up. No mysteries here.
See the Civil 3D Template Targets post for more details.
From a maintenance and upgrade perspective, we can manually control the TREF Tool’s synch behavior for a .dwt template file in the Set Reference Template Defaults dialog box found in the Manage Ribbon and Styles panel. The Set Reference Template Defaults dialog box interface basically mimics the TREF Tool’s Settings By Selection behaviors.
We must also understand the nuances of the AeccRefTemplateAutoUpdate system variable:
- 0 - Turns off automatic updates.
Notifications are displayed to alert you when reference template components need to be updated.
- 1 - Turns on automatic updates of components from reference templates.
This is the default setting.
- 2 - Turns off updates of existing layers only.
Existing layers in the host drawing are not updated automatically and they are not updated if you click Apply or OK in the Attach Referenced Template dialog box.
When we employ this value, existing layers in the host drawings are not overridden by layers in the Reference Template.
New layers that are referenced by Styles or Settings in the template are referenced into host drawings, but if existing layers are in the host drawings, those existing layers are not overridden.
The AeccRefTemplateAutoUpdate setting of 0 does not function as advertised in some Update releases of Civil 3D.
We generally want automatic TREFs enabled to reduce load time and perhaps on Open notification chatter. However, this setting currently also disables notification of load failure to Civil 3D users.
The system variable default setting of 1 does not mean that Civil 3D users are warned if a TREF reference is unavailable.
Civil 3D users must remain accountable to check for unresolved references in the TREF Tool.
The Civil 3D Toolspace Settings interface currently does not identify unloaded TREF Styles.
Post Reference Template Setup Mechanics
If the Reference Template (TREF) Tool cannot locate an attached source drawing on load or on a manual Update in the TREF Tool, the Styles in the current drawing will remain functional and are temporarily localized.
How we choose to employ this TREF default update behavior or be controlled by that poses important questions we need to consider.
If the TREF source drawing cannot be found, the referenced components are still available in the drawing that references them, but they will not be updated until the path to the source including a file name is restored.
- If the reference template has been deleted, the referenced components will remain in the drawing that references them.
- If we are temporarily not able to access the path, the referenced components will still be available in the drawing that references them.
The referenced components will not be updated until our connection to the defined path and source file is restored.
- If the name or location of the source has changed, we can change the path in the dialog box by double click to edit the path in the Saved Path column and/or by the browse button to reselect the location and a source drawing.
Reference Template Style Updates
That final important bit means that we can Update (change) the TREF Style content by changing the file resources or locations provided we effectively manage the Style naming conventions, TREF files, and TREF path locations systematically.
We cannot currently easily employ the Reference Template Tool to attach Style reference resource drawing and then use the Reference Template Tool to detach that reference to leave Styles that are not in use in a drawing.
A delete of the TREF source drawing in the TREF Tool interface might technically accomplish this, but detach also leaves broken and unresolved reference attachment references in the drawing.
There are other safer and more stable and documented methods to add Style collections to targets.
Detached TREF Maintenance Issues
Reference resources manually detached in the Reference Template Tool interface may leave some nested Civil 3D Styles in a drawing. Employ the Style Purge command after detaching references that include Civil 3D Style references. Obviously, Styles of any type deemed to be in-use will not be purged.
Those Other Important Style Maintenance Tools
The Civil 3D Style Import and Maintenance Work post elaborates the use of the Style Import Tool and those mechanics. The limitations of the tool and the need to employ the Style Import Tool in conjunction with other tools (like Style Purge) and processes (like Insert/Explode and/or the Block Palette Tool) cannot be ignored.
The Civil 3D Style Purge command mimics the basic behavior of the classic AutoCAD PURGE command and the command line interface variant -PURGE.
- Style Purge will remove any Style deemed to be not in-use in a drawing.
- Multiple passes of Style Purge need to be run to remove all the referenced Styles.
If we manually delete Civil 3D Styles in our Style collection resource drawings, we should routinely employ Style Purge to remove potential nested Style references.
Style Purge is Not Permanent
Words of caution: PurgeStyles will also purge Standard Styles too.
We can and should employ the Style Import Tool in our post PurgeStyles procedure to slap these vital Standard Styles and the default Civil 3D Settings back in.
We want the cleaned and finished publication or target drawing to stay stable.
Reset Settings to Standard Style Defaults
Style Purge also cannot remove Styles and Sets currently referenced in Command and Feature Settings. They are referenced and are in use.
Employ the Style Import Tool with the Import Settings box checked before the Style Purge Tool to import a set of Settings and Command Settings that employ only the default Standard Styles.
- We employ a Style Import before our Style Purge with the Import Settings checkbox checked.
- We import from a dwg or dwt with the Command and Feature Settings all set to Standard.
The Style Import rids our drawing of unnecessary Command and Feature Style settings first. Repetitive Style Purges will then be more effective more quickly.
This Settings import action will remove other named Style references in a drawing and significantly reduce the number of in-use Styles.
The Framework for Civil 3D supplies NoStyles templates with this naked Civil 3D code-built resource with all the Standard Styles. A Framework NoStyles drawing template includes these default Civil 3D code-built Settings.
We can recreate one ourselves by starting Civil 3D from the appropriate raw AutoCAD template (.dwt) file. We probably want to set up Units and perhaps some other essential system variables, etc.
Here is another way in which we may find the Purge Styles command to be useful.
Identify Styles for a Publish Template Known Good
The PurgeStyles (Style Purge Tool) allows us to get rid of most of the unnecessary Civil 3D Style references in project drawings.
- We can employ PurgeStyles to FREEZE the current presentation of Civil 3D Features to one fixed FORM or Set of Styles in a drawing or a set of project drawings.
- PurgeStyles allows a method to build a Set of publishing Styles – aka those somewhat elusive publish standards.
- If our projects are complex, we will want to divide and conquer the disassembly outlined here and reassemble the results.
- The KISS result is great for publication, reduces confusion, and can improve our presentation and annotative consistency.
Label Style Defaults and The Purges
We should certainly employ Label Style Defaults (LSD) to standardize Label heights and other Label Style properties for particular Types of Styles in our production/working target(s).
Purge Styles and PURGE realities may require us to create and/or edit a naked Settings and all Styles resources to set up Standard prototypes with our typical LSD in place.
It can be easy to overlook the obvious.
The most common method to reduce Style complexity and numbers in a drawing or template is to simply Delete the Styles from the drawing.
- Only Styles deemed not in-use may be deleted.
References to Styles in Settings and Command Settings also make Styles display as in-use.
- See the hint in Reset Settings to Standard Style Defaults above
In the Civil 3D Toolspace >>Settings Tab>>in any Style collection
Select any not in-use Styles hit the Delete key (or the right click menu>>Delete) to remove the selected Style reference(s) from the drawing.
For Label Style collections where with Parent Styles that include Child Style collections we should first delete the child Styles before we delete the Parents.
More often than we expect in Civil 3D Style maintenance and improvement practice, it is easier to assemble target resources to establish consistency and then separate and delete Styles to categorize and manage the Style Tool collections more efficiently.
Find Style References Tool
We can locate where Styles in-use in the current drawing with the Find References pick in the Toolspace>>Settings tab in the Right click menu.
From the resultant References dialog box, we can both navigate to the Style reference in the Toolspace or employ the Style Replacement Tool.
Style Replace Tool
In the Civil 3D Toolspace>>Settings tab in the Right click menus of style and/or the References dialog box listing of in-use Styles references, Pick Replace and we can replace one named Style may be with another named Style reference from a list of available Styles.
Both Civil 3D Style and Label Style references can be changed with the Style Replace Tool.
- Currently, there is no command to Replace all Style references, collections of Style references, or all Styles in a drawing with the default Standard reference.
In other words, there is no easy way to remove all custom style references in a drawing without employing the Replace command repetitively.
- Therefore, it is usually the best practice work on a copy of the drawing.
Purge all unused Styles from the drawing.
Reimport the Standard Styles from a NoStyles drawing.
Manually Replace all the remaining Styles as required.
For deeply nested Styles in may be necessary to sequentially and repetitively perform this PurgeStyles and ReplaceStyles process.
For some specific Civil 3D Features, there are Ribbon-based Style replacement tools (based on the Replace command) that may be employed to replace all references to one type of Style with another.
Post Style Edit, Import, and Purge Process
After any set of Style Import, Addition, Purge, or Deletion processes always remember to post process the target drawing resource.
- Save the drawing
- Run the AutoCAD AUDIT without fixes.
If errors show up, run the AUDIT again with fixes
- Employ the command line interface -PURGE command
- Purge any unnamed block resources from the drawing
- Purge all the Regapps from the drawing
- Save the drawing to overwrite the previous version – do not use QSAVE
The fact that we need Style collection libraries and file structures to store the external Known Good Style collections cannot be overlooked.
Release the Power Beyond the Code
Get the Framework for Civil 3D Release 8
The Civil 3D Style Maintenance Handbook Post Series
Updates, additions, and fixes to the posts in this series are on-going.