Ad

Sunday, July 27, 2008

Subassemblies: Greater Than Zero

In Civil 3D 2009 some of the subassemblies you get an error when you input a zero depth. After the first few times this may get old. There is a way to get rid of it though, it takes some programming though. I haven't actually tested the code, but it should work.

The first thing you are going to need is to download a program that edits a vb.net program. Microsoft provides Microsoft Visual Basic Express Edition for free. Next open the Visual Basic Project that ships with the program. It resides at the following location (for Vista, XP will vary):

C:\Program Files (x86)\AutoCAD Civil 3D 2009\Sample\Civil 3D API\C3DStockSubAssemblies\C3DStockSubassemblies.sln

If you are using the 2008 Express Version you will be asked to update the code, go ahead and do it. Choose the Subassembly you want to change and scroll down to the part that checks the user input:

        '------------------------------------------------------------------------
'Check user input

If vBaseDepth <= 0 Then
Utilities.RecordError(corridorState, CorridorError.ValueShouldNotBeLessThanZero, "BaseDepth", "LaneOutsideSuper")
vBaseDepth = BaseDepthDefault
End If

This is the line of code that sends the error message to the Event Viewer when you enter a value less than zero. Since you probably want an error message to still exist for values less than zero change the code to read something like this:


        If vBaseDepth <= 0 Then
If vBaseDepth = 0 Then
vBaseDepth = 0.001
Else
Utilities.RecordError(corridorState, CorridorError.ValueShouldNotBeLessThanZero, "BaseDepth", "LaneOutsideSuper")
vBaseDepth = BaseDepthDefault
End If
End If

You will need to make the changes to the other user inputs and this should get rid of the error messages and make the depths an acceptably small number for Civil 3D. Build the code and replace the existing dll at C:\ProgramData\Autodesk\C3D 2009\enu\C3DStockSubassemblies.dll

No comments:

LinkWithin

Blog Widget by LinkWithin

Ad