CAD在网页中得到批注信息

时间:2021-08-20 22:13:01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var  ss = mxOcx.NewSelectionSet();
     var spFilte = mxOcx.NewResbuf();
     // 把批注对象,当着过滤条件.
     spFilte.AddStringEx( "MxComment,MxDrawXCustomEntity" , 5020);
     // 得到图上,所有批注对象.
     ss.Select2(5, null , null , null ,spFilte);
     // 遍历每个文字.
     var bFind = false ;
     for ( var i = 0; i < ss.Count; i++) {
         var ent = ss.Item(i);
         if (ent == null )
             continue ;
         if (ent.ObjectName == "McDbComment" ) {
             // 得到批注对象。
             alert(ent.Text);
 
             alert(ent.Position.x);
             alert(ent.Position.y);
 
             alert(ent.BasePoint.x);
             alert(ent.BasePoint.y);
         }
         else if (ent.ObjectName == "MxDrawXCustomEntity" ) {
             // 得到批注对象。
             var stp = ent.GetPoint( "First" );
             var ept = ent.GetPoint( "BasePoint" );
             var txt = ent.GetString( "Text" );
 
             alert(txt);
 
             alert(stp.x);
             alert(stp.y);
 
             alert(ept.x);
             alert(ept.y);
         }
     }