|
发表于 2013-9-24 05:34:18
|
显示全部楼层
来自: 中国吉林长春
本帖最后由 woaishuijia 于 2013-9-24 05:47 编辑 0 p- [& c5 P9 Z M, a: W0 d( S2 ?8 ]1 Z
5 t" Z& j3 u7 u* H
用 VBA 的"AddAttribute"方法添加块属性(单行文字)时,宽高比默认为1.可以在添加块属性后,用该属性对象的"ScaleFactor"属性修改宽高比.例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double
9 d. c! f; m0 j* T2 E1 R8 y - Set B = ThisDrawing.Blocks.Add(P, "MMM")# u$ J6 R6 c& q0 ^( J1 z6 ^
- Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")/ w3 I& w+ s" s4 [2 q5 Z# V
- AAA.ScaleFactor = 0.6
; t6 V: |1 m n - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 块属性(多行文字)的边界宽度用属性对象的"MTextBoundaryWidth"属性,例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double4 ?! T8 [. T+ M6 b% N
- Set B = ThisDrawing.Blocks.Add(P, "MMM")0 ?1 Q( {% P. N9 g2 E6 i& l L# v
- Set AAA = B.AddAttribute(2.5, acAttributeModeMultipleLine, "", P, "mm", "ffff")
/ i: a% {* v; F1 Y - AAA.MTextBoundaryWidth = 1007 l1 u* V& w7 N' V
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 或者- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double7 h" w/ g0 X7 G8 O0 L* F) P
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
; P7 A. \9 _2 r# u& q# S4 T$ q( J. X - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")
& y) G8 F0 U3 U% y8 i' r - AAA.MTextAttribute = True
' r$ D5 c X" I9 `# ^6 m) z - AAA.MTextBoundaryWidth = 100
$ ]) I( J; W6 y$ I) e4 B4 f5 {$ D. d - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 |
|