|
发表于 2013-9-24 05:34:18
|
显示全部楼层
来自: 中国吉林长春
本帖最后由 woaishuijia 于 2013-9-24 05:47 编辑 # S* N) j4 O$ }+ u# @
# X/ q" s# u6 m- U; n& w; Z用 VBA 的"AddAttribute"方法添加块属性(单行文字)时,宽高比默认为1.可以在添加块属性后,用该属性对象的"ScaleFactor"属性修改宽高比.例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double# c; j! y5 x& L/ C7 v5 J8 d1 I
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
$ W O4 n% { @4 ^4 @ - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")% Y4 G1 n/ v+ L1 u) F1 Y! E
- AAA.ScaleFactor = 0.6* M+ U5 j5 t- m2 i" g4 f1 ]
- ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 块属性(多行文字)的边界宽度用属性对象的"MTextBoundaryWidth"属性,例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double, u6 K; l$ y4 [# n
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
2 {! s0 }7 V* x* W+ Q - Set AAA = B.AddAttribute(2.5, acAttributeModeMultipleLine, "", P, "mm", "ffff"). [; p/ I9 w# c i
- AAA.MTextBoundaryWidth = 100
6 f: z: w- O) a2 F, } - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 或者- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double" t% ~% ?- ]& H& b, `5 i; ^
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
{1 K1 ]" X3 a% t - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")- i0 ]' u# }$ j6 ?: O. z
- AAA.MTextAttribute = True# O( A; i# x9 V! L1 D1 m b
- AAA.MTextBoundaryWidth = 100
5 Y, v7 i+ h( N, c5 F' O4 l - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 |
|