Sunday, February 28, 2010

Alignment Major Station – Different Viewport Scales

Sometimes you may have two viewports in a drawing showing the same alignment but you want to show major station labels at different intervals in each viewport. For instance the major station labels on the right in the picture below appear to close together.


Now we could use two different major station label sets and use layer control to hide the unwanted labels in each viewport, but if your like me you’ll end up messing it up and loosing track of what layers should be on or off. We can use the same concept in my last post with hide negative values to perform the same task. For this task I’m creating an expression which checks the Drawing Scale Conversion and checks to see if the station value is divisible by 300 since I want the major station interval to be every 300’ in the right viewport.

To do this I’m using the expression capability to evaluate an AND statement, the highlight portion of the expression below.


If the expression evaluates as true, meaning the drawing scale conversion is less than 1200 AND the station value is divisible by 300 a positive Station value is returned. If not a negative Station value is returned. By replacing the Station value with the expression in the major station label and set it to hide negative values we get the results shown below.


No need to keep track of layers, just a need to modify the expression to get it to work.

Thursday, February 25, 2010

Hide Negative Values

You may have not noticed, but under the Sign option there is an option to hide negative values.


This capability, along with expressions, can improve how are labels look. Take for example if you want to hide the start or end major station label of an alignment. Previously I used a method where the end major station was shrunk really small, with the hide negative value I can make the station value disappear altogether.

To do that use an expression that returns a negative station value if it is the start or end of an alignment.


Then in the text label component, make sure that the expression’s value is set to hide negative values.


Now when the label is the end or beginning major station label the component won’t show up.

(Rambling on, not quite sure if it makes sense since I’m talking about things I didn’t talk about above, but you may have noticed the + in the above picture: In the case of the label text component above the + will still show. I had to do this since the station character only output doesn’t appear to honor the Sign result, hopefully it will be fixed in future versions. So in this case I wanted to only show the station character and to the right of it, in this case I still needed to shrink the label. For this style I wanted a different look for the beginning and ending major stations from the major stations in the middle. By using two text label components I was able to use one major station label set, but get two different looks depending on where the major station label is located. For the end and start the middle label gets hidden using the hide negative value.)

Tuesday, February 23, 2010

How Does That Color Print? – CTB

Have you ever had to use a new CTB file and not know how the pens will print? There is a relatively easy way to figure it out using the Chroma.DWG drawing file that ships with Civil 3D (and AutoCAD). The file is located here:

C:\Program Files (x86)\AutoCAD Civil 3D 2010\Support\chroma.dwg

Open the file and print it out using the new CTB file.


If you want to know the pen thickness of lines take edit the block representing the colors and replace it with a line making sure to change the color of the line to byblock.

For the other colors they use solids so you’ll have to draw lines for them and then use match properties to get the correct colors. It took about 5 minutes to print out both representations of the pens. A fairly easy task and easier then trying to decipher a pen table.

Tuesday, February 16, 2010

Is using Civil 3D Cost Efficient?

ThatCivil3DGuy blogged a post asking some questions regarding Civil 3D. Rather than post my response in the comments I thought I’d make a post about it. Further down are my answers to his questions. I was talking to a coworker today about Civil 3D and I liked his take on Civil 3D as similar to the video game Supercross where you are able to create your own layout of a track on a blank canvass.

Here are my responses to ThatCivil3DGuy’s questions:

What point do you decide if a certain project will or will not use the civil3d grading features?

If it helps meet the end goal of the design, the grading tools are going to be used. From creating a temporary grading to help grade a parking lot to tying the design into existing ground through the use of daylight grading. If it can help get the job done, gradings are going to be used.

I would like get your feed back on your end on how grading is done for small commercial lots and large subdivision projects?

