AutoCAD开发6--修改高程

 1 '定义过滤器
 2 
 3     Dim pType, pData
 4 
 5    
 6 
 7     'BuildFilter pType, pData, 0, "BlockReference", 8, "GCD", 62, 3 '建立图层是JZD?颜色为绿色的多段线过滤器
 8 
 9  
10 
11  
12 
13     BuildFilter pType, pData, 8, "GCD"
14 
15     '定义选择集
16 
17    
18 
19     Dim sset As AcadSelectionSet
20 
21     Set sset = CreateSelectionSet
22 
23     '
24 
25    
26 
27     '根据以上指定的过滤器建立选择集
28 
29    
30 
31     sset.Clear
32 
33     sset.Select acSelectionSetAll, , , pType, pData
34 
35    
36 
37     Dim pEntity As Object
38 
39     Dim pBlock As AcadBlockReference
40 
41     Dim pAttr As Variant
42 
43    
44 
45     Dim pCoords As Variant
46 
47    
48 
49     For Each pEntity In sset
50 
51         If pEntity.ObjectName = "AcDbBlockReference" Then
52 
53             Set pBlock = pEntity
54 
55            
56 
57             If pBlock.Name = "gc200" Then
58 
59                 pAttr = pBlock.GetAttributes
60 
61                 For i = 0 To UBound(pAttr)
62 
63                     pAttr(i).TextString = ChangeH(pAttr(i).TextString)
64 
65                 Next i
66 
67             ElseIf pBlock.Name = "GC022y" Then
68 
69                 pCoords = pBlock.InsertionPoint
70 
71                
72 
73                 If pCoords(2) <> 0 Then
74 
75                     pCoords(2) = 0
76 
77                     pBlock.InsertionPoint = pCoords
78 
79                 End If
80 
81             End If
82 
83         End If
84 
85     Next pEntity
86 
87    
88 
89     sset.Delete
90 
91     MsgBox "修改完成"

 

posted on 2019-12-12 11:37  Lzhm216  阅读(501)  评论(0编辑  收藏  举报

导航