'添加块定义. C' Z# z. a8 f7 X$ n, [
Dim blkDef As AcadBlock! I1 i; T) J( m# a
Set blkDef = ThisDrawing.Blocks.Add(BasePoint, "*U")
8 T" h1 F' Z3 }+ }4 X4 `'向块中增加多段线
$ C1 ]$ @3 B4 g" E; iDim LineObject As AcadLWPolyline
% m3 ?2 ^" U! j* ~1 L8 {Set LineObject = blkDef.AddLightWeightPolyline(LineVerts) '画多段线% u; b) g% G. [9 N$ H) v
'增加10dB/10m属性
5 U5 h" ]# B9 Z! ^4 t% S4 W# uDim attributeObj As AcadAttribute
( Q/ V, D; q5 K( k, P& y: G: {Dim DbBasePoint(0 To 2) As Double
" T9 H6 T- K$ t; f: P TDbBasePoint(0) = LineTextPoint(0): DbBasePoint(1) = LineTextPoint(1): DbBasePoint(2) = 0
% X0 ]/ T% t5 z3 D. K: n$ RDbRoation = LineTextPoint(2)* u) t A( H% B: i" \. K: J5 m
Set attributeObj = blkDef.AddAttribute(ThisDrawing.ActiveTextStyle.Height, acAttributeModeNormal, "插入馈线损耗", DbBasePoint, "馈线损耗", LineDb)) A" }# G) X' u$ ]
attributeObj.alignment = acAlignmentBottomCenter '底部中心点
4 G+ _4 w3 R$ mattributeObj.TextAlignmentPoint = DbBasePoint '重定义对齐点
# R7 {6 j( U1 @- H, X# T
2 G3 _; I; l V( R$ `运行该程序后,插入该块,块的属性,应该距离线40mm,但却离开的很远。
! K( N2 p" d6 G但插入一个,在autocad界面拉动块的属性后,就正常了,思考了变天,不知道咋回事,8 Z4 e+ B' B% C8 V! V
大侠,帮忙啊 |