'添加块定义
& d2 e4 N! y1 G+ U- e7 B& q bDim blkDef As AcadBlock+ w& G. J/ y, D. ?% V
Set blkDef = ThisDrawing.Blocks.Add(BasePoint, "*U")
n" I* }/ ?+ C6 v, j3 ?; E'向块中增加多段线
+ P: f( R& A! L. G% }+ l% uDim LineObject As AcadLWPolyline
2 T8 s: n9 J1 f! i; nSet LineObject = blkDef.AddLightWeightPolyline(LineVerts) '画多段线( X# l2 E. c1 d6 u/ b
'增加10dB/10m属性
; m3 _1 O* y8 L9 `Dim attributeObj As AcadAttribute+ K9 h# S) K M
Dim DbBasePoint(0 To 2) As Double
8 g. w0 @% ^( x+ a7 ZDbBasePoint(0) = LineTextPoint(0): DbBasePoint(1) = LineTextPoint(1): DbBasePoint(2) = 0
V* d1 i3 `8 |% C# p% pDbRoation = LineTextPoint(2)
/ Y. D* t$ Z5 C& a( k7 gSet attributeObj = blkDef.AddAttribute(ThisDrawing.ActiveTextStyle.Height, acAttributeModeNormal, "插入馈线损耗", DbBasePoint, "馈线损耗", LineDb); J3 O! l( y& w$ ^0 G7 b8 x
attributeObj.alignment = acAlignmentBottomCenter '底部中心点
7 [: d8 P5 B# r& d% G1 PattributeObj.TextAlignmentPoint = DbBasePoint '重定义对齐点8 I$ F) y6 ~( K" y
8 ]# L9 C$ m* ^' {8 |# J
运行该程序后,插入该块,块的属性,应该距离线40mm,但却离开的很远。% k. k/ W3 R, w; e" Z
但插入一个,在autocad界面拉动块的属性后,就正常了,思考了变天,不知道咋回事, D3 j" }- |+ @. N% J2 |+ T1 _" D
大侠,帮忙啊 |