A library of helpful dialogs and helper methods to use with your Autodesk Civil 3D .NET projects.
I created this library to be used with multiple of my Civil 3D projects. It contains common dialogs that I have used and created.
- SelectAlignmentDialog
- SelectSurfaceDialog
- SelectPointGroupDialog
- LayerSelectDialog
- LayerCreateDialog
var dialog = new SelectAlignmentDialog();
if (dialog.ShowModal() == true)
var alignment = dialog.SelectedAlignment;
var surfaces = CivilApplication.ActiveDocument.GetSurfaceIds();
Surface selectedSurface;
if (surfaces.Count > 1)
var dialog = new SelectSurfaceDialog();
if (dialog.ShowModal == true)
selectedSurface = dialog.SelectedSurface;
else
selectedSurface = //Get first surface
var dialog = new SelectPointGroupDialog();
if (dialog.ShowModal() == true)
var pointGroup = dialog.SelectedPointGroup;
var dialog = new LayerCreateDialog();
dialog.ShowModal();
if (dialog.Layer == null)
return;
using var tr = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction();
var layerTable = (LayerTable)tr.GetObject(Application.DocumentManager.MdiActiveDocument.Database.LayerTableId, OpenMode.ForRead);
if (layerTable.Has(dialog.Layer.Name))
return;
layerTable.UpgradeOpen();
layerTable.Add(dialog.Layer);
tr.AddNewlyCreatedDBObject(dialog.Layer, true);
tr.Commit();
- .NET Framework 4.7
- Built with Autodesk Civil 3D 2023. (Should work on earlier versions, may need to lower the .NET Framework version)
To build the plugin make sure that you have references to the following Autodesk DLLs from your Autodesk Civil 3D installation directories.
- accoremgd.dll
- acdbmgd.dll
- acmgd.dll
- AecBaseMgd.dll
- AeccDbMgd.dll
Make sure to set the Copy Local
property of each Autodesk
reference to False
.
This project is licensed under the MIT License - see the LICENSE file for details