'TlsBoundary类,专用于在块内按点生成填充
'编制:天龙工作室 ' You may use the code included in this module in any way,
' provided that both the above copyright notice and the
' release of liability (stated below) appear in all copies.
Private pSouce As Object
Private pBlock As AcadBlock
Private pWorkSpace As AcadObject
Private pRegions As Variant
Private OuterLoop As AcadRegion
Private InnerLoop As AcadRegionPrivate Sub Class_Terminate()
On Error Resume Next
pWorkSpace.Delete
End SubPrivate Function IsEqual(ByVal Value1 As Double, ByVal Value2 As Double) As Boolean IsEqual = Abs(Value1 - Value2) "AcDbLine" And _
i.ObjectName "AcDbCircle" And _
i.ObjectName "AcDbArc" And _
i.ObjectName "AcDbEllipse" _
Then
i.Explode
Err.Clear
i.Delete
pCanBeExploded = True
End If
Next i
Loop
End SubPrivate Sub SortValue(ByRef Values As Variant, ByVal Count As Integer)
'值排序
Dim pTemp As Double
For i = Count To 1 Step -1
For j = 0 To i - 1
If Values(j) > Values(j + 1) Then
pTemp = Values(j + 1)
Values(j + 1) = Values(j)
Values(j) = pTemp
End If
Next j
Next i
End SubPrivate Sub SortPoint(ByRef Values As Variant, ByRef Points As Variant, ByVal Count As Integer)
'按值将点数组排序
Dim pTemp As Double, pnt As Variant
For i = Count To 1 Step -1
For j = 0 To i - 1
If Values(j) > Values(j + 1) Then
pTemp = Values(j + 1)
Values(j + 1) = Values(j)
Values(j) = pTemp
pnt = Points(j + 1)
Points(j + 1) = Points(j)
Points(j) = pnt
End If
Next j
Next i
End SubPrivate Function GetIntersection(ByVal TlsObject As AcadEntity, Optional ByVal Count)
'获取图元的全部交点
Dim pnts(), dot
Dim pnt(2) As Double
Dim n As Integer
Dim i, j
Dim pNum As Integer
If IsMissing(Count) Then Count = pSouce.Count
For i = 0 To Count - 1
If Not (TlsObject Is pSouce(i)) Then
dot = TlsObject.IntersectWith(pSouce(i), acExtendNone)
n = (UBound(dot) + 1) / 3
For j = 0 To n - 1
pnt(0) = dot(j * 3)
pnt(1) = dot(j * 3 + 1)
ReDim Preserve pnts(pNum)
pnts(pNum) = pnt
pNum = pNum + 1
Next j
End If
Next i
If pNum = 0 Then
GetIntersection = False
ElseIf pNum = 1 Then
If TlsObject.ObjectName = "AcDbLine" Then
GetIntersection = pnts
ElseIf TlsObject.ObjectName = "AcDbCircle" Then
GetIntersection = False
ElseIf Abs(TlsObject.EndAngle - TlsObject.StartAngle - Atn(1) * 8) > 10 ^ -8 Then
GetIntersection = False
Else
GetIntersection = pnts
End If
Else
GetIntersection = pnts
End If
End Function
Private Function BreakLineAtPoint(ByVal TlsLine As AcadEntity, ByVal Points)
'按点打断直线
Dim pStart, PEnd
Dim pNum As Integer