Sunday, June 27, 2010

Lock Viewport

Just a quick reminder to myself.

You can lock/unlock an active viewport in Model Space using the tools on the Drawing Status Bar or change the viewport’s scale. This is especially helpful if the viewport is on an off or frozen layer and it’s not easy to get into the properties of the viewport.


Saturday, June 26, 2010

Extension Methods

Have you ever wished the Civil 3D API had additional methods? If you have you might want to check out extensions. If your an amateur programmer like myself you probably don’t have much of a clue what an extension method is. Essentially .NET programming lets you take an existing object or class and extend it with additional methods or properties. An example of how to create an extension is in the Free Version of the SincPac. As well as a good example of how to create it, the extension methods may be used to shorten your programming tasks.

For instance you may have a routine that asks the user to select a surface. Of course you don’t want the user to try to select a surface if one isn’t available. Using the SincPac we can use the AeccDatabase Extension to see if a surface exists. We don’t have to recreate the code to see if a surface exists. By using extensions we can reduce the amount of code we have to come up with.

Imports Autodesk.Civil.Roadway.DatabaseServices
Imports Autodesk.AECC.Interop.Land
Imports Quux.C3DUtilities.Extensions
Imports Quux.C3DUtilities
Imports Autodesk.Civil.DatabaseServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices

Public Class SincPacExtensionExample
Public Sub SincPacExtensionExample()
Dim aeccConn As New AeccAppConnection
If aeccConn.AeccDb.DrawingContainsSurfaces Then
' Do something
End If
End Sub
End Class

Taking a look at the SincPac code we can see the code is relatively simple for the method being accessed in this case; others included are more involved.


So hopefully you’ll find the extensions available in the SincPac useful; either as an example for creating your own or using the ones already included.

Tuesday, June 22, 2010

Superelevation Report – Part 4

To finish up the report I need to check to see if the description is empty. This way I can add a nonbreaking space to have a value added to the table and to get a border shown correctly.


I also need a way to convert the SuperElem.TransPointType to a string. To do this I’ll create a new function and create a dictionary of all of the possible values and then check to see if it exists in the dictionary. If it doesn’t exist I’ll return “Invalid”.


There are occasions when the superelevation data doesn’t exist on the alignment to prevent any error messages I’ll check to see if the point is located on the alignment.


I’ll still output the information of the superelevation point, but I’ll return “Not on Alignment” instead of nothing. No running the code the report looks acceptable. Some additional formatting could be done, but it’s mostly complete.


The completed report code and dll may be downloaded here: It’s only going to be saved a year after the last viewing, so it may not be there forever.

Monday, June 21, 2010

Changing Revit Dimension Unit Format

A short Screencast showing how to change the unit formats for dimension Family Type.

Changing Revit Units

A short Screencast showing how to change the length units in Revit from something extremely difficult to type into a calculator to something easy to type into a calculator:

(Units from fractions to decimal format)

Friday, June 18, 2010

Superelevation Report – Part 3

In the previous two posts I’ve collected the information and set up the code to output the information. Now I’ll set up the report to run within Civil 3D. The first thing I need to do is rename the name of the dll that is created once the project is built.  To change the name double click on the My Project folder in the Solution Explorer. Then change the Assembly Name, in my case I called it C3DReportSuper.


Once I ran the report I found that it didn’t run. The cause of this is because I didn’t add a command to run the report.


Adding in the command with the correct name corrected the problem, after closing and reopening Civil 3D.


I try again and end up with another error message:


Looking at the code it didn’t like me deleting some references to TextBoxes, but pressing continue continues the code. But it looks like I have problems due to the code I removed for not having Microsoft Excel installed. Looking further into it the Source for the reports comes with the dlls for Excel and Word. They are located here:

C:\ProgramData\Autodesk\C3D 2011\enu\Data\Reports\Net

So if you don’t have Office installed you can find the required references there. A review of the code shows where it’s not being able to add the code. Some well placed ‘ stop the program from trying to add the list boxes that aren't there anymore.


Running the report again creates the report.


