|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:5 `, y' D. C2 m
Sub Example_ActiveLayer() 7 ^. b: Y; |% T
' This example returns the current layer ' k( V; K1 j8 M% q3 Y" K7 o
' and then adds a new layer.
) X" Y6 h# F$ r' Finally, it returns the layer to the previous setting.
* q& |3 E! f- V/ [4 UDim currLayer As AcadLayer
9 H! ^4 y& ] EDim newLayer As AcadLayer ' Return the current layer of the active document " L+ S0 a+ @. e* y8 y1 E
Set currLayer = ThisDrawing.ActiveLayer
, S \0 |, \8 ]: i3 xMsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example" - t7 s3 P1 ?) R% V8 U# @- _
' Create a Layer and make it the active layer 6 z) q0 |" o. S2 S/ \
Set newLayer = ThisDrawing.Layers.Add("TestLayer") + }7 ^& o, d9 J* @& o' w
ThisDrawing.ActiveLayer = newLayer 9 U, B. J0 g4 r; L, D1 y( F
MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example" : {: m; U# {! ?' W2 R
' Reset the layer to its previous setting # g4 k$ }0 Z3 S
ThisDrawing.ActiveLayer = currLayer
( v% A6 e/ C+ L, U dMsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"
3 A6 Q7 W% e) m; X( J: YEnd Sub6 R/ u" J( `0 V8 C9 b) Y
第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;* \. R; J1 t! L" \, q% J% l# _
7 z% C2 w+ C2 F& N
[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|