/Civil3DDialogs

Primary LanguageC#MIT LicenseMIT

CivilDialogs

A library of helpful dialogs and helper methods to use with your Autodesk Civil 3D .NET projects.

Description

I created this library to be used with multiple of my Civil 3D projects. It contains common dialogs that I have used and created.

Dialogs

SelectAlignmentDialog

var dialog = new SelectAlignmentDialog();

if (dialog.ShowModal() == true)
   var alignment = dialog.SelectedAlignment;

Screenshot 2023-05-01 141017

SelectSurfaceDialog

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

image

SelectPointGroupDialog

var dialog = new SelectPointGroupDialog();

if (dialog.ShowModal() == true)
   var pointGroup = dialog.SelectedPointGroup;

image

LayerSelectDialog

LayerCreateDialog

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();

image

Getting Started

Dependencies

  • .NET Framework 4.7
  • Built with Autodesk Civil 3D 2023. (Should work on earlier versions, may need to lower the .NET Framework version)

Building the library

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.

License

This project is licensed under the MIT License - see the LICENSE file for details