'添加块定义7 F0 v# Q" E, N
Dim blkDef As AcadBlock1 k# e& g8 L% H* r) f
Set blkDef = ThisDrawing.Blocks.Add(BasePoint, "*U")
z# D: v( p t6 V'向块中增加多段线
8 H/ q! s X" L; }4 `. C' Q9 U( zDim LineObject As AcadLWPolyline
# J0 ^1 B8 n# B a1 l2 sSet LineObject = blkDef.AddLightWeightPolyline(LineVerts) '画多段线
* u, {9 b$ K* y! m'增加10dB/10m属性4 ?; J: h: x% @3 ~
Dim attributeObj As AcadAttribute& ~ _" k& i" {' m. C
Dim DbBasePoint(0 To 2) As Double) S. p N% m+ ~% {: ^
DbBasePoint(0) = LineTextPoint(0): DbBasePoint(1) = LineTextPoint(1): DbBasePoint(2) = 0
3 C% Y2 I+ Q: _" k$ q( Z& F/ ODbRoation = LineTextPoint(2)3 M' z$ j, j. } v& V X& c$ h
Set attributeObj = blkDef.AddAttribute(ThisDrawing.ActiveTextStyle.Height, acAttributeModeNormal, "插入馈线损耗", DbBasePoint, "馈线损耗", LineDb)
5 C6 e. u6 R: y/ u& U* _attributeObj.alignment = acAlignmentBottomCenter '底部中心点4 S2 K- u/ [% {. ~- N* g
attributeObj.TextAlignmentPoint = DbBasePoint '重定义对齐点. B- I1 W. H2 ?$ n8 k2 {
/ n6 D3 m E( q \! ?: Z+ O
运行该程序后,插入该块,块的属性,应该距离线40mm,但却离开的很远。% }. y6 v1 x! w9 f# s5 D) C
但插入一个,在autocad界面拉动块的属性后,就正常了,思考了变天,不知道咋回事,9 H- c4 H( X5 `1 C, P
大侠,帮忙啊 |