Monday, May 28, 2012

Profile View Band Labels

I took on a project which required replacing Profile View Band label text components, but I had a problem. The problem was that I couldn’t figure out a way to find out what the label was labeling. The Civil 3D API doesn’t provide access to what it is labeling, in this case. This caused the program to sometimes not replace the contents of the correct band label. The solution is to use the AchorInfo property of the label. Using this property I may find the station and elevation location of the label. This will return a nearly correct station value of what the label is labeling, even if the label is adjusted so they don’t overlap. The code that I was using is below. 

        private static ObjectId ReplaceBandLabelTextComponent(ObjectId vgpLabelObjId, ProfileDataBandLabelGroup profDataBandLabelGroup, List<PVIPointInfo> pviPtInfo, ProfileView profView)
double station = double.NaN;
double elev = double.NaN;

foreach (LabelGroupSubEntity label in profDataBandLabelGroup.SubEntities)
if (label.StyleId == vgpLabelObjId)
profView.FindStationAndElevationAtXY(label.AnchorInfo.Location.X, label.AnchorInfo.Location.Y, ref station, ref elev);
PVIPointInfo pviPtToUse = GetPviAtStation(pviPtInfo, station);
if (pviPtToUse != null)
foreach (ObjectId textObjId in label.GetTextComponentIds())
label.SetTextComponentOverride(textObjId, pviPtToUse.PointDescription);
return vgpLabelObjId;

Some of the objects are custom objects that I use to make it easier to pass information between the methods. I said almost correct in that with floating points computers use there is some rounding difficulties which may be encountered. The PVI might be reported at 23.32233412121 and the AnchorInfo at 23.32233418354. Most of the digits match, except for the ending digits. This will make any equality checks fail. To get around this we have to use a technique to see if it is approximately correct.

To do this I created an extension for double types. An extension makes the method like it always belongs to the object type. This way it may be used where ever I need it. The code is below.

    public static class DoubleExtensions
public static bool AreEqual(this double number, double number2)
double difference = Math.Abs(number * .0001);

// Compare the value
if (Math.Abs(number - number2) <= difference)
return true;
return false;


Now I put the code together and I can now replace the text in the correct label.

Thursday, May 24, 2012

Adding Items to a Palette

Don’t you just hate it when you know how to do something, but when asked to demonstrate the task it doesn’t work? Well this post is about one such instance, adding an item to a palette. It’s a rather simple process. You select a block or object in AutoCAD or Civil 3D, deselect it, then drag it to the palette. This video shows the steps.

Unable to display content. Adobe Flash is required.

I added a polyline, but subassemblies, assemblies, blocks or other items may be added.

FDO Import into Civil 3D

Sometimes we want to import GIS data into Civil 3D. This blog post will cover how to import the data using an FDO connection. FDO connections are great because they keep a dynamic link between the drawing and the data. So when the data shape files change the changes should be reflected in Civil 3D.

To start you will want to change the workspace to be Planning and Analysis. You can do this in the bottom right hand of the program using the settings cog and choosing Planning and Analysis.


More then likely you won’t have the Map Workspace open. To turn it on type MWSPACE at the command line and set the value to ON.

Next make sure the tab selected on the Task Pane is set to Display Manager and then click the cylindrical shape and choose Connect to Data…


This will bring up the Data Connect Palette. The Palette contains many different connection types. If you want to use a different data type go ahead, the steps will be similar. Now find the Add SHP Connection line item. Provide a Connection Name that makes sense. For this example I’ll be working with a sanitary sewer data set, so I’ll call it SHP_LosAngelesSewer and set my Source file or folder.


You can either select a folder of shape files or a single shape file. For this example I selected a single one. Next press the Connect Button. The schema will then be read from the file and the information shown. Now press the Add to Map drop button or use the drop down list to add data with a query. Using the Add to Map option will bring all of the data into the drawing. Using the query will provide a way to limit the data to bring in.


Using the query dialog box you can build a query. The one I use most often is the Locate on Map. This way I don’t have to import the entire County of Los Angeles Sewer data, but just a portion around the project I’m working on. To create the query use the drop down and select the how you want Map to determine which data to bring in. In this example I’m going to use an Inside Rectangle.


Once you do that you will be prompted to select the area you want with a rectangular selection. Then it will come back to the Create Query dialog box with the query filled in.


