示例#1
0
        public static string GetText(Point3d pt1, Point3d pt2)
        {
            //var p1 = Interaction.GetPoint("坐标1");
            //var p2 = Interaction.GetPoint("坐标2");

            string name = "";

            //string txt = "";
            ObjectId[]   objs = Interaction.GetCrossingSelection(pt1, pt2);
            CADShapeList sps  = new CADShapeList();

            for (int i = 0; i < objs.Length; i++)
            {
                ObjectId item = objs[i];
                var      sp   = item.ToCADShape(true);
                sps.Add(sp);
                //txt += string.Format("{0}\n", sp);
            }

            sps.SortByXY();//按坐标排序
            foreach (CADShape sp in sps)
            {
                if (sp.Text == "AC")
                {
                    continue;;
                }
                name += sp.Text;
            }

            //Gui.TextReport("名称:" + name, txt, 700, 500);
            return(name.Trim());
        }
示例#2
0
        public static void GetText()
        {
            var p1 = Interaction.GetPoint("坐标1");
            var p2 = Interaction.GetPoint("坐标2");

            string name = "";
            string txt  = "";

            txt += string.Format("p1:{0},p2:{1}\nobjs:\n", p1, p2);
            ObjectId[]   objs = Interaction.GetCrossingSelection(p1, p2);
            CADShapeList sps  = new CADShapeList();

            for (int i = 0; i < objs.Length; i++)
            {
                ObjectId item = objs[i];
                var      sp   = item.ToCADShape(true);
                sps.Add(sp);
                txt += string.Format("{0}\n", sp);
            }

            sps.SortByXY();//按坐标排序
            foreach (CADShape sp in sps)
            {
                if (sp.Text == "AC")
                {
                    continue;;
                }
                name += sp.Text;
            }

            MyTool.TextReport("名称:" + name, txt, 700, 500);
        }