public static ProfileLabelSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName) { ProfileLabelSet retLabel; Database db = document.AcDocument.Database; LabelSetStylesRoot root = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles; ProfileLabelSetStyleCollection alignRoot = root.ProfileLabelSetStyles; using (Transaction trans = db.TransactionManager.StartTransaction()) { retLabel = new ProfileLabelSet(trans.GetObject(alignRoot[labelStyleName], OpenMode.ForRead), false); trans.Commit(); } return(retLabel); }
public static List <CivilDynamoTools.LabelStyles.Profiles.ProfileLabelSet> GetProfileLabelSets(Autodesk.AutoCAD.DynamoNodes.Document document) { List <CivilDynamoTools.LabelStyles.Profiles.ProfileLabelSet> alignmentLabels = new List <CivilDynamoTools.LabelStyles.Profiles.ProfileLabelSet>(); Database db = document.AcDocument.Database; LabelSetStylesRoot root = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles; ProfileLabelSetStyleCollection alignRoot = root.ProfileLabelSetStyles; foreach (ObjectId setStyle in alignRoot) { using (Transaction trans = db.TransactionManager.StartTransaction()) { ProfileLabelSet labelSet = new ProfileLabelSet(trans.GetObject(setStyle, OpenMode.ForRead), false); alignmentLabels.Add(labelSet); trans.Commit(); } } return(alignmentLabels); }