You can add other queries, but I’ll skip that for this post. Also now that you can import the data multiple times from one data source. Once the queries are done the data from the shape files should be shown in the drawing.


Having the information is great, but we probably want to distinguish between the different sizes or some other criteria. To do this we press the Style  button on the Display Manger tab of the Task Pane. This will bring up the Style Editor. Currently the information is set to be a default value. For simplicity I’m going to create an Automated theme by pressing the New Theme… button. This will bring up the Theme Layer dialog box.


I’m then going to change the Property that I want the theme to be created from to Diameter. The dialog box will then show the range of values. Then select the distribution type, I’m using Equal and the number of rules you want created. This will determine how they themes will be applied. You can always modify them if you don’t like how they are created.


Lastly we will want to create labels. To do this check the Create Feature Labels check box. Then press the button with the three dots. This will bring up the Style and Label Editor. Press the button next to Text field to get the Create/Modify Expression.


Then using the Text Function Concat, build how you want the label to be shown. For this example I’m using the Diameter, inch symbol and the material. Note that a single apostrophe at the beginning and end of the string value is what is used to denote text.


Make any other changes to the colors or fonts you wish to make. Here is what my label looks like.


Then exit back through the dialog boxes and you should then see your map with themes.

You can control the thems from the Display Manger, turning the information on and off using the check marks. There is lots of other things you can do with the data, but this is the starting point in bringing it in.

Wednesday, May 16, 2012

Is DropBox Obsolete?

Today Dell announced a new Multi-User 2U Rack Workstation for 3D Workloads. It got me thinking, is DropBox already on the road to obsolescence? It would appear the world is moving away from desktop computing and towards server based computing power. In 5 years will we be working on computers at our desk or through remote servers located in our offices or at a centralized location? If it does move this direction then DropBox in it’s current form becomes unnecessary for sharing files. Instead we will log in and use the data where it is stored.

While Dell is branding the product as a Workstation it appears to be more of a specialized server with supped up processing power for doing computations. In addition to the processing power, you also get to access the files from a central location, supplanting the need to copy data from one location to another. Essentially eliminating the need for DropBox. Will forward thinking owners grab control of the data and processing of the models?

Based on presentations by Autodesk the past two years at Autodesk University, Autodesk appears to have desires to move Autodesk products from the desktop to remote locations away from the users. Why have the architecture, structural, mechanical, and civil models in separate office locations when you can have them all in one location so they can talk to each other in real time. All of this depends on the world continuing to improve connection speeds. It has yet to be shown if this can be accomplished in the United States. Rural and semi-rural locations still are plagued with relatively slow data connections.

Thursday, May 10, 2012

Approximated Profile

Sometimes projects don’t demand full surveys. One instance maybe the replacement of a water line. In that case the survey information for the entire roadway may be overkill and only spot elevations above the pipe may be required. There are three ways available of accomplishing this task.

Way 1

  • The first step is to create a feature line representing the survey shots of the survey (Pg. 613, of Mastering Civil 3D 2012).
  • This line may then be offset to either side of the original (Pg. 616, of Mastering Civil 3D 2012).
  • The feature lines may then be added to a surface as breaklines (Pg. 122, of Mastering Civil 3D 2012).
  • A surface profile may then be created representing the existing grade over the existing pipe.

Way 2

  • The first step is to create a feature line representing the survey shots of the survey (Pg. 613, of Mastering Civil 3D 2012).
  • Next project the feature line to a profile view using the elevations of the feature line (Pg. 246, of Mastering Civil 3D 2012).

Way 3

  • Look at the Create a Profile without a Surface posts on this blog. Although there would be quite a bit of work to get it to work in Civil 3D 2013.

Friday, May 04, 2012

Subassembly Composer–Surface Link

Subassembly Composer can be a bit confusing sometimes. I’ve run into a problems creating shapes with them when one of the links uses the Surface Link from the Advanced Geometry Tool Box. The problem is caused by the Surface Link not being abled to use points to determine the start and end point of the links. Instead you provide the Start and End X values. You can do this via a Points X value or Offset Targets.


When you attempt to create a shape, it won’t work. It won’t work because SAC doesn’t think the points connect, even if they have the same X, Y values. In order to fix this you need to add a link between the Start Point of the Surface Link to the Point referenced in Start X, and the same for the end. Once the short links are connected for the start and end points then shapes can be created.


Blog Widget by LinkWithin