So a little while ago, someone in the discussion group asked how to go about dropping the zeros at the end of a label. For example, if a value was 100.1111, they wanted to see 100.111. If the value was 100.0001, they wanted to see 100. Apply this to the entire range and you get an idea of what was wanted;

One Label Style, Different Precisions

One Label Style, Different Precisions

In the image above, you can see the total length of the line in the component on the bottom and the component on the top is displaying with different precision based on the value of the label.

NOTE: The method I came up for solving this issue only works if the values can never be negative. If the values you are labeling can be negative (such as a surface elevation) this technique won’t work

Setting Up the Style

What you’ll need: 1 component for each precision you’ll want in the label and one expression for each of those. I’ll start this off by creating the component if the label rounds to the nearest ones place.

The expression basically does this: It checks to see if the number is the same when rounded to the nearest one and when it’s rounded to the nearest one thousandth. If they are the same, return the value. If they are different, return -1 (negative one). The expression will look like this (for a line label):
IF(ROUND({General Segment Length})=ROUND({General Segment Length}*1000)/1000,{General Segment Length},-1)

Expression for Display to the Ones Place

Expression for Display to the Ones Place

I called this expression “ones”.

Now use this expression within a label component. Instead of using the length of the line in the label, use this expression. The trick here is to change the precision to the ones place and then set the “Sign” value to “hide negative value”. That’s what the -1 is used for. If the test in the expression is false, then don’t display anything, if it’s true, display the value at a precision of 1.

Label Component Used to Display the Ones Place

Label Component Used to Display the Ones Place

Repeat the expression/component process for the rest of the precisions you want to use in the label (tip: just copy the “ones” component for the rest of them). For the tenths place, add an additional IF statement to the expression. If the “ones” expression is greater then or equal to zero, then return -1, otherwise, test for the next precision. This expression looks like this:
IF(ones>=0,-1,IF(ROUND({General Segment Length}*10)/10=ROUND({General Segment Length}*1000)/1000,{General Segment Length},-1))

Expression for Display to the Tens Place

Expression for Display to the Tens Place

The expression for the hundredths place is very similar but with an extra IF statement to check both the “ones” and “tenths” expressions.

Finally, you’ll need one last expression for everything else. This one is really simple, basically, if “ones” is greater then 0 or if “tens” is greater then 0 or if “hundreds” is greater then 0 then return -1. Otherwise, return the value.

IF(ones>=0,-1,IF(tens>=0,-1,IF(hundreds>=0,-1,{General Segment Length})))

Expression for Display to the Thousands Place

Expression for Display to the Thousands Place

Wrap Up

Once you have the expressions created and added to your label, it works like a charm. HERE is a quick little video I made showing the expression at work. I took a line and labeled it and then changed the length of the line using the dynamic input.

Additionally, if you would like a copy of the file that I showed in the video, you can download it HERE.

Have fun playing with your new label knowledge!

Civil 3D uses a Triangulated Irregular Network (TIN)  for surface models, just like every other piece of civil engineering software that I’m aware of. There a  couple of major limitation to a TIN that you should be aware of. First, every single horizontal location (i.e. every x,y coordinate) can have only one elevation. This means no vertical faces and no overhangs or undercuts. The other limitation is since it’s made up of a bunch of triangles, you can’t have curves in your surface. If you have curved data that you want to add to your surface, you must approximate this with straight line segments, and this is where the mid-ordinate distance comes into play.

What the Mid Ordinate Distance Is

When you add data to your surface, one of the options is the mid-ordinate distance. What the heck is the mid-ordinate distance? Well, it’s the distance from the midpoint of a curve to the midpoint of the arc.

Mid Ordinate Distance

Mid Ordinate Distance

When you add something like a curve to your surface as a breakline, boundary, or contour; the surface cannot follow the curve so it uses the Mid Ordinate Distance to approximate the curve. Basically what happens is C3D will start at the end of the curve and draw a line to another point on the curve so the mid ordinate distance between those two points on the curve equal what is set in the dialog box.

Mid Ordinate Calculated

Mid Ordinate Calculated

As you can see in the image, there is a little bit left over at the end, when you add this to a surface, you don’t want that little bit left over so Civil 3D then evenly distributes the number of points added to the feature along it. This will result in a final Mid Ordinate Distance slightly less then what was calculated.

Mid Ordinates Distributed Along Curve

Mid Ordinates Distributed Along Curve

