Artículo
Civil 3D: Tips, Tricks, and Unnatural Acts

Introduction

This article is dedicated to productivity techniques and tips that will help improve your daily operations when working with Civil 3D software. These include automating regular tasks, using standard functions in new ways, exploring underutilized features, and even exploiting a handful of undocumented commands. We'll present the information using a real-world problem-solving context, rather than simply going feature by feature, so you can fully appreciate the 'why' in addition to the 'how.' 

We present resource information here to help supplement what is covered in the recorded portion of the class. The article will not contain step-by-step instructions on executing commands. In this year’s edition, we've broken up the content into three acts. Act one includes the content (scenes) covered by Jerry Bartels. Act two is dedicated to Alan Gilbert’s content. Act three includes the material presented by Jeff Bartels.

Note that we're using Civil 3D 2021; however, everything we cover will be applicable to past versions of Civil 3D. In other words, if you are not using the most recent release of Civil 3D, that will not be a problem. If for some reason we delve into any content that is specific to Civil 3D 2021, we will be certain to point that out. When working the data sets, we generally rely on examples that are abstract. We do this intentionally because we want to focus on using a particular tool and not on a specific design situation.

Cyber City
Image courtesy of Dawn Digital.

Act One: Jerry Bartels

Scene One: Creating Custom Content

In this portion, I walk through the process of creating custom linetypes within Civil 3D. This includes linetype definitions including text and symbols.

Why

While Civil 3D ships with default content, it may not always include what you need to meet your requirements or match a particular standard out of the box. Additionally, once custom linetypes are being used, we need to make sure that they are portable. Have you ever opened a file and received the missing .SHX error? Me too! It is never fun, especially if it is your client who is seeing it when looking at your files. (Missing .SHX files are not always text fonts.)

11

How

Creating custom linetypes is actually easier than you think. I begin by creating a new drawing and setting the LTSCALE variable to 1. I then create a dashed or hidden line to use as a reference. This standard dashed line is a visual reference I can use when creating my new linetypes.

From there, I literally draw how my new linetypes should look. In this case, I created a custom skip-dash line, a custom line with text and two custom lines containing symbology.

2

After I create my geometry, I then use two Express Tool commands to convert my geometry into custom linetypes. These tools include Make Linetype (MKLTYPE) and Make Shape (MKSHAPE).

Using the MKLTYPE command, I can simply select the geometry and text to create new linetypes containing line segments only or line segments containing text. The workflow to accomplish this is shown multiple times in the session recording.

Key Takeaways

  • When you create a custom linetype using the MKLTYPE command, it creates a new .LIN file for each linetype. Unfortunately, it will not append to the end of an existing .LIN file. As a result, if you make 10 custom lines, you will have 10 new .LIN files. (Don’t worry, we will talk about how to merge them later.)

  • When creating a custom linetype containing text, the text style you use must have a height of 0. If the height is set to something other than 0, the text height will not update properly when changing LTSCALE. (You will end up with microscopic or giant text.)

If my custom linetypes include symbology, I must first convert that symbology into a SHAPE. I accomplish this by using the MKSHAPE command. Once the symbology has been converted and then reinserted as a SHAPE, I can use the MKLTYPE command to create the new custom linetype. The workflow showing how to use the MKSHAPE together with the MKLTYPE command is shown multiple times in the session recording.

Key Takeaways

  • When you create a SHAPE using the MKSHAPE tool, a corresponding .SHP and .SHX file are created. The .SHP file is the code necessary to define the SHAPE. (You can view this in Windows Notepad.) The .SHX file is a compiled version of the .SHP and is the file AutoCAD/Civil 3D will refer to in the future when calling the SHAPE. Note that because the .SHX file is what the system will use in the future, the .SHP files are no longer required.

  • Every time you create a new SHAPE, .SHP and .SHX files are created. In other words, you cannot append them together automatically when created. As a result, if you create 10 custom SHAPES, you will have 10 .SHP files and 10 .SHX files. (Don’t worry, we will talk about how to merge them later.)

Now that our custom linetypes are created, we are done. In the future, if we would like to use one of these new custom linetypes, we can access the appropriate .LIN file (as long as your system can locate any required .SHX files) and choose the custom linetypes we would like to use. I add the caveat because the inability to find the .SHX file will cause the resulting custom linetype containing a SHAPE to fail.

Technically, we are done but we are left with a stack of .LIN, .SHP, and .SHX files. We also have the previously mentioned caveat to deal with. Good, but certainly not great.

