以下程序只对于那些边界还关联着的填充图案有效。如果删除边界后还需要取得边界,则需要使用LISP的方法。- Sub HatchBound()
- Dim Ent As AcadEntity
- Dim Pnt As Variant
- Dim Hat As AcadHatch
- Dim LoopNum As Integer
- Dim i As Integer
- Dim LoopObjs As Variant
- Dim j As Integer
- 'On Error Resume Next
- Do
- ThisDrawing.Utility.GetEntity Ent, Pnt, vbCr & "选择填充图案:"
- If Err.Number <> 0 Then Exit Sub
- If Ent.ObjectName = "AcDbHatch" Then Exit Do
- Loop
- Set Hat = Ent
- LoopNum = Hat.NumberOfLoops
- For i = 0 To LoopNum - 1
- Debug.Print "第" & i & "个环的对象:"
- Hat.GetLoopAt i, LoopObjs
- For j = 0 To UBound(LoopObjs)
- Debug.Print LoopObjs(j).ObjectName
- Next j
- Next i
- End Sub
|