文字

 1 [CommandMethod("fg")]
 2           public static void fg()
 3           {
 4               Document mdiActiveDocument = acApp.DocumentManager.MdiActiveDocument;
 5               Editor editor = mdiActiveDocument.Editor;
 6               Database workingDatabase = HostApplicationServices.WorkingDatabase;
 7               Extents3d ext = SSget.Corner("A", "B");
 8               Point3dCollection pts = new Point3dCollection(){ext.MinPoint,
 9                   new Point3d(ext.MinPoint.X, ext.MaxPoint.Y, 0.0),
10                   ext.MaxPoint,
11                   new Point3d(ext.MaxPoint.X, ext.MinPoint.Y, 0.0) };
12               SSget.FilterType[] fts = new SSget.FilterType[]
13             {
14 //             SSget.FilterType.Mtext,
15              SSget.FilterType.Polyline,
16                 SSget.FilterType.Line
17             };
18               DBObjectCollection dbs = SSget.CrossingPolygon(pts, fts);
19               if (dbs.Count == 0)
20               {
21                   return;
22               }
23               Point3dCollection ptsn =Cal.IntersectAny(dbs) ;
24               List<Point3d> Listpoint = new List<Point3d>();
25               foreach (Point3d px in ptsn)
26               {
27                   Listpoint.Add(px);
28               }
29               List<List<Point3d>> Listpoints = Cal.pointSort(ptsn);
30               DBObjectCollection txts = new DBObjectCollection();
31               DBText txt = new DBText();
32               using (Transaction transaction = mdiActiveDocument.TransactionManager.StartTransaction())
33               {
34                   for (int n = 0; n < Listpoints.Count - 1; n++)
35                   {
36                       for (int m = 0; m < Listpoints[n].Count - 1; m++)
37                       {
38                           txts.Clear();
39                           txts = SSget.CrossingPolygon(
40                             new Point3dCollection()
41                              {
42                                  Listpoints[n][m], Listpoints[n][m+1],
43                                  Listpoints[n+1][m+1],Listpoints[n+1][m]
44                              },
45                               new SSget.FilterType[] { SSget.FilterType.Mtext, SSget.FilterType.Text }
46                                          );
47                           if (txts.Count == 0)
48                           {
49                               continue;
50                           }
51                           foreach (DBObject dn in txts)
52                           {
53                               try
54                               {
55                                   txt = (DBText)transaction.GetObject(dn.ObjectId, OpenMode.ForRead);
56                                   editor.WriteMessage("\r\n" + n + "-" + m + txt.TextString);
57                               }
58                               catch
59                               {
60                                   continue;
61                               }
62                           }
63 
64                       }
65 
66                   }
67                   transaction.Commit();
68               }
69           }
View Code

 

转载于:https://www.cnblogs.com/luny147258/p/5701611.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值