'添加块定义
* T7 Y- w2 W- \Dim blkDef As AcadBlock
2 \7 ^2 j- ~$ r- C9 W C; nSet blkDef = ThisDrawing.Blocks.Add(BasePoint, "*U")4 L( a3 @& |& b- S: ^8 t- }2 k. W. i
'向块中增加多段线
9 }: O9 _' d- J3 }+ ^) m R. UDim LineObject As AcadLWPolyline
/ _9 e( U) N, S8 }Set LineObject = blkDef.AddLightWeightPolyline(LineVerts) '画多段线
7 `5 J ?% a6 T$ Q# i" c8 A'增加10dB/10m属性
5 v, B! \9 _. }1 K \. h4 _Dim attributeObj As AcadAttribute
# u' N" F E7 f+ p1 j- F1 `+ SDim DbBasePoint(0 To 2) As Double i$ K( U, ]% r' A
DbBasePoint(0) = LineTextPoint(0): DbBasePoint(1) = LineTextPoint(1): DbBasePoint(2) = 0# p1 G, @0 d+ U9 Z2 e+ [7 N9 q
DbRoation = LineTextPoint(2)( ?( ?) K7 P2 l) ]& t
Set attributeObj = blkDef.AddAttribute(ThisDrawing.ActiveTextStyle.Height, acAttributeModeNormal, "插入馈线损耗", DbBasePoint, "馈线损耗", LineDb)% q' }; B/ g. U) K" n; Y, l
attributeObj.alignment = acAlignmentBottomCenter '底部中心点5 ^0 }+ G! [" k/ [8 C
attributeObj.TextAlignmentPoint = DbBasePoint '重定义对齐点
: ^4 r% A/ n# k0 H+ \! ]$ X3 z7 k3 r6 Z4 J5 |1 x0 t& w
运行该程序后,插入该块,块的属性,应该距离线40mm,但却离开的很远。4 @5 v7 m/ D/ e( S# l6 U5 s: [& y
但插入一个,在autocad界面拉动块的属性后,就正常了,思考了变天,不知道咋回事,
7 x$ {4 v+ h, O7 M大侠,帮忙啊 |