• Linq对对象进行范围排序


    ObjectIdCollection ids = STools.GetSelection();
                if (ids.Count == 0) return;

                using (Transaction trans = doc.TransactionManager.StartTransaction())
                {
                    List<DBText> sDBTxt = new List<DBText>();
                    foreach (ObjectId id in ids)
                    {
                        DBText sT = trans.GetObject(id, OpenMode.ForWrite) as DBText;
                        sDBTxt.Add(sT);
                    }

            //按x升序排列,按y值降序排列,可以先排序
                    var q0 = from e in sDBTxt
                             orderby e.Position.X
                             orderby e.Position.Y descending
                             select e;
            
            //方法2,推荐
                    var q1 = sDBTxt.Where(p => p.Position.Y < 658 && p.Position.Y > 150);

                    ed.WriteMessage(" 取y坐标值 < 658 且 > 150 的值");
                    foreach (DBText st in q1)
                    {
                        ed.WriteMessage(" Text:{0,-10}Y:{1,-20}", st.TextString, st.Position.Y);
                    }

  • 相关阅读:
    字符串形式导入模块
    pycharm 远程环境开发调试
    ubuntu 18.04 及初始化python3环境
    nbu备份虚拟机
    转载
    linux/centos/rhel同时安装oracle10g和11g
    多进程
    drf笔记
    单例模式
    常用模块
  • 原文地址:https://www.cnblogs.com/swtool/p/3828982.html
Copyright © 2020-2023  润新知