Gradings for small commercial lots is primarily used to grade the parking portion of commercial lots. Temporary gradings are used to derive elevations for feature lines. Once the elevations are found they are modified to finalize the design. Additionally if the site lends itself a temporary grading will be used from the building pad to derive elevations for sidewalk elevations. For large subdivisions gradings are primarily used for daylight grading. Feature lines or polylines with elevation are used for the lot pads. For the roadways Corridors are used and then pasted into the composite finish grade surface.

On top of that, has civil 3d saved you money or caused you to increase the cost of projects? What has been the positive and negatives points about Civil 3d?

This is  really a question about how well a person knows Civil 3D and how to apply the tools available to reach the end goal. Take for instance a task to add points along an alignment at 50 feet intervals and at horizontal geometry points. The person started the task by manually adding points at the intervals. Civil 3D did have tools to accomplish the task in a matter of minutes rather than longer amount of time it would have taken to do it manually. It was a matter of knowing the tools where available and how to apply them.

Feature Line from Alignment

In Civil 3D 2010 you can create a feature line from an Alignment and Profile. There is an option on the home tab for feature lines. 


You have the option to either create a dynamic link or have it be static. Once we have the feature line we can project it back to a profile view to check to make sure Civil 3D has done the link correctly or make elevation changes to the static feature line. The benefit of projecting back to the feature line is that you don’t have to create a quick profile and you get to visually change the elevations of the feature line.

Monday, February 15, 2010

Autodesk Gallery and LEED

The ADN DevLabs was held at the Autodesk Gallery in San Francisco. The Autodesk Gallery is definitely worth the visit if you are in San Francisco near Market Street. The one thing I did notice was the LEED plaques plastered throughout the gallery.

When you put LEED plaques up I tend to look at what’s going on in the space more then I normally would. How are the occupants using the facility? Can I find the thermostats controlling comfort for the users? What could be done better? After all I took the test and past to become a LEED AP.

The first thing I noticed, while standing alone in the space, was that all of the exhibits were on and electricity was flowing. My first thought was, this is Wednesday and the Gallery is open to the public, but not for another 5 hours, why are all the exhibits on? Seems very wasteful, and I would expect more from a LEED Platinum Certification space. I asked if the exhibits were always on and was told that Autodesk tried to keep all of the exhibits on all week. A bit of wasted electricity. As I walked around the space I noticed other power goblins on. Such as the 3D printers humming away, but not producing anything.

The DevLab was confined to a small corner of the Gallery overlooking the Ferry Building. You could tell it was an exhibit space due to the projector constantly splashing images against a blank white wall. It didn’t seem like it added to the function, but kept changing from image to image and no one asked for it to be turned off. Regardless it was using energy that could have been conserved.

I checked out the bathrooms, they are large and spacious single user behemoths. I was surprised with all of the space there was just a toilet in place and not a waterless urinal; why would they rob me of using a waterless urinal to relieve my bladder and save water at the same time? I was a bit disappointed. In the bathroom they did have a cool high velocity air hand dryer, unfortunately I had used the paper towels placed conveniently next to the sink before noticing it. You’d think that a city that outlaws throwing away coffee grounds would outlaw paper towels in restrooms with air dryers.

Overall the LEED certification matched the purpose of the space, mainly marketing. It screams we care about sustainability as long as it is good marketing. After all there isn’t as much marketing impact coming into a room and turning on each exhibit as you view them. It’s much more impactful to come into a fully visually interesting room, but it also screams energy wastefulness. Is LEED about sustainability or marketing? Autodesk has pushed the needle further to the marketing side for me.

Saturday, February 13, 2010


Have you checked out the EKlectiCAD blog yet? He’s been at it for three months now, about the time when a blog either gets abandoned or continuous on with posts. Hopefully he’ll keep the posts coming.

Wednesday, February 10, 2010

Selection Problems

If you are having problems selecting objects after inserting images into a drawing try changing the MAPIOPTIONS to not require Shift + Left Click Image Select.


When working with images before I think I was having problems after images were inserted into a drawing because of my preference for using “Use Shift to add selection”. I ended up not being able to select objects.

