|
发表于 2009-12-11 20:30:58
|
显示全部楼层
VBA代码,供参考
/ Y8 z2 c' l2 k- Dim B As AcadBlock, E As AcadEntity, P As Variant, Ps(5) As Double, MT As AcadMText
" ^: i7 w. c V" S5 f2 J! W$ c - With ThisDrawing7 i/ O& k* e$ Y( P3 Z& s
- On Error GoTo 10
2 Y4 ^% c, Y! D+ a0 ~ - If .ActiveSpace = acModelSpace Then: D9 G$ f8 s+ d2 S. E0 _7 u ]
- Set B = .ModelSpace
3 z) P4 s5 W/ A; g) v, F - Else4 W3 A: j n+ h s: r& ?2 z+ @% Y: p
- Set B = .PaperSpace
! a7 L0 ]2 V5 [5 e - End If6 p) a8 y& o% L/ G0 r3 a3 h6 G
- .Utility.GetEntity E, P, vbCrLf & "选择对象:"
8 v! }- r: m& e: n - Ps(0) = P(0): Ps(1) = P(1): Ps(2) = P(2) s' p; }" M# b/ |
- P = .Utility.GetPoint(P, vbCrLf & "指定文字插入点:" )
4 i9 o( k# U/ q8 u' N6 `3 J - Set MT = B.AddMText(P, 0, "%<\AcObjProp Object(%<\_ObjId " & E.ObjectID & ">%).Layer>%" ); ~0 v# h1 o) J# }( I* k
- B.AddLeader Ps, MT, acLineWithArrow
( H+ s9 |) x. k: B+ I# Y - 10 End With
- @& n+ v5 y+ `
复制代码 |
|