|
|
发表于 2013-9-24 05:34:18
|
显示全部楼层
来自: 中国吉林长春
本帖最后由 woaishuijia 于 2013-9-24 05:47 编辑 % ^0 _9 n- x* B6 u. R4 Z, |# S' _
4 j8 l% m) B$ q用 VBA 的"AddAttribute"方法添加块属性(单行文字)时,宽高比默认为1.可以在添加块属性后,用该属性对象的"ScaleFactor"属性修改宽高比.例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double
- j$ y4 \ _. s. I - Set B = ThisDrawing.Blocks.Add(P, "MMM")
- D/ Q, I5 t+ j - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")2 x0 N0 j1 T0 k- K* h
- AAA.ScaleFactor = 0.6) h6 j' @# m9 T; v5 R3 d
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 块属性(多行文字)的边界宽度用属性对象的"MTextBoundaryWidth"属性,例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double
) n: {4 t5 V3 [. u/ D) S6 h! H - Set B = ThisDrawing.Blocks.Add(P, "MMM")
( v* n/ w. J' w8 f - Set AAA = B.AddAttribute(2.5, acAttributeModeMultipleLine, "", P, "mm", "ffff")
b% k7 C2 X% J/ p, y9 p9 ~# Q - AAA.MTextBoundaryWidth = 1000 c9 a+ b% ?1 \
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 或者- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double- u0 \/ b. r' z6 Q: _' A" R) i
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
6 X: k$ y0 `* d - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")
' z6 }. O$ G! V; _2 t - AAA.MTextAttribute = True
, z+ x8 H$ i( U7 d6 ^5 g* l - AAA.MTextBoundaryWidth = 100
, g% c. D2 H$ l6 {: m; |3 t - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 |
|