Let’s Make It Better

First, let’s simplify things. We will begin by merging all of the .LIN files into a single .LIN file. We will do this using Windows Notepad and copy/pasting. The complete workflow is shown in the session recording. When finished, we have a single .LIN file that contains all of our new custom linetypes.

3

Key Takeaways

  • Each custom linetype is defined by two lines in the .LIN file.

  • Make sure that you do not leave any blank lines or extra characters between line definitions when doing your pasting.

  • When using this .LIN file in the future. If you receive an error, the system will tell you exactly which line number contains the error. Because you created this file using cut and paste, the error will generally be the result of missing or unnecessary characters.

Next, we will merge all of our custom .SHP files together into a single .SHP file. We will accomplish this using the same process we did previously. Back to Windows Notepad. When finished, we have a single .SHP file (in this case called AUMaster.SHP).

4

Key Takeaways

  • Besides cutting and pasting, you will need to perform one edit. At the beginning of each SHAPE definition, the file contains an index number. Because each .SHP file we created only had a single SHAPE definition, all of your files will have an index number of 1. All you need to do is increment this number by 1 for every additional SHAPE definition you add to the file. (If you look at the graphic above, you will see I changed the index number from *1 to *2.)

  • Make sure that the last line in the file ends with an Enter.

Once the combined .SHP file is complete, we need to compile it into an .SHX for us to be able to use it. This process is shown in the session recording. It is accomplished using the COMPILE command in Civil 3D. Essentially, you run the command and then select the file you want to compile. Like before, if you made a mistake, the COMPILE command will tell you exactly which line number it is on.

Finally, we need to perform a small edit to the .LIN file so that it points to our new AUMaster.SHX file anytime it requires a .SHP. This is another simple Windows Notepad task.

5

If you compare the graphic above to the previous graphic of the master .LIN file, you will see that I replaced the two “fixed path” locations with our new AUMaster.shx name.

We have now successfully consolidated all of our files such that we have a single .LIN and a single .SHX file. From this point forward, when sharing .DWGs with your clients/subs, you need only provide them a single .SHX file (rather than a folder full of them). You don’t even need to share the .LIN file unless you would like them to be able to use your custom linetypes in new .DWGs of their own.

In the session recording, I show how to add your new files to the AutoCAD/Civil 3D 'support files folders' using the OPTIONS command to make them even easier to find and use. I’m not going to document that process here as it is in the video and I’m pretty sure most folks already know how to do that.

If You Don’t Have the .SHP Files Anymore

I can already hear some folks asking, “Jerry, where were you 10 years ago when I created all of my custom linetypes?” In the past, some folks may not have been aware that .SHP files could be consolidated into a single .SHX. As a result, when sharing their .DWGs, they need to include a stack of .SHX files. (Certainly not as portable or elegant as only needing a single file.)

The quick answer would be for them to just compile them now. However, if you remember from earlier, once the .SHX files are created, the .SHP files are no longer necessary. Over time, “unnecessary” files are often deleted. Is there any way to consolidate a stack of .SHX files into a single .SHX file without the .SHP files? Unfortunately, no.

Still, there is hope. There is a relatively unknown Express tool that can help. I believe it is the only external Express tool, which is why most folks have never seen or heard of it. The tool is called DUMPSHX. The tool’s only purpose is to decompile .SHX files back to .SHP files.

Knowing this, if we can convert our existing .SHX files back to .SHP files, we can use the consolidation process we used earlier to create a single all encompassing master .SHX file.

Where to Find the DUMPSHX Tool

If you are using Civil 3D 2021, it is under C:\Program Files\Autodesk\AutoCAD 2021\Express

7

How to Use the Tool

First, copy it to the same folder as your .SHX files.

The command syntax is as follows.... Dumpshx -o output filename input filename So to decompile Custom.SHX, you would run Dumpshx -o Custom.shp Custom.shx

How to Use the Tool with Windows

Unfortunately, you can’t. Because of the tool’s “vintage,” it must be run in DOS. To accomplish this, you must run CMD in Windows to launch the Command Prompt Window. From there, you will need to navigate to the folder that contains your .SHX files and DUMPSHX tool. Once there, you will run the tool for every .SHX file you need to decompile. After writing it down, it seems both simple and complex (because of the DOS). Don’t worry, I walk through the entire process in the session recording.

Scene Two: Searching Contents of Multiple DWGs