So, instead of adding just the ends of the curve to the surface, the Mid Ordinate Distance allows us to determine how many points along the curve we want to add.

What Should You Set It To?

Now that you know what it is, what should it be set to? In the default template, it’s value is set to 1 drawing unit (1′ in the imperial template and 1m in the metric template). Is this value too big? Too small? Or just right? Let’s think of this in a different way. Don’t think of it in the abstract Mid Ordinate Distance way, think of it instead as “How far away from my data should I allow my surface to be created?” If you set the Mid Ordinate Distance to 1′, then the triangle of your surface can be up to 1′ away from the actual data. It’s your call, is this acceptable or not?

Here’s how I like to figure out an acceptable Mid Ordinate Distance. What is the smallest distance between any two breaklines you’ll have in your surface? Are you modeling a haul road for a mine? Or are you modeling curb and gutter for a commercial parking lot? In my experience (primarily land development) I use a lot of curb and gutter. When I model the flow line and the top face of curb in a standard curb and gutter, that’s a horizontal distance of 2″. Take that smallest distance and cut it in half to get your desired Mid Ordinate Distance, in this case 1″. Since 1″ is about 0.08333 I will typically us 0.1′.

Can I Change the Default?

Well, of course you can! Ok, let me rephrase that, if you are using Civil 3D 2010 or later you can. On your toolspace, go to the Settings tab and expand out Surface and Commands:

Command Settings Location

Command Settings Location

As shown in the image, there are three commands (at least that I know of) that can have the Mid Ordinate Distance set, AddSurfaceBoundaries, AddSurfaceBreaklines, and AddSurfaceContours. Right click on the command you want to change and choose Edit Command Settings. In the command settings, expand out “Add data options” and change the “Default mid-ordinate distance” setting.

Mid Ordinate Distance Defaults

Mid Ordinate Distance Defaults

Hopefully this will help you understand what’s going on with this setting and, have a Merry Christmas!

A while back, I did a post about bringing DEM data into AutoCAD Civil 3D (you can read it HERE if you are interested). In the comments, people have asked several questions and have had some issues. One of the issues is, you have to know what coordinate system the DEM file is using. Another is that, no matter what coordinate system you are using, the DEM comes in as though the elevations where in meters (and will then convert those meters to feet).

Well, all that’s about to change. If you have the Autodesk Infrastructure Design Suite (Premium or Ultimate) then you also have Autodesk Infrastructure Modeler (AIM). You can use AIM as a DEM to Civil 3D surface converter. Simply import your DEM file into AIM, export to a .imx file, and then import that into Civil 3D.

Open up AIM and create a new project. Give it a name and a place to save it. Keep the coordinate system as LL84 (there’s no need to change it) and leave everything else the way it is.

Create a new project

Once the project is created, import the DEM file into AIM. This is done through the Data Sources panel. Expand out the different data sources and choose “Raster” as the data source. Browse to your DEM file, open it, and then Refresh the data. You will now have a beautiful surface in your model.

Import DEM as Raster

Refresh DEM

Now that the DEM is added to your model, export it out to Civil 3D via the .imx file. In the application menu of AIM (that’s the purple I in the top left corner of the application), choose the Export menu and then “Export to IMX”. In the Export to IMX dialog box, choose to export the entire model, and give it a file name. AIM will choose an appropriate coordinate system so just leave that alone. Depending on the size of the DEM file, this could take a few minutes.

Export to IMX

Once the .imx file is created, open Civil 3D. To import the .imx file, it’s important to remember to assign a coordinate system to your drawing. If you aren’t sure how to do this, click HERE. Once in Civil 3D choose the Import IMX command (it’s on the Import panel of the Home tab of the ribbon or type IMX_IMPORT at the command line). Simply browse to the .imx file and bring it in. Because both the .imx file and your drawing have coordinate systems assigned, the DEM file comes in at the correct location and at the correct elevation. You may want to change the name of the surface as well as the style but, you now have a beautiful DEM file in your drawing and you didn’t ever have to know what coordinate system it was using!

Import the .imx file into Civil 3D

And if anyone is wondering, the DEM file I used while creating this blog post created a surface in Civil 3D with almost 4 million points.

Surface Properties

I’ve been playing around with Autodesk Infrastructure Modeler (AIM) quite a bit and I’ve been liking it A LOT! It’s SO easy to bring all that GIS data into your model and make it look really good.

