public static ProfileViewBandSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName) { ProfileViewBandSet retLabel; Database db = document.AcDocument.Database; ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles; using (Transaction trans = db.TransactionManager.StartTransaction()) { retLabel = new ProfileViewBandSet(trans.GetObject(bandRoot[labelStyleName], OpenMode.ForRead), false); trans.Commit(); } return(retLabel); }
public static List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> GetProfileViewBandSets(Autodesk.AutoCAD.DynamoNodes.Document document) { List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> alignmentLabels = new List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet>(); Database db = document.AcDocument.Database; ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles; foreach (ObjectId setStyle in bandRoot) { using (Transaction trans = db.TransactionManager.StartTransaction()) { ProfileViewBandSet labelSet = new ProfileViewBandSet(trans.GetObject(setStyle, OpenMode.ForRead), false); alignmentLabels.Add(labelSet); trans.Commit(); } } return(alignmentLabels); }