Monday, February 08, 2010

Area in Acres

Sometimes you want an area of polylines in acres. The code below will let you select one polyline at a time and return the cumulative area of the polylines selected. I’ve used a Sub to start the command and a function to loop until the user doesn’t select something. It might be able to be done in a better manner.

   1: Option Explicit
   3: Dim dArea As Double
   5: Sub GetArea()
   7:     Do Until AddArea = False
   9:     Loop
  11: End Sub
  13: Function AddArea() As Boolean
  15:     Dim vPt As Variant
  16:     Dim oAcadObj As AcadObject
  17:     On Error Resume Next
  18:     ThisDrawing.Utility.GetEntity oAcadObj, vPt, "Select polyline: "
  20:     If oAcadObj Is Nothing Then
  21:         dArea = 0
  22:         AddArea = False
  23:         Exit Function
  24:     End If
  26:     If (TypeOf oAcadObj Is AcadLWPolyline) Then
  27:         Dim oPoly As AcadLWPolyline
  28:         Set oPoly = oAcadObj
  29:         dArea = dArea + (oPoly.Area / 43560)
  30:         ThisDrawing.Utility.Prompt "Area: " & Format(dArea, "#,##0.00") & " Acres" & vbCrLf
  31:         AddArea = True
  32:     Else
  33:         ThisDrawing.Utility.Prompt "Select Only Polylines" & vbCrLf
  34:         AddArea = True
  35:     End If
  37: End Function

Here’s the completed code if you want to download it: It was created in Civil 3D 2010, so if you download the above file you might have to change the references.

Thursday, February 04, 2010

Dynamic Profile View Labels

Since I started utilizing Civil 3D I’ve wanted to have the capability to have a profile label, indicating the type, that updated with profiles. I also wanted the flexibility to move it where I wanted it easily. I’ve come up with workarounds, but never was really happy with them.

For the past two days I’ve been at DevLab (AutoCAD) getting some help and feedback with making my wishes reality. The ADN employees where really helpful and I would recommend anyone trying to figure something out, through the API, to attend one. Unfortunately, for me at least, the Civil 3D DevLab is in New Delhi next month (starting on March 2, 2010).

Wednesday, February 03, 2010

I’m Not Quite Sure What to do

I was walking near the Ferry Building in San Francisco where I came across this sign. I saw the flashing rail car sign and the red hand. Mentally I can say I was confused the hand screamed stop and the train screamed walk.

SanFran 015

I’m not sure if the people rushing to get to the Ferry Building noticed the sign, they seemed to ignore both of them and walk straight across. I think the train should have been a different color, perhaps yellow for caution?

Talking of signs check out the new MUTCD for information on how to choose the correct sign for the correct location. I didn’t see a any standards for this case, but I think the eye would have been more appropriate here. I haven’t seen the eye before, but if you come across the eye it means to look out for cars as you use the crosswalk.

Tuesday, February 02, 2010


Just some sample snippets of code to add superelevation to an alignment via VBA:

Dim oAlignment As AeccAlignment

Dim oSuperElevationData As AeccSuperElevationData
Set oSuperElevationData = oAlignment.SuperElevationData

Dim oSuperElevDataElem As AeccSuperElevationDataElem
Dim dSta As Double
dSta = 625
oSuperElevData.Add dSta, oSuperElevDataElem

oSuperElevDataElem.SegmentCrossSlope(aeccSuperLeftInLaneCrossSlope) = 0.05
oSuperElevDataElem.SegmentCrossSlope(aeccSuperLeftInShoulderCrossSlope) = 0.06
oSuperElevDataElem.SegmentCrossSlope(aeccSuperLeftOutLaneCrossSlope) = 0.07
oSuperElevDataElem.SegmentCrossSlope(aeccSuperLeftOutShoulderCrossSlope) = 0.08
oSuperElevDataElem.SegmentCrossSlope(aeccSuperRightInLaneCrossSlope) = 0.09
oSuperElevDataElem.SegmentCrossSlope(aeccSuperRightInShoulderCrossSlope) = 0.1
oSuperElevDataElem.SegmentCrossSlope(aeccSuperRightOutLaneCrossSlope) = 0.11
oSuperElevDataElem.SegmentCrossSlope(aeccSuperRightOutShoulderCrossSlope) = 0.12