One thing that will really help out your model is bringing in 3D models of some of the more recognizable buildings and features of the area you are modeling. For example, here is the City of Denver with the building outlines modeled as buildings and the height of the buildings captured from the GIS data:

Mile High Stadium Building Outline

As you can see, centered in the image is Mile High Stadium and, well, it really doesn’t look like that AT ALL! So, what can you do? There is a ton of free 3D models out there on the internet, one of the best resources I’ve found is the Google Sketchup Warehouse. You can find all sorts of free 3D models there in the Sketchup format. In fact, HERE is a 3D model of Mile High Stadium. Simply save the file to your hard drive.

Next thing we want to do is bring it into AIM (Autodesk Infrastructure Modeler). The easiest way to do that is bring it first into 3ds Max Design. If you are using AIM, most likely you have one of the Autodesk design suites (and if you are reading this blog, most likely it’s the Autodesk Infrastructure Design Suite). The Premium version of the Infrastructure Design Suite comes with both AIM as well as 3ds Max Design so you are golden if you have that. Open up 3ds Max Design and close the opening welcome screen. You probably have never used 3ds Max Design before, don’t worry, what we are doing is easy.

Within 3ds Max, on the Application Menu (that’s the big green M in the top left corner of the application) choose the IMPORT (Import  non-native file formats into 3ds Max.) command

Import Model into 3ds Max Design

Now browse to the file you downloaded from the Google Sketchup Warehouse and you’ll see the another dialog box. The only thing you’ll want checked on is “Split Objects by Layer”

Import Sketchup File Settings

After importing, you’ll see your model in 3ds Max

Model Imported into 3ds Max Design

In our case, I don’t want to use the background image of the model, just the model itself so I can select it and hit the delete key on my keyboard (alternatively, you could just not select it in the next step). Now that 3ds Max has imported the file, I want to send it out to AIM, and that’s the easy part. In the Application Menu of 3ds Max (same place we went to import the model), there is a Send To menu and one of the options under that is Send to AIM. This will send whatever you have selected in 3ds Max so select your model, and run the command.

Send to AIM

MAKE SURE YOU AREN’T IN THE MIDDLE OF A COMMAND WITHIN AIM PRIOR TO DOING THIS!!!!!!!

You’ll be switched back over to AIM where you will then be asked to configure the data source that you are importing from 3ds Max. You’ll want to do a minimum of two things here. First, assign “Type” to the data source (in my example I chose Buildings because, well, it’s a building). Second, you’ll want to specify the location. Most likely when specifying the location you’ll want to use the “Interactive Placing…” option. This allows you to place it in your model wherever you choose. When it’s where you want it, just double click and you are done.

Configure Data Source

And now you’ll be able to see your 3D model in AIM and it will cast shadows and just look really awesome!

Here’s the Space Shuttle being carried by a 747 over Mile High

Space Shuttle over Mile High Stadium

Checking comments on my blog this morning I ran into this question:

Thank you very much for nice post. I have one more query. I want to display elavations of contours for each contour line at some fixed interval. I don’t want to draw lable lines. Is there any way to do that. If u know it please help me

Most likely they want an automatic contour labeling routine but it got me thinking, what about labeling every third contour? Or every seventh? Or every whatever the heck you want contour! It’s pretty simple, you just need an expression that will check the interval and then control it’s display. Here’s how to do it.

For this example I am going to label every third contour line. First, create an expression. This expression will see if the contour is at the interval. If it is, then return the contour elevation. If it’s not, return a negative one. To create the expression, expand out Surface on the Settings tab of the prospector, then Label Styles, and finally Contour. Right click on Expressions and select New…

New Expression

In the new expression dialog box give the expression a name and a description. Have a little forethought on this as you can’t go back and rename or change the description of the expression. The actual expression itself will look something like this (remember I’m doing this for every third contour):

Expression Settings

So, what does this expression do? The test in the IF statement is “{Surface Elevation}/3=TRUNC({Surface Elevation}/3)”. This tests to see if the contour is the third contour or not. If this test is true (the contour IS divisible evenly by three) then it returns the contour elevation, if it’s not, it returns -1. This -1 is key to how this expression works in the label style.

And make sure to format it as an elevation.

Now that the expression is created use it in your label style. You can create a new style or copy an existing style. In the style composer, edit the style. On the Layout tab, edit the contents of the text component. Remove the current text from the right hand side and insert your new expression into the label. When you do this, the important part is to set the “Sign” value to “hide negative values”. This way if the expression returns -1 it will, basically, not display anything at all.

