|
|
发表于 2013-9-24 05:34:18
|
显示全部楼层
来自: 中国吉林长春
本帖最后由 woaishuijia 于 2013-9-24 05:47 编辑 ! d: j& r' z3 a, ^ T( I; T3 u5 ]3 P
- U% ~1 p) }' Z4 N用 VBA 的"AddAttribute"方法添加块属性(单行文字)时,宽高比默认为1.可以在添加块属性后,用该属性对象的"ScaleFactor"属性修改宽高比.例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double; `1 j/ A( I' a- {- A5 C
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
8 u$ w# h+ s* L6 L - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff"), L" k3 s, k3 u+ b. k6 o
- AAA.ScaleFactor = 0.6
. o# f5 S9 Z" c - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 块属性(多行文字)的边界宽度用属性对象的"MTextBoundaryWidth"属性,例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double* a& @6 g, I$ U- s9 A4 Y6 [3 K
- Set B = ThisDrawing.Blocks.Add(P, "MMM")/ _ ^! Y" O' q) u. w/ [
- Set AAA = B.AddAttribute(2.5, acAttributeModeMultipleLine, "", P, "mm", "ffff")
6 a; j; M/ v, v9 ~ - AAA.MTextBoundaryWidth = 100 {5 B& \4 J9 e0 O; ^- L0 A, `
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 或者- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double# P+ }) \* f- m. `7 K; D
- Set B = ThisDrawing.Blocks.Add(P, "MMM"). i! J! w8 m$ W* ]
- Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")1 y$ t, h8 N5 C/ e
- AAA.MTextAttribute = True" r K" S) |: P) A+ o3 w- O
- AAA.MTextBoundaryWidth = 100* d1 D7 u2 e. _4 f1 p
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 |
|