zoukankan      html  css  js  c++  java
  • 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);
                    }

  • 相关阅读:
    debian源
    python查找字符串所有子串
    python格式化输出
    Nmap扫描常用参数
    生日攻击
    python 逻辑运算符问题
    python装饰器中的计时器thd.strat用法
    One-hot encoding 独热编码
    协同过滤算法 teamCF
    bootstrap boosting bagging辨析
  • 原文地址:https://www.cnblogs.com/swtool/p/3828982.html
Copyright © 2011-2022 走看看