Applying the Expression

Once you have done this to all label styles involved in your labeling process (i.e. major, minor, user, etc.) your drawing will look something like this:

Expression Used in Labels

You want to change the interval? Modify the expression or create a new one for that interval. Want to adjust the base of the calculation? Simply add a number in the surface expression to adjust it. For example, I want to label contours 1, 4, 7, and 10. The expression would look like this: IF(({Surface Elevation}+1)/3=TRUNC(({Surface Elevation}+1)/3),{Surface Elevation},-1) – Notice that I added 1 to the first two {Surface Elevation} values to adjust the test (don’t add 1 to the last one!).

<UPDATE>
This life of this tool has been extended to August 12th 2013 so get back out there and start using it some more!
</UPDATE>

Do you like using aerial imagery while working in Civil 3D? I know it’s always helped me when I’ve had access to it. You could use Google Earth but it has issues (see why HERE) and there are other alternatives to getting the imagery but they are all pretty tedious. Well, just announce is a new and very simple way to bring aerial images into your drawing.

Just announced is Project Basejump. This is a new product available at Autodesk Labs. This tool will allow you to easily bring in maps from Microsoft Bing. These maps are brought in via the Map 3D FDO tools. Don’t worry if you’ve never used FDO, it’s REALLY easy!

After you install the add-in, simply open up the Map Task Pane. You can access this by typing MAPWSPACE and then choosing the ON option. If you are using Civil 3D 2013, there is a button on the Palettes panel on the Home tab. This button basically runs the MAPWSPACE command so you’ll still have to tell the program you want it ON.

One thing you must do is assign a coordinate system to your drawing. If you don’t do this, your images won’t work. If you aren’t familiar with this, simply right click on the drawing name on the settings tab of the Prospector and choose Edit Drawing Settings. On the Units and Zone tab, assign an appropriate coordinate system to your drawing. If you aren’t sure what to use here, check with your surveyor on the project.

Assign Coordinate System

In this example, I’m using a Colorado state plane coordinate system and I’m in a blank drawing.

If you haven’t done so yet, go install the tool. You can find it HERE. Once installed, go to your Map Taskpane and select the Data button and choose “Connect to Data…”

Connect to Data

This will then bring up the Data Connect panel, also known as “FDO”. If you are familiar with this tool, you’ll notice a new option (in my case it’s the second one listed), “Add Basemap Services Connection”. If you aren’t familiar with this tool, just trust me that it’s new. Select the new connection type, on the right hand side give it a name (I called mine “Bing Maps”),  and then select the Connect button.

Creating the Connection

After selecting the button, you’ll be presented with the available data sources. Simply toggle on the ones you want (go ahead and select them all, it’s easy to toggle them on and off afterwards) and then hit the Add to Map button.

Select the Data

Civil 3D (or Map 3D) will then go out and query the data source and bring in the imagery for the coordinate system you assigned. As you can see in the following image, it brings in data for the entire defined coordinate system (Northern Colorado in this case).

Image Imported

This is a very low resolution image but as you zoom in, you’ll see more and more detail. You can also easily toggle on and off the images using the Map Taskpane. Simply hit the check box next to the image you want and deselect the images you don’t want (I can’t think of any advantage of having more than one turned on at any time). Personally, I kind of like the “Aerial with Labels” map.

Choose Your Image

When you zoom in, Civil 3D will continue to check with the Bing servers and get the best image it can for that specific zoom level. Here’s a picture of my house:

The image is about a year old as we now have grass in our yard and there are several more houses built in the area (we built our house, doing our part for the economy). We don’t live in a big city so the imagery isn’t quite as detailed. If I go check out someplace in Denver, the image is much higher quality:

Home of the Colorado Rockies

Go check it out! Let the developers know what you think. If you have any issues or problems or wishes or complaints, let them know. I’m pretty excited about where this is going.

One thing to note, this is a “Labs Technology Preview”. What this means is the technology might not ever actually make it into the program. In other words, check it out, give your feedback, and do everything you can to let Autodesk know that this is a good tool and they should continue to work on it and eventually make it a part of the program.

Now if they could just get it to bring in DEM information as well…

Note from Brian: There’s some new functionality in the 2015 release regarding images. Check it out HERE.

