Skip to content

Instantly share code, notes, and snippets.

@Civil3DToolChest
Created February 24, 2014 19:51
Show Gist options
  • Save Civil3DToolChest/9195691 to your computer and use it in GitHub Desktop.
Save Civil3DToolChest/9195691 to your computer and use it in GitHub Desktop.
get General Note Style
public Autodesk.AutoCAD.DatabaseServices.ObjectId getGeneralNoteStyle(string gnName)
{
Autodesk.AutoCAD.ApplicationServices.Document acadDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Autodesk.Civil.ApplicationServices.CivilDocument civilDoc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Autodesk.AutoCAD.DatabaseServices.ObjectId generalNoteStyleId = Autodesk.AutoCAD.DatabaseServices.ObjectId.Null;
using (Autodesk.AutoCAD.DatabaseServices.Transaction trans = acadDoc.Database.TransactionManager.StartOpenCloseTransaction())
{
foreach (Autodesk.AutoCAD.DatabaseServices.ObjectId gnsId in civilDoc.Styles.LabelStyles.GeneralNoteLabelStyles)
{
Autodesk.Civil.DatabaseServices.NoteLabel gns = gnsId.GetObject(Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.NoteLabel;
if (gnName == gns.Name)
{
generalNoteStyleId = gnsId;
}
}
trans.Commit();
}
return generalNoteStyleId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment