|
|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:
. r A7 t! m7 ? w; XSub Example_ActiveLayer()
# U. k/ v r: P0 \* A- l ' This example returns the current layer
! W% R5 }3 U0 s/ M/ q+ y' and then adds a new layer.
. C( h* h: q& \; `, h' Finally, it returns the layer to the previous setting.
/ {( o3 S: D+ A8 x# G+ U4 f' K, dDim currLayer As AcadLayer 6 ^* O0 h( u) F! ~3 [" R/ R2 r
Dim newLayer As AcadLayer ' Return the current layer of the active document
* G& S# o1 s# o w0 r' u. SSet currLayer = ThisDrawing.ActiveLayer : {# F( o5 A. o' a- r
MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"
6 G2 W( r; M1 q' ?0 B' Create a Layer and make it the active layer
1 B/ O2 i @; f: I- Q, vSet newLayer = ThisDrawing.Layers.Add("TestLayer") 6 U/ p- w: _. N5 h0 q4 _! H0 w
ThisDrawing.ActiveLayer = newLayer 8 v( P% V! _$ p- J( e
MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example" ! X1 M8 S6 K \ ?; r2 y, _4 w, C
' Reset the layer to its previous setting
. X6 z5 u, l- e% EThisDrawing.ActiveLayer = currLayer ' k& [5 c) V! |' u
MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example") [! Z4 V# Y7 r9 |& w9 \8 b& {) l
End Sub' g# D) V& D. m
第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;% E: F9 ~ X- z* Y% d5 P k( g3 e
/ {+ r) L& A+ Z& g, h
[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|