|
发表于 2008-10-17 20:10:11
|
显示全部楼层
来自: 中国浙江宁波
楼主的问题acad的帮助中就有例程:) R- t o" t5 @- [
Sub Example_ActiveLayer()
?' o, \, A" h; k- Y ' This example returns the current layer & Z7 a3 q1 W, F9 q
' and then adds a new layer. }+ Z8 Y9 Q2 d( V
' Finally, it returns the layer to the previous setting. , j3 Z) f; }& F' {7 {1 K, o" m
Dim currLayer As AcadLayer
% ~, Y7 r! z7 U0 v0 K$ H' K) \: S: UDim newLayer As AcadLayer ' Return the current layer of the active document # K) i' W" U g& t# b: I: B8 z
Set currLayer = ThisDrawing.ActiveLayer $ S6 P' d7 a3 B. {, W6 l; i6 S/ d
MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"
! S- r; Z# e& X$ d% L8 F t/ t' Create a Layer and make it the active layer
n, _- D! p% O% {Set newLayer = ThisDrawing.Layers.Add("TestLayer")
/ w h0 H% Q+ r, O5 p' {* m( GThisDrawing.ActiveLayer = newLayer ) l1 J5 s8 N% z( ]8 B
MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example"
% V; B0 w! b |) N3 X K& g' Reset the layer to its previous setting 8 ?" X- r! w4 ^' X: P. r
ThisDrawing.ActiveLayer = currLayer 5 z) Y4 G H9 e) {' G* M$ O
MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"0 k7 s0 n+ Y6 D3 o6 [1 d" i
End Sub
' r" Q/ m( r7 f- B' @$ J第二个问题建议使用acadText对象,而不是mtext对象,具体参考alignment属性;
. J% p. L m; i: m% L K
x$ N! n) X. V' l[ 本帖最后由 sealive_leafage 于 2008-10-17 20:14 编辑 ] |
评分
-
查看全部评分
|