|
发表于 2009-12-11 20:30:58
|
显示全部楼层
VBA代码,供参考- 7 u& Z o' x8 L, Y) B' T- ?
- Dim B As AcadBlock, E As AcadEntity, P As Variant, Ps(5) As Double, MT As AcadMText
8 w* l1 M4 {; ^2 F4 d2 O# X0 h' N - With ThisDrawing
" B3 |2 q5 v3 ^ - On Error GoTo 10- y9 J: _7 R* e t$ N x& G
- If .ActiveSpace = acModelSpace Then* ?$ v; ^; N/ S$ u
- Set B = .ModelSpace
. z: e( e; B7 T - Else ?% C Y" j8 ~
- Set B = .PaperSpace
! \) a6 y* S" X - End If
0 v8 V; H% }5 S6 Q @ - .Utility.GetEntity E, P, vbCrLf & "选择对象:"+ C$ \- m- B3 P' N& R* ^4 e
- Ps(0) = P(0): Ps(1) = P(1): Ps(2) = P(2)9 M# `# V% K6 Z$ o
- P = .Utility.GetPoint(P, vbCrLf & "指定文字插入点:" )& k0 o& G, l" d! r9 r
- Set MT = B.AddMText(P, 0, "%<\AcObjProp Object(%<\_ObjId " & E.ObjectID & ">%).Layer>%" )
: [( D3 ?& E7 X) W; v, M" s3 E8 t - B.AddLeader Ps, MT, acLineWithArrow2 r% f/ \8 K& C% m
- 10 End With
& A$ ~/ y& u: m8 h! [2 v& B+ b
复制代码 |
|