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 }