In this portion, I walk through the process of searching a folder full of .DWGs for a .DWG containing a specific Text String.

Why

Sometimes we need to locate (usually older) drawings based on limited information--in some cases, just a vague memory. This information can include a street name, client name, subconsultant name, project name, etc. For example, I may remember the model was adjacent to Roosevelt Road, but I don’t know which one it is.

Wouldn’t it be great if we could just point AutoCAD/Civil 3D at a folder of files and have it quickly search the contents of every file for any containing Text or Mtext using the keyword Roosevelt? We can!

How

We will accomplish this by exploiting the DATAEXTRACTION tool. If you have used DATAEXTRACTION tool in the past, it is truly an incredible tool. It allows you to quickly search the contents of .DWGs for many things including Drawing Properties, Blocks, Geometry, Text, Attributes, Xrefs and more. You can even limit/filter a search to include only Model Space entities or All Entities. Once all objects are identified, you can select exactly what you would like to extract and save that to a table or an external Excel (.XLS) file.

A complete discussion of the DATAEXTRACTION command is outside of the present scope. Having said this, if you have not used it in the past, I would strongly encourage you to invest some time researching the tool so you can have a more complete picture of everything it can accomplish.

8

For our purposes, we will extract all of the MTEXT and TEXT from within a folder of files. We will then save those contents in an Excel file and then search the Excel file for the word 'Roosevelt.'

We begin by launcing the DATAEXTRACTION Command.

From there we just walk through the Wizard.

DE Wizard - Page 1

First order of business is to create a new data extraction and give it a name.

DE Wizard - Page 2

We will identify the drawings or folders of drawings we would like to search.

DE Wizard - Page 3

We select both Text and MText as objects we would like to extract information from the drawings we identified.

DE Wizard - Page 4

We then look at the list of information extracted and filter it down to include the contents of Text and MText as well as the drawing file name. (We need all the text string contents to search for Roosevelt. We need the drawing file name to identify which drawing we find it.)

DE Wizard - Page 5

We can quickly review our results.

DE Wizard - Page 6

We then prepare to output the final results into a .CSV file we can view in Excel.

DE Wizard - Page 8

Yes, it jumps from 6 to 8. We complete the process and create the Excel file.

Note: The session recording goes through this in much more detail. Here, I want to provide an overview of what we are trying to accomplish so you can better understand the bigger picture.

9

When the export is complete, we open the output file in Excel and use the FIND command to locate the text string 'Roosevelt' in any of the text strings we extracted.

In our case, it found one instance and it is associated with the GEOMETRY.DWG file.

Key Takeaways

  • While this is a very powerful tool, performance declines as you search for more object types and increase the amount of .DWGs you interrogate. Additionally, the size and complexity of the .DWGs you are searching will also impact performance. In my experience, running this command on a couple hundred .DWGs is doable but may take 10-20 minutes or more to complete. (Still faster than opening them and reviewing them manually one at a time.)

  • The tool does not search Civil 3D annotation or labels. This is unfortunate but not terribly disruptive as generally most of what I would typically search for would be values contained in Blocks, Text, or MText.

Want more? Download the full class handout to read on.

For more than 30 years, Jerry Bartels has worked in all areas of civil engineering, surveying, and mapping, providing clients with services in CAD management, implementation, and network administration. He also has more than 10 years of experience teaching Autodesk products, as well as developing curriculum. He has received several awards from Autodesk for his presentations.

For more than 20 years Jeff Bartels has worked in the civil infrastructure industry. Before coming to Autodesk, Jeff served as the CAD manager for a civil engineering and consulting firm in Illinois. He was one of the early adopters of Civil 3D, migrating his firm to a BIM-related workflow in 2008. Since 2008, he has published 25+ titles on AutoCAD and Civil 3D.

Alan Gilbert is an Autodesk Technical Specialist supporting the efforts of the AEC sales team. This coverage includes everything from small engineering firms up to large government customers such as departments of transportation. He is registered as a Professional Engineer and Professional Land Surveyor in the state of Alabama.

Clase complementaria

This session is dedicated entirely to productivity techniques that will help improve your daily operations when working with Civil 3D software. These tips include automating regular tasks, using standard functions in new ways, exploring underutilized features, and even exploiting a handful of undocumented commands. We'll present the information using a real-world problem-solving context, rather than simply going feature by feature, so you can fully appreciate the "why" in addition to the "how."...

Compartir artículo

Comments