But we probably want all of the information on one line and have the Smooth Curve Length, Description and Type filled out.

To fix some of it, remove the lines with “&nbsp” and move the Station, Northing and Easting lines up in the code. Also remove the if then part of the code.


And also add in the lines for the Smoothing Length, Description and Type, which I forgot to add in earlier.


Now running the report gives us the information we are looking for except for the Type. For the Type a cryptic number is provided. In another post I’ll convert the Type to Text so it shows up correctly.


Wednesday, June 16, 2010

Superelevation Report – Part 2

In the imagelast post we did some housecleaning and collected the superelevation information from an alignment. Now that we have collected the information we need to output it to our report. To do this go into the ReportForm_AlignSuper.vb class. Right click on a portion of the form and choose "View Code”.

Within this class you should see some lines starting with oHtmlWriter.RenderTd. These lines of code add a column header. We’ll modify and add to these lines of code for the information we’ve collected. Rather than use a localized string we’ll use text enclosed in quotation marks. I suspect they use the localized strings for the various terminology differences around the world. For instance I never have the opportunity to use the carriageway terminology they use in England.



Now that we have the headers filled out I’ll add the information for the rows of the table.


Now all imagethat needs to be done is to run the report and check for errors. I happen to have 24 errors, though most of them appear to be due to not having Microsoft Office installed and not pointing to the AutoCAD references. I went ahead and removed all references and added a Reference Path to the AutoCAD folder. You can find the steps to add the reference folder in the Sincpac setup post.

Now the report will build without error and I can try it out in the next post.

Tuesday, June 15, 2010

Concrete Frisbees

I recently had the opportunity to volunteer to make concrete Frisbees at Cal Poly, San Luis Obispo as an outreach to local students. The purpose of the event is to introduce young people to the Civil Engineering profession. The event was run by the Society of Civil Engineers student chapter, also known as the winners of the past two Robert Ridgeway Awards, in conjunction with the local branch of the American Society of Civil Engineers. Essentially the students run the events and the professionals help out where they can. I’ve been told winning the Robert Ridgeway Award consecutively is the equivalent of winning two national championships in a row.  Unfortunately it doesn’t get the same press as football.

The event was fun and educational. It started out with Professor Fiegel, a previous instructor of mine, leading the group in some activities to get us going. The picture below shows him in action along with a concrete canoe on the stand.


After the warmup the group went inside with an informative presentation on the important questions regarding concrete, who, what, when, where, why and how.


After the presentation we went to work helping the local students making concrete Frisbees. The students put together the dry mixes while the members of SCE mixed together the dry ingredients. It was interesting to see how the different batches turned out. If you want to make your own concrete Frisbees some of the proportions used may be found on the chalkboard.


To start the students cut out reinforcing consisting of fibrous fabric. Forms for the Frisbees consisted of what else, slightly oiled Frisbees.


Once the forms, dry ingredients, wet ingredients, and reinforcing were ready it was time to mix the concrete up in the Kitchenaide mixers.


Safety first of course, gloves, eyeglasses and dust masks where worn during the mixing.


Next up putting the concrete mix into the forms.


Once complete the concrete Frisbees were placed within the curing room.


The students will come back June 17 to participate in a Frisbee golf event using the newly created Frisbees. In addition they'll be able to check out the top concrete canoes from throughout the country as the winning schools from regional events descend into San Luis Obispo for the National Concrete Canoe competition.

Interview – Jim Quanci

At AEC DevCamp I was fortunate to be able to interview Jim Quanci, Director of Autodesk Developer Network (ADN). I sat down with him at lunch and discussed some questions I came up with. Over the past 19 years Jim has worked with Autodesk’s technology software partners. Previously he worked for Sun Microsystems and GE. He mentioned he worked with 1/2” tape to store CAD data. I couldn’t imagine working that way.

In the Civil Engineering community I tend to see an overall reluctance with the acceptance of third party applications to facilitate a person’s job. I explained how I often hear or read complaints of individuals not wanting to purchase third party software. He recognizes the problem as ongoing and there is a attempt to include information on add on products in the promotional material. I felt the overall goal, though not always included, of the Autodesk strategy is to include the basic functionality and have third party developers fill in the void.

