|
|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:
) `. O. C. i. ^3 Q! n7 o* D) NSub Example_ActiveLayer()
5 d+ c9 V. ]7 m' j. L) ~+ C ' This example returns the current layer 8 {) D/ I7 x- ^4 R: M
' and then adds a new layer. ! X' k, P. G. ]& G
' Finally, it returns the layer to the previous setting. $ Q( \$ o6 `5 p5 q: `
Dim currLayer As AcadLayer
" J2 l. `! ^6 B; Z$ ~) y$ tDim newLayer As AcadLayer ' Return the current layer of the active document
# r+ q3 _6 b) f4 LSet currLayer = ThisDrawing.ActiveLayer / d% Q* E6 h7 Q
MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"
2 f+ I2 Z; \2 ]* H* U1 @' Create a Layer and make it the active layer
" X% A* K" T- m6 D. B9 _4 ]8 X8 HSet newLayer = ThisDrawing.Layers.Add("TestLayer") / i: a2 `' }) d6 _' L2 Y3 e+ o
ThisDrawing.ActiveLayer = newLayer
- x2 f. O g- i# C, |MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example"
& U% l5 t' T j" d' Reset the layer to its previous setting
( ~$ D# g! F( M4 I- [3 ~4 SThisDrawing.ActiveLayer = currLayer 1 b/ B I9 K6 d, Y% V+ J5 p
MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"2 k5 o4 [+ }8 t) l$ }5 |) P' o
End Sub
. @3 m# k: _: S( ]7 k# A' C第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;
: R/ k% F0 x) M/ C' i1 e. W& V! T% v) T" k& o
[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|