|
|
发表于 2008-9-23 18:00:07
|
显示全部楼层
来自: 中国
Sub A(); X4 V- J" O ]* n
Dim B As AcadBlock, I As Integer, P(2) As Double; J. y- O$ D6 a0 V9 w8 G) m
With ThisDrawing/ j8 z6 G4 h7 b( W9 T# M* Y
For Each B In .Blocks '遍历文档中的块集合,通过块名称查找指定的块
" V4 ?$ g/ B8 T0 C( f If B.Name = 块名称字符串 Then '找到指定的块
" b9 [ [ r3 _ For I = 0 To B.Count - 1 '遍历块元素; L9 K5 Z1 A- U7 F" E
If B.Item(I).ObjectName = "AcDbEllipse" Then Exit For '找到椭圆后退出循环: H8 C' A/ D; ?; a
Next
7 H- @* i& s5 s( e: L$ k .ModelSpace.InsertBlock P, 块名称字符串, 1, 1, 1, -.Utility.AngleFromXAxis(B.Item(I).Center, B.Item(I).StartPoint)
+ x; x5 A/ e" C- ?8 } '根据椭圆中心点和起点,用AngleFromXAxis方法获取椭圆旋转角,并用其负值做为插入块时的旋转角(反向转回来)
& }8 `# Q) E; Y! N; |8 E; D9 R: u Exit For) q P/ J) U# m9 r7 o( I3 H
End If5 l& U; L( ~+ \; i2 Q0 z7 p, E1 ~6 u
Next
- y7 C3 [9 g: l End With
9 C% o5 i/ ?* h+ M( Z9 E) c/ \End Sub |
|