Throughout the DevCamp I noticed a different attitude of the Autodesk ADN employees that I don’t normally receive through the normal Autodesk channels. He indicated Autodesk isn’t structured for one on one interaction and relies heavily on the reseller network. Autodesk ADN is able to provide more personalized interaction because providing customization services Autodesk is able to leverage the one person to affect many. Additionally if a person does join ADN the support can provide the company a competitive advantage by helping them build an application themselves.

One example of this I observed at DevCamp was a program a colleague created, along with others, for his company. The program incorporated Civil 3D objects, Excel Spreadsheets and a link between them. The program was set up to match the existing workflow of spreadsheets and tie it directly into the Civil 3D model. The program appears to have created a competitive advantage for the company since they are able to go from design to plans in a shorter time.

Finally I asked him if Autodesk has a sense of humor. He indicated that definitely yes Autodesk has a sense of humor and attempts to not take itself too seriously. He related a story that Carl Bass, CEO of Autodesk, often tells. Carl tells of a story of getting letters from an “owner” of Autodesk. Every so often the person would write demanding Carl do a better job and if he failed the person would fire him, since he owned Autodesk. After a while the person sent a letter explaining to Carl that he had been fired. I think the story does relate from the top that Autodesk does have a sense of humor. (Another interview on Carl may be found here in which he relates the story.)

Friday, June 11, 2010

Autodesk AEC Headquarters’ First Floor Men’s Bathroom

In a previous post I highlighted the storm water drainage system at the Autodesk AEC Headquarters. Today I decided to take a tour of the Men’s restroom. I thought it was time the bathroom gets it’s rightful publicity. The only publicity I saw in regard to the bathrooms at this location was a vague reference to water efficient fixtures. For a room that’s so integral to the safety of the occupants, I can’t believe more people don’t publicize their bathrooms.

The entry door is your standard entrance door to a bathroom, complete with kick plate and signage.


The handicap stall is spacious with grab bars that look compliant with ADA requirements. Though I didn’t get out my tape measure to make sure.


In addition to the handicap stall there are two smaller water closet spaces with bathroom tissue dispensers and toilet protective covers.



Also included is a waterless urinal. In addition to not using water to remove the waste from the device, it has a bee icon. I assume this is where one is supposed to aim while relieving ones self.


I also heard today that Cisco has a similar device in their restroom, although they don’t have the stylish yellow strainer.

The water closets also have dual flush valves. Push up for light waste and down for more troublesome wastes.



In addition the lavatories have automatic soap dispensers and faucets.



It’s kind of hard to see, but the faucet appears to be solar powered.

For the drying of hands an automatic paper towel dispenser is available along with a waste disposal basket. To the right is a hand sanitizer dispenser. It’s interesting that they didn’t go with a high velocity air hand dryer to cut down on paper waste.


Overall the bathroom had nice finishes and appeared to be kept clean. I’d would have taken pictures of the women’s bathroom, but males usually aren’t welcome to enter there. So instead I’ll provide a picture of the door which is similar to the men’s room.


Thursday, June 10, 2010

Autodesk AEC Headquarters – Waltham, MA

Today I’m Waltham, MA a portion of AEC DevCamp. The first place I visited today was the storm water storage system in the back. Not quite sure why it’s way in the back. I guess they were embarrassed they did not have method to analyze Storm water in their portfolio of products. If I was Autodesk I’d want the storm water storage as visible as possible. As you can see from the picture below it would be barely visible from the inside.

2010-06-10 112

The system appears to consist of inlets and piping conveying water from the roof and parking areas to the storm water storage system. From there it enters a rip rap outlet into a rain garden.

2010-06-10 119

2010-06-10 116

After the rain garden the water flows into a wet storage area through a rip rap covered weir. Unlike in California it appears the facilities are able to store water for long periods of time. In California due to the dry weather facilities typically are required to be empty 2 days after the storm event.

2010-06-10 118

