|
|
发表于 2013-9-24 05:34:18
|
显示全部楼层
来自: 中国吉林长春
本帖最后由 woaishuijia 于 2013-9-24 05:47 编辑
, |' l4 I, X+ B6 W: L8 P; K; _. b& T0 P; S1 N9 p* A8 f; v5 s
用 VBA 的"AddAttribute"方法添加块属性(单行文字)时,宽高比默认为1.可以在添加块属性后,用该属性对象的"ScaleFactor"属性修改宽高比.例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double. ]' m# T# T& D0 J
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
( E' r% y. d% x1 L+ J. t9 G - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")
; m0 n" b; A9 h0 w! i- I6 B - AAA.ScaleFactor = 0.6
1 ~7 e q- ]- g% ~4 _+ M) @ L - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 块属性(多行文字)的边界宽度用属性对象的"MTextBoundaryWidth"属性,例如- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double& c% [; d9 F0 d
- Set B = ThisDrawing.Blocks.Add(P, "MMM")6 D) {$ ?+ ~! a1 s( y5 m3 f# b
- Set AAA = B.AddAttribute(2.5, acAttributeModeMultipleLine, "", P, "mm", "ffff"); F A# b' \ W; S
- AAA.MTextBoundaryWidth = 100
8 T/ B3 M P: Z# L - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 或者- Dim B As AcadBlock, AAA As AcadAttribute, P(2) As Double' n6 f8 S8 f% M1 {& [
- Set B = ThisDrawing.Blocks.Add(P, "MMM")
R9 t" t/ i6 N8 a$ J, A - Set AAA = B.AddAttribute(2.5, acAttributeModeNormal, "", P, "mm", "ffff")9 }! p! ?; B7 j5 a+ Z" x0 X
- AAA.MTextAttribute = True4 L, l/ o o/ @' T3 A+ }4 d3 c& L
- AAA.MTextBoundaryWidth = 100
1 r' ~& Y0 J( D9 M8 r& x9 e - ThisDrawing.ModelSpace.InsertBlock P, "MMM", 1, 1, 1, 0
复制代码 |
|