|
|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:8 t7 Q8 z( c C9 E) i
Sub Example_ActiveLayer()
- ~& H4 g ^9 {, {8 i% i ' This example returns the current layer
8 z7 S& z9 E5 i' and then adds a new layer.
6 [0 I: r# }" c9 ^7 E% o0 x' Finally, it returns the layer to the previous setting. y1 }: {+ A4 O
Dim currLayer As AcadLayer
2 a$ F; F" c# G3 XDim newLayer As AcadLayer ' Return the current layer of the active document 5 e1 C( ?- |' V% Y! d. K
Set currLayer = ThisDrawing.ActiveLayer ) L, \0 }" H% W; p0 ? q! ]1 D- X( o
MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"
4 _* \; c3 j" A* M1 \+ D0 v' Create a Layer and make it the active layer & _: N# n9 h# s4 Q" `. h8 O' r
Set newLayer = ThisDrawing.Layers.Add("TestLayer")
+ E" Y0 R5 n7 O- k# _* K# c6 N( gThisDrawing.ActiveLayer = newLayer
$ N# p4 \/ S' C, [MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example"
; R% N) L- Z1 d1 T' Reset the layer to its previous setting
& L+ z; Z# B" v) L' KThisDrawing.ActiveLayer = currLayer , l9 `& W$ n% t/ Q" o" n" m
MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"
/ A A# I; ~6 p! o2 YEnd Sub0 @2 Q$ U" v# r* t! q
第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;6 J% M$ d; `* A! s1 C6 q" H
1 a2 S+ n7 b! V' K' _
[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|