Monday, February 01, 2010

Set Points of Alignment on ROW

Some people have the need to set points on the ROW based on the geometry of an alignment and elevation of a profile. This post will show one method of creating an easy button to accomplish the task.

The first thing that needs to be added is some overhead items.

Option Explicit

Public g_oCivilApp As AeccApplication
Public g_oDocument As AeccDocument
Public g_oDatabase As AeccDatabase

' Start Civil 3D and create Civil 3D document and database objects.
Function GetGlobalCivilObjects() As Boolean
Dim oAcadApp As AcadApplication
Set oAcadApp = ThisDrawing.Application
' NOTE - Always specify the version number.
Const sAppName = "AeccXUiLand.AeccApplication.7.0"
Set g_oCivilApp = oAcadApp.GetInterfaceObject(sAppName)
If (g_oCivilApp Is Nothing) Then
MsgBox "Error creating " & sAppName & ", exit."
GetGlobalCivilObjects = False
Exit Function
End If
Set g_oDocument = g_oCivilApp.ActiveDocument
Set g_oDatabase = g_oDocument.Database

' Mark that this function was already called. No need
' do perform this action again once we already have the
' objects.
GetGlobalCivilObjects = True
End Function

Next some code needs to be added that gets information from the user, such as the alignment, offsets and profile. Also in there is the generic On Error Resume Next, but better error catching could be utilized.

Sub SetPoints()

On Error Resume Next

' Always get the objects again since MDI is supported.
If (GetGlobalCivilObjects() = False) Then
MsgBox "Error accessing root objects."
Exit Sub
End If

Dim oAcadObj As AcadObject
Dim vPickPt As Variant
ThisDrawing.Utility.GetEntity oAcadObj, vPickPt, "Select alignment: "

' Prompt the user for the alignment.
Dim oAlign As AeccAlignment
If (TypeOf oAcadObj Is AeccAlignment) Then
Set oAlign = oAcadObj
ThisDrawing.Utility.Prompt "That wasn't an alignment"
Exit Sub
End If

' Prompt the user for the Offset Right & Left.
Dim dOffRight, dOffLeft As Double
dOffRight = ThisDrawing.Utility.GetReal("Right Offset: ")
dOffLeft = ThisDrawing.Utility.GetReal("Left Offset: ")

' Prompt the user for the profile.
Dim oProfile As AeccProfile
ThisDrawing.Utility.GetEntity oAcadObj, vPickPt, "Select profile: "
If (TypeOf oAcadObj Is AeccProfile) Then
Set oProfile = oAcadObj
ThisDrawing.Utility.Prompt "That wasn't a profile"
Exit Sub
End If

Now that all of the information we need have been collected we can utilize it to accomplish our end goals. The first thing we need to get is the collection of stations. With this we can go through each station value and get the results. We can get different types of stations, in this case I’m getting the aeccGeometryPoint stations. This will get the collection of geometry points of the alignment.

    Dim oStation As AeccAlignmentStation
