Sincpac C3D Source Code

The following source code is being released in the interest of serving the community at-large.  This source code provided here is partially through the process of being revamped, and parts of it are still following older design patterns while other parts are following newer design patterns.  This can make parts of it a bit confusing to dig through.  However, it still illustrates many design patterns that are very effective for customizing Autocad, and Civil-3D in particular, using a .NET language.  At some point in the future, we will attempt to post a cleaner version of the code, complete with additional documentation about key components of the code, but there is currently no estimated time frame for when that might occur.

Note that the source code found here is but a small portion of what exists in the Full Edition of the Sincpac C3D.  Also, many things have been dramatically improved and reworked in the Full Edition of the Sincpac C3D, fixing some of the limitations in the code found here.  Unfortunately, the greatly-improved code in the Full Edition of the Sincpac C3D will remain proprietary, and will not be released for general use.  But if you wish to create your own customizations of Civil-3D, you will undoubtedly still find this source code full of invaluable examples.

In particular, this source code illustrates how to use components to "compartmentalize" all the grunge involved in dealing with the API.  This lets the developer easily create those messy, recurring constructs, often by simply dragging and dropping a custom User Control onto a Windows Form.

Notes on Design Patterns found in this code

There are many relatively advanced implementations of design patterns found in this source code, but the most-important is called MVC, or Model-View-Controller.  Basically, this involves splitting the code logic into three pieces.  The controller piece is the custom command logic, i.e. the "special stuff" that makes each command unique.  The model is the underlying data.  The view is the way the user interacts with and displays the data.

With this design pattern, each command is typically composed of three separate source code files (one of them a Windows Form), one file for each of the three logical portions of the MVC design pattern.  In addition, the stuff that occurs over and over again in the Model and View portions of the code - things such as combo boxes that ask the user to select a surface, or buttons that the user may click in order to pop up a layer creation dialog box - are then split off into two reusable components, which are located in the CommandParameters and Forms namespaces in the utility frameworks found in this source code. Now, when we are writing a new command and we need one of these common items, we can simply drag the User Control into a Windows Form, instantiate the corresponding CommandParameter, and link the User Control to the Command Parameter.  That's it.

Just be forewarned that this source code is still in the process of being refactored into a clean framework.  As you start to dig into it, it will become clear which aspects of the code have been refactored into "clean" code and which portions have not.  Just remember to focus on the items in the CommandParameters and Forms namespaces.

Terms of Use

At Quux Software, we feel that something like the core frameworks provided here should be part of the default SDK provided by Autodesk, it's just that Autodesk hasn't gotten around to creating it yet.  And while they've given us a powerful API, it is one that is oriented toward a very low-level and is unnecessarily-difficult to code against.  The simple controls provided in this source code make it much easier to develop against the core framework.  This code can be greatly improved-upon - in fact, most of the code has already been re-written for the Full Edition of the Sincpac C3D.  But by releasing this source code to the community at-large, we hope to raise awareness of what can be done, and maybe help keep others from needing to constantly "reinvent the wheel" from scratch.  Just keep in mind that this code is not in its final form, so if something seems incomplete or overly-complicated, it probably is.

And since we feel these libraries are too useful to restrict usage, and see no reason to force others to start from scratch, we also open these libraries up for free use in commercial products.  The only restriction is that only the files included in the AcadUtilities and C3DUtilities subprojects may be included in products distributed for retail sale.  The routines in the SincpacC3D subproject, such as the StakeFeatures routine or the ParcelOffset routine, may not be included in any retail product.  However, you may include these routines in programs you create for non-retail usage.  (Note: The usage statements currently in the code need to be revised.  We will soon be posting a new version of the archive that cleans this up.)

Download

This source code solution contains three subprojects, and was created using Visual Studio 2008 C# Express Edition, and written entirely in C#.NET, targeting the .NET 2.0 frameworks.  It will not open in earlier version of Visual Studio (unless you are an expert with Visual Studio and know how to manage such things).  And if you are used to previous versions of the Sincpac C3D, note that this version creates three DLLs instead of the single DLL generated in earlier versions.

Sincpac C3D 2010 Free Edition v1.00 Source Code with latest Help file (5.6MB) (last code update July 4, 2009)
Sincpac C3D 2009 Free Edition v1.00 Source Code with latest Help file (5.6MB) (last code update July 29, 2008)
Sincpac C3D 2008 Free Edition v1.00 Source Code with latest Help file (5.6MB) (last code update July 29, 2008)
Free Edition Change Log

CUI file for Sincpac C3D Free Edition (donated by Withers & Ravenel - many thanks!)

The C3DUtilities library and the Sincpac C3D itself will run in Civil-3D only.  However, the AcadUtilities library should work in any version of Autocad, and maybe other vertical applications, although I have not tried to compile it for anything other than Civil-3D.  If you are trying to learn .NET programming for an Autodesk product other than Civil-3D, you will not be able to compile or run the bulk of the code.  However, you should still be able to use the AcadUtilities library in your own projects, and you can poke through the rest of the code for examples of how to use the library.  So this library will probably still be useful for anyone attempting to learn to customize an Autodesk product with .NET.

Manual Installation

The Source Code archive contains three compiled DLL files and a compiled Help (CHM) file.  To load these files manually, place them in any directory on your local machine, and make sure that directory is in your Civil-3D Support path (type OPTIONS in Civil-3D).  Then add the following line to your ACAD.LSP file (if you do not have an ACAD.LSP file, simply create one in any text editor and place it in a directory in the Civil-3D Support path):

(command "netload" "Quux.SincpacC3D.dll")

When will this source code be updated?

Quux Software currently has no plans to release an updated version of this source code.  The primary purpose for releasing this code was to provide a significant sample project that others can use to learn .NET development, and this source code accomplishes that goal.

Autodesk Authorized Developer
Downloads
  • Sincpac C3D
    The Must-Have Collection of Tools for Civil 3D and Autodesk Civil
  • SPMiniPac
    A small subset of Sincpac tools that runs in any Autocad-based product, 2008 and later
  • Source Code
    Source code for early versions of some Sincpac C3D routines, for those who are looking for C#.NET coding samples