|
|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:
. b$ U; m, R4 O+ f7 h1 YSub Example_ActiveLayer() - d s7 H* P* M. [
' This example returns the current layer # r) T T J Q" D
' and then adds a new layer. ; A2 A& u% N$ G5 s; v
' Finally, it returns the layer to the previous setting.
4 h' N7 x( o" J. b& k+ |Dim currLayer As AcadLayer 7 x0 f! D& g# H1 h7 ?* K) u
Dim newLayer As AcadLayer ' Return the current layer of the active document
: g @% e. v, M. [- mSet currLayer = ThisDrawing.ActiveLayer
" C/ Z3 y3 ^$ C) g, e5 G0 D4 h% E; W( dMsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"
, K5 R6 Y" K [; x2 }' Create a Layer and make it the active layer
" x+ w- b+ X9 u* j% f1 D; `$ p9 I0 kSet newLayer = ThisDrawing.Layers.Add("TestLayer") 9 l# w& q2 d7 n5 r* _
ThisDrawing.ActiveLayer = newLayer 2 m2 m# g/ X+ w
MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example"
Z5 p. U; L4 J" C6 P; w6 {' Reset the layer to its previous setting
`: H6 d% t8 Z! \% |" B& `ThisDrawing.ActiveLayer = currLayer
" u% z$ O8 h. [/ e0 b9 rMsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"
8 X! G6 }( Z, B. SEnd Sub
* x# f B/ [+ E& ~9 Z第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;: g3 Q/ ?/ j9 n+ p2 _9 Z3 H+ f0 |
/ w; s( [; `+ }) `3 z! C2 {5 }[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|