private IEnumerable <string> getTextComponentNames(ObjectId styleId)
        {
            List <string> names = new List <string>();

            using (Transaction tr = startTransaction())
            {
                LabelStyle style = styleId.GetObject(OpenMode.ForRead)
                                   as LabelStyle;
                foreach (ObjectId id in style.GetComponents(
                             LabelStyleComponentType.Text))
                {
                    LabelStyleComponent component =
                        id.GetObject(OpenMode.ForRead) as LabelStyleComponent;
                    names.Add(component.Name);
                }
            }
            return(names);
        }
示例#2
0
文件: Pnt_Style.cs 项目: 15831944/EM
        getTextComponentNames(ObjectId idStyle)
        {
            List <string> names = new List <string>();

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    LabelStyle style = (LabelStyle)idStyle.GetObject(OpenMode.ForRead);
                    foreach (ObjectId id in style.GetComponents(LabelStyleComponentType.Text))
                    {
                        LabelStyleComponent lsc = (LabelStyleComponent)id.GetObject(OpenMode.ForRead);
                        names.Add(lsc.Name);
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt_Style.cs: line: 347", ex.Message));
            }
            return(names);
        }