|
|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:
7 i' R. s6 B7 G/ o' kSub Example_ActiveLayer() - J6 [: e$ U. F( L
' This example returns the current layer
# f! z0 {2 }. ~' and then adds a new layer. / c! J: V [. N
' Finally, it returns the layer to the previous setting. # J3 L f0 ^* v$ Q( A5 ~
Dim currLayer As AcadLayer * D" J* W. z' }% M+ Z. P* Q, [; P: i
Dim newLayer As AcadLayer ' Return the current layer of the active document
* E" a% w7 ? oSet currLayer = ThisDrawing.ActiveLayer ; h. Z- V& i" u% s* h2 q
MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example" 7 a2 t% I; ~7 b% C8 J
' Create a Layer and make it the active layer
6 L' L' S$ `0 M- l! M9 d+ jSet newLayer = ThisDrawing.Layers.Add("TestLayer") ; |5 J* V9 s( d, e& |& [$ A
ThisDrawing.ActiveLayer = newLayer
) R" [3 M( }% `0 G& }8 G, jMsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example" ( Z% s& ~# }% V
' Reset the layer to its previous setting
9 J6 v W+ E3 K+ Y1 cThisDrawing.ActiveLayer = currLayer
% E/ X, z0 g2 y c& g' RMsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"
& ]* _; R$ G: Q3 \! xEnd Sub! @8 b W/ P$ |' C
第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;% s- w6 ~! G1 w. _) f+ H6 J% T, ?
) O+ a- K! V( L1 K[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|