I’m constantly amazed at how many people import data from Google Earth into Civil 3D and then complain about how horrible the data is. There are two primary issues that I’ve seen when importing data from Google Earth. First of all, the imagery is inconsistent at best. The guys over at Being Civil wrote up a nice post about this issue HERE if you are interested (also, the images come in black and white). The surface data that you bring in is very limited. Sure, you can pick anywhere you want but you are limited to importing 5,000 points and, if you have a large area, that’s not very much data at all (I recently downloaded a DEM file with over 2.5 million points, now THAT’S data!). So, instead of relying on Google Earth, go out and get the data yourself! You’ll be much happier with the results.

For those of you with projects in the United States there is an amazing resource that I was familiar with but never really investigated much, the USGS Seamless Data Warehouse (I was playing around with the Autodesk Infrastructure Modeler and looking for data). You can find it at seamless.usgs.gov. Here you can browse a map to find your project location and download orthoimagery (i.e. aerial images) as well as surfaces (DEM files). You’ll need to create an account to download the data but it’s free.

Using the Seamless Viewer

When you get to seamless.usgs.gov, on the left hand side, there is a panel and on this panel, is a link to the Seamless Viewer (you can access it HERE if you like). It looks a little something like this:

Seamless Viewer Link

Once you click on this, it will take you to a map showing the entire United States (well, most of North America actually). Draw a rectangle around where your project is (you’ll see the state boundaries so use that as a guide and zoom in on the state the project is in). Once at the state level, you’ll probably need some assistance locating your project area. On the right hand side of the map, you can change what is being displayed in the map. By default (at least for me) all it showed was the digital elevation data. That really didn’t help me find the area I was looking for (Colorado is a big state, not as big as Texas of course, but still big) so I toggled on a few options to help me locate my project. The ones that seemed to help me the most were the Orthoimagery, the Transportation, and the Places (Names). As you can see in the following images, it makes a huge difference.

Before Editing the Display Options

After Editing the Display Options

Once you get zoomed in on the area of interest, you need to tell the Seamless servers what it is you want to download. On the right side of the map where the Display options are located, switch from Display to Download.

Download Options

In this case, I chose to download the NAIP (National Agriculture Imagery Program) Orthoimagery as well as the 1/3 second DEM from the National /Elevation Dataset. Once you’ve set what it is you want to download, you need to specify what part of the map that you want the data for. To do this, use the tools on the left side. I chose the “Define Rectangular Download Area” option.

Download Selections

A new window will pop up with links to download each file. The files you’ll get are simple .zip files. Once you unzip them you’ll get a ton of data. For the DEM, the files you need are the ones that end in .adf. Just keep all these files in one location and you can then create a surface from them in Civil 3D. The images will have a lot of files as well but really the only ones you need are the .tif file and the .tfw file. The .tif file is the actual image itself and the .tfw file is the world file. The world file lets Civil 3D properly locate it in your drawing. And honestly, I don’t think you really need the .tfw file as .tif files can have coordinate information embedded into them (aka GeoTIFF). I would still just leave them together to be safe.

Download Files

Using the Data in Civil 3D

Once you have the data, you need to add it into Civil 3D. First thing you want to do before adding in this data is to make sure your drawing has a coordinate system assigned to it. If you aren’t familiar with this, simply right click on the drawing name on the settings tab of the Prospector and choose Edit Drawing Settings. On the Units and Zone tab, assign an appropriate coordinate system to your drawing. If you aren’t sure what to use here, check with your surveyor on the project.

Coordinate System in Civil 3D

To bring the DEM file into Civil 3D, create a surface and add the DEM file as data. I’m not going to get into the details in the post as I’ve already talked about how to bring DEM files in to Civil 3D. You can read it HERE if you like. When you add the DEM file, use the coordinate system code LL83. Also make sure you read the comments as you’ll need create the surface in a metric drawing and use LandXML to bring it into a drawing that is in imperial units.

To bring the images into Civil 3D, use the Map Image Insert command MAPIINSERT (yes, two I’s in there). This will bring the images in georeferenced.

Conclusion

Sure this process takes longer then importing from Google Earth but think of it this way, “You get what you pay for”. In this case, you’re paying with time. Importing from Google Earth is fast but you get very poor data. Getting the data yourself takes a bit longer but you get MUCH better results. Check out this example, in the following image you can see where four of the images downloaded from the Seamless server line up and it’s REALLY close to being exactly matched up (I can’t see any offset or other error personally). Compare that with what you get out of Google Earth.

Image Overlap

If anyone has data sources similar to this for other countries, comment here so others can find them.

Follow

Get every new post delivered to your Inbox.

Join 748 other followers