Once the pond fills up water flows into an inlet. If enough storm water exists the water flow through a rip rap lined weir into an adjacent storm water conveyance system.

2010-06-10 106

Here’s some more pictures, my apologies if you have a slow internet connection.

2010-06-10 107

2010-06-10 108


Wednesday, June 09, 2010

Label Curve Center Point

Sometimes you need to label the center of the point. It would be nice to have the solution to be dynamic. If we use a Curve Label it is possible to have a dynamic solution as the curve moves. There are some cases where the label will need to be added again, but for the most part if the alignment changes the label will update it’s location back to the Curve Center Point.

To accomplish this three expressions are needed. The first is the length from the start of the curve to the center point, also known as the radius. The radius value needs to be divided by the Drawing Scale Conversion in order to eliminate Civil 3D from adjusting the length. The second expressions checks to see if the curve goes to the right or the left and determines if the angle of rotation from the start direction, 90 or –90 degrees. The CenterTextRotation adjusts the block have the text anchored to the block to show horizontal to the bottom of the printed page.


Radius/{Drawing Scale Conversion}


IF({Start Direction}+{Delta Angle}>2*pi,IF({Start Direction}+{Delta Angle}-2*pi={End Direction},pi/2,-pi/2),IF({Start Direction}+{Delta Angle}<={End Direction}+0.00000001,-pi/2,pi/2))


IF({Start Direction}+{Delta Angle}>2*pi,IF({Start Direction}+{Delta Angle}-2*pi={End Direction},{Start Direction}+pi,{Start Direction}),IF({Start Direction}+{Delta Angle}<={End Direction}+0.00000001,{Start Direction},{Start Direction}+pi))

After creating the expression the values may be used to create a label. By adding a line with rotation of CenterAngle, Visibility to False and the length as the CenterPoint. Next add a block at the end of the hidden line and then anchor the center point text to the block. We then get a label that looks something like this:

One is able to download a drawing from this page:

The drawing is done in Civil 3D 2010.

Alignments and Profiles Automation in .NET

More notes.

Alignment Methods and Properties haven’t changed much from COM to .NET

Superelevation has changed quite a bit and COM is no longer supported, one has to use .NET.

