Exemplo n.º 1
0
        public static SectionLabelSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            SectionLabelSet                retLabel;
            Database                       db        = document.AcDocument.Database;
            LabelSetStylesRoot             root      = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles;
            SectionLabelSetStyleCollection alignRoot = root.SectionLabelSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new SectionLabelSet(trans.GetObject(alignRoot[labelStyleName], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
        public static AlignmentLabelSet ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            AlignmentLabelSet  retLabel;
            Database           db   = document.AcDocument.Database;
            LabelSetStylesRoot root = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles;
            AlignmentLabelSetStyleCollection alignRoot = root.AlignmentLabelSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new AlignmentLabelSet(trans.GetObject(alignRoot[index], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
Exemplo n.º 3
0
        public static List <CivilDynamoTools.LabelStyles.Sections.SectionLabelSet> GetSectionLabelSets(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <CivilDynamoTools.LabelStyles.Sections.SectionLabelSet> alignmentLabels = new List <CivilDynamoTools.LabelStyles.Sections.SectionLabelSet>();
            Database                       db        = document.AcDocument.Database;
            LabelSetStylesRoot             root      = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles;
            SectionLabelSetStyleCollection alignRoot = root.SectionLabelSetStyles;

            foreach (ObjectId setStyle in alignRoot)
            {
                using (Transaction trans = db.TransactionManager.StartTransaction())
                {
                    SectionLabelSet labelSet = new SectionLabelSet(trans.GetObject(setStyle, OpenMode.ForRead), false);
                    alignmentLabels.Add(labelSet);
                    trans.Commit();
                }
            }
            return(alignmentLabels);
        }