Dim oPoint As AeccPoint
Dim dX As Double
Dim dY As Double
Dim dZ As Double
For Each oStation In oAlign.GetStations(aeccGeometryPoint, 100#, 0#)

Next we need to get the geometry type in a string form to add to the description. To do this I’ll use a Function called GetGeomType (located at the end of this post).

        Dim dLoc(0 To 2) As Double
Dim sGeomType As String
sGeomType = GetGeomType(oStation.GeometryPointType)

Now I’ll get the point information for the right side and use that information to create a point and give it an appropriate description.

        ' Set the right side
oAlign.PointLocation oStation.Station, dOffRight, dX, dY
dZ = oProfile.ElevationAt(oStation.Station)
dLoc(0) = dX: dLoc(1) = dY: dLoc(2) = dZ
Set oPoint = g_oDocument.Points.Add(dLoc)
oPoint.Description = sGeomType & " " & Format(oStation.Station, "0+##.00") & " " & Format(dOffRight, "#.00")

And lastly I’ll do the same for the opposite side.

        ' Set the left side
oAlign.PointLocation oStation.Station, -dOffLeft, dX, dY
dZ = oProfile.ElevationAt(oStation.Station)
dLoc(0) = dX: dLoc(1) = dY: dLoc(2) = dZ
Set oPoint = g_oDocument.Points.Add(dLoc)
oPoint.Description = sGeomType & " " & Format(oStation.Station, "0+##.00") & " " & Format(-dOffLeft, "#.00")

And here’s the function to get the Geometry Type. If I didn’t know what the value should be I added “???”. You can change the value to the string that you want to use. For this function I’m pulling the abbreviations from the drawing settings.

Function GetGeomType(oType As AeccGeometryPointType) As String
Dim oAlignAbbrev As AeccSettingsAbbreviationAlignment
Set oAlignAbbrev = g_oDocument.Settings.DrawingSettings.AbbreviationSettings.AlignmentAbbreviations

Select Case oType
Case aeccBegOfAlign
GetGeomType = oAlignAbbrev.AlignmentBeginning
Case aeccEndOfAlign
GetGeomType = oAlignAbbrev.AlignmentEnd
Case aeccTanTan
GetGeomType = oAlignAbbrev.TangentTangentIntersect
Case aeccTanCurve
GetGeomType = oAlignAbbrev.TangentCurveIntersect
Case aeccCurveTan
GetGeomType = oAlignAbbrev.CurveTangentIntersect
Case aeccCurveCompCurve
GetGeomType = oAlignAbbrev.CompoundCurveCurveIntersect
Case aeccCurveRevCurve
GetGeomType = oAlignAbbrev.ReverseCurveCurveIntersect
Case aeccLineSpiral
GetGeomType = oAlignAbbrev.TangentSpiralIntersect
Case aeccSpiralLine
GetGeomType = oAlignAbbrev.SpiralTangentIntersect
Case aeccCurveSpiral
GetGeomType = oAlignAbbrev.CurveSpiralIntersect
Case aeccSpiralCurve
GetGeomType = oAlignAbbrev.SpiralCurveIntersect
Case aeccSpiralCompSpiral
GetGeomType = oAlignAbbrev.SpiralCurveIntersect
Case aeccSpiralRevSpiral
GetGeomType = oAlignAbbrev.ReverseSpiralIntersect
Case aeccPI
GetGeomType = oAlignAbbrev.TangentTangentIntersect
Case aeccCPI
GetGeomType = "???"
Case aeccSPI
GetGeomType = "???"
Case aeccBeginNormalCrown
GetGeomType = "???"
Case aeccBeginNormalShoulder
GetGeomType = "???"
Case aeccBeginFullSuper
GetGeomType = "???"
Case aeccEndFullSuper
GetGeomType = "???"
Case aeccEndNormalShoulder
GetGeomType = "???"
Case aeccEndNormalCrown
GetGeomType = "???"
Case aeccLevelCrown
GetGeomType = "???"
Case aeccLowShoulderMatch
GetGeomType = "???"
Case aeccReverseCrown
GetGeomType = "???"
Case aeccManual
GetGeomType = "???"
Case aeccShoulderBreakOver
GetGeomType = "???"
Case aeccInvalidSuper
GetGeomType = "???"
Case Else
GetGeomType = "???"
End Select

End Function

Lastly here’s the program in action:

If you want to download the program you can find it here:


Blog Widget by LinkWithin