James has been dropping some not-so-subtle hints that some of us need to add some content to this site. I see that Dana listened, but in my defense, I’ve been on the road all week. 3 hotels in 3 nights and a whirlwind tour of Northeast Alabama and Eastern Tennessee has kept me busy, and not in the blogging mood.
However, I did run into a very interesting question at a customer site. I was almost sure that I could accomplish the task that he was requesting, but I wanted data to play with before I committed to anything. He provided me with exactly what I needed so I jumped right in and started working. How many of you have received contours from a GIS application? Maybe it’s a SHP file from an ESRI application or some other sort of data. I’ve got a ton of contours on a drawing that are polylines with a 0 elevation, so they’re useless to me in relation to creating a surface. Flat surface, huh? But if I do a bit of inquiring on these polylines, I see that there’s object data assigned to these polylines, and one part of that object data seems to be a contour elevation. Believe it or not, I’ve got exactly what I need to create a workable surface. Want to learn how? Read on….
I’ve got a huge drawing here, and it appears to be polylines with text labels. Here’s a sample:
Let’s take a look at the properties of one of these polylines. You’ll notice two things that make this a bit useless (or so you may think) to you – the fact that the polylines have an elevation of 0 and the fact that there’s object data (what’s that???) attached to this polyline. That’s good news, because it’s what we’re going to use to automatically assign the correct elevation to our polylines. Here’s a look at those properties:
Now that we see what we’re working with, we can come up with a game plan for converting these flat polylines to information we can use to create a surface. We’ll do this using functionality built into Civil 3D that not many people like to utilize – Map queries!
To do this, I’m going to close my drawing with the polylines and open a new, blank drawing. Next, I’m going to open up my Map Task Pane (or Workspace – depends on how old a Map user you are.) I’ll do this by typing MAPWSPACE at the command line and then selecting ON. It will probably pop up with the display manager active, but we want to change that to Map Explorer, as shown below:
Once I get Map Explorer open, I’m going to attach a drawing so that I can query in my information. To do that, I’m going to right click on Drawings and select Attach. This brings us to the attach drawings dialog box, where we’ll use our drive aliases (if you don’t understand the concept of drive aliases, that’s a topic for another lesson) to navigate to the folder containing the drawing that we want to attach. I’ve shown that process below – the “blackouts” are there to protect the name of the data provider.
Once I get to the drawing location, I just double-click on the drawing (or drawings) that I want to attach. It will then populate in the lower window. Click “OK” when you’re done here, and your drawing will show up under Drawings on your Map Explorer window.
Next, we’re going to define a query – and this is where things get fun and interesting. Many of you have likely defined simple queries before to get info out of another drawing, but have you ever used a query to both IMPORT and MODIFY that data? Well, you’re about to.
Right click on your current query under the Query Library and then select Define. This will bring up a rather intimidating looking box where we do the actual query building. This particular query will be defined by a Location of ALL so that I can get all my contours in the other drawing both drawn and modified.
Next, click on the Alter Properties button, which will bring you to the following dialog box:
It’s pretty obvious what we want to modify – Elevations. And no, not just because it’s what I highlighted. Once we select the Elevation radio button, the Expression area at the bottom becomes active. This is because we have to tell the program HOW we want to modify our elevations. To define this expression, click on the Expression button at the bottom of the box. This will bring up a dialog box that allows us to select the value that we want to use to set the elevation of our polylines. Since we know that the contour elevations are defined in the CONTOURS object data under the CONTOUR field, we will select that value for our expression. Please note that these are Map expressions, and not Civil 3D expressions (that’s what Dana seems to be working on today, by the way.) The dialog box is shown below:
Now we can select OK to take that value back to the Expressions field. Click the ADD button at the bottom to carry that value up to the top of the box, then select OK in the bottom of the box to accept your selection.
Now we’re back to the query definition dialog box. Set your query mode to Draw and then click on Execute Query – if you make the mistake that I typically do of selecting OK, it just won’t run the query and you’ll be sitting there scratching your head.
Once we query the data, we see the information in our current drawing. Just to see if we were successful, we’ll check the properties of one of our contours:
Now, we can build a surface out of our newly-elevated polylines! Go back to your Drawings folder in Map Explorer, right-click on your drawing that you’ve attached, and select Detach so that you can now save the drawing.