Bunch of stuff I can’t take notes on here :( Sorry, folks. But very good news hopefully makes it into the product.

Items for a system:

  • Operating System: Windows 7 64-bit
  • RAM: Fill the slots that are open, but don’t bust the bank getting more RAM
  • Core Speed: Get the fastest Core speed, not more cores.

Tuesday, June 08, 2010

Surface Manipulation

More AEC DevCamp Notes.

Why .NET?

Better performance than COM

Support for larger objects.

New features (Future), COM probably won’t be updated.

Examples on wrapper class. Segregate the .NET code and the COM objects.

Don’t forget to commit the Transaction!

To update a surface two transactions need to be used after adding a breakline. Once after the breakline is added and again to update the surface.

Migrating Civil 3D VBA to VB.NET

More AEC DevCamp Notes

Subassembly Migration

Recipe based approach to convert the code

Location for Subassembly and Pipe Rules Source Code: C:\Program Files (x86)\AutoCAD Civil 3D 2010\Sample\Civil 3D API

Help topic has Help topic on Converting VBA Subassemblies to .NET (In Developer’s Guide)

Three things to handle: Code, ATC File, Convert Subassembly from VBA to .NET

Code: Create, Copy Code, Port the Code

Has a list of items to change, an easy search and replace.

ATC File, change the values. No easy way to create it.

Has code example to convert the existing VBA Custom Subassemblies to .NET subassemblies. Need to do.

Pipe and Structure Rules

Rules run in order on the list, I tend to forget this. It is important to know to make sure if the rule needs to be done first or last.

Rules have different activities, Apply, Validate, and something else.

Piperules.xml contains the parameters of the rules, it is only run once and stored in memory. Can’t make changes to it on the fly.

File shown contains the strings. C:\ProgramData\Autodesk\C3D 2010\enu

Data types are now found in help. Tool Catalog Data Type Information (Not quite sure when this was added, may have been there the whole time I was looking for this information.

No transactions are in the code due to RulesTemplate

Set the networkState.LastElevation = oPipe.EndPoint.Z

[Structure] is correct, I wasn’t sure if it was or not.

Civil 3D Styles and Command Settings Automation in .NET

These are my notes from the Experts: Civil 3D Styles and Command Settings Automation in .NET class I attended at AEC DevCamp.

Command Settings

User Defaults, Controls everything from which label styles will be used to the default numeric values.

All of the command settings in Civil 3D 2011 should be available. If you find one’s that’s left out let me know and I’ll request it be added.

Command Settings Export

Can export them out to an XML file, example in the class.

Uses a StringBuilder to add the items to to add to the XML file.

Need to add references to the Civil 3D .NET API: AeccDbmgd.dll (In the program folder)

AecBaseMgd.dll, is the framework for OMF, needed for the program to compile correctly.

System.Windows.Forms, contains the Windows Save Dialog box to save the file.

Need to look at the Toolbox in Visual Studio, to put often used code.

Sample code provides a method to check to see if the setting is a command setting.

The sample code uses Reflection to get the information, an example to look at later to get what that exactly means.

Make sure to set the references to Copy to Local to false.


Can use to see what’s available to change/access.


“Civil 3D is a style based design application”

All styles in 2011 should have access.

Styles Structure – All styles have a common root or collections of styles (Similar to Toolspace Collection layout)

Usually organized by features (Example of one not is General)

Demo, Styles Compare Application

Has a slightly different example than what is included in Civil 3D samples.

An example of how to get the data from two different drawings and then go back to the original drawing.

Try to use a single transaction and not nested transactions to avoid potential problems.

Need to through an exception if an object is not a Root or a Collection when looking to see what type of object it is. Shouldn’t happen, but should handle it someway incase in the future something changes.

Display settings as strings regardless of value to avoid having to do additional work to figure out the value should be.

Uses tree to show the information in a Presenter. Uses colors to show the difference.

Can’t use For Each to go through the objects because the drawings may have different number of styles in each object. Has assumptions on sorting the information. Civil 3D may not return the information in order. The sample code sorts the information.

Check out the code for transactions and not using them.

Thursday, June 03, 2010

Using the Sincpac Source Code in vb.NET

In the last post I went over how to create a command within the Sincpac source code. In this post I want to use the source code in a vb.NET project, mainly the Civil 3D Reminders pack. I really don’t like how hard it is to use the code in the help files to get the Civil 3D database and document. It really confuses me and I don’t like having to keep track of the versions. By using the Sincpac source code I can remove that frustration that I have.

The first step is to open the project and add the Quux.AcadUtilities.dll and Quux.C3DUtilities.dll files created by the Sincpac source code as references.

Next add the references to the top of the code, along with the other Imports.


Now the code from those dll’s will be available to use. So I’ll create an object for the AeccAppConnection that replaces the GetCivilObjects() in the original code.


Now I have to go through the code and replace the g_oCivil3DDoc with aeccConn.AeccDoc. Once done I have a much easier way of getting the Civil 3D document and one in which I don’t have to worry about the code. I can also use the other code within the Sincpac. If I wanted I could even recreate the code in and not have the entire Sincpac code come along.

While I haven’t fully exploited what I can do with the Sincpac source code this should provide you the steps to use the code within your vb.NET code.

Tuesday, June 01, 2010

Superelevation Report – Part 1

Creating a Superelevation Report.

First copy the source files for the report, put it in an easy location to find. (For WIndows 7: C:\ProgramData\Autodesk\C3D 2010\enu\Data\Reports\Net)

Rename the AlignSta_ExtractData.vb to AlignSuper_ExtractData.vb and ReportForm_AlignSta to ReportForm_AlignSta.vb, from within Visual Studio.

Change the index at the front of the AlignSuper_ExtractData.vb to match what information is needed to be extracted. In this case all of the information available is extracted.


Next revise what’s extracted from the alignment. In this case the Superelevation information.


In the next post I’ll revise the report code for the output.


Blog Widget by LinkWithin