[VBA/VB/C#]efan2000 13:29:21
Sub testHatch()
Dim vl(0 To 7) As Double
vl(2) = 20
vl(4) = 20
vl(5) = 10
vl(7) = 10
Dim lwp As AcadLWPolyline
Set lwp = ThisDrawing.ModelSpace.AddLightWeightPolyline(vl)
lwp.Closed = True
Dim h As AcadHatch
Set h = ThisDrawing.ModelSpace.AddHatch(0, "SOLID", True)
Dim e(0 To 0) As AcadEntity
Set e(0) = lwp
h.AppendOuterLoop e
h.Evaluate
lwp.Delete
Dim mh As mcArxProject1Lib.Hatch
Set mh = New mcArxProject1Lib.Hatch
Debug.Print "numLoops: " & mh.numLoops(h)
Debug.Print "loopTypeAt: " & mh.loopTypeAt(h, 0)
Dim v As Variant
Dim b As Variant
mh.GetLoopAt h, 0, mh.loopTypeAt(h, 0), v, b
Dim s As String
Dim i As Integer
If VarType(v) = (vbArray Or vbDouble) Then
s = s & vbCrLf & vbTab & i & ": "
For i = 0 To UBound(v)
If i UBound(v) Then
s = s & v(i) & ", "
Else
s = s & v(i)
End If
Next
Else
Dim ss() As String
ReDim ss(UBound(v))
Dim j As Integer
For i = 0 To UBound(v)
s = s & vbCrLf & vbTab & i & ": "
For j = 0 To UBound(v(i))
If j UBound(v(i)) Then
ss(i) = ss(i) & v(i)(j) & ", "
Else
ss(i) = ss(i) & v(i)(j)
End If
Next
s = s & ss(i)
Next
End If
Debug.Print "getLoopAt: " & s
End Sub
numLoops: 1
loopTypeAt: 1
getLoopAt:
0: 0, 0, 20, 0
1: 20, 0, 20, 10
2: 20, 10, 0, 10
3: 0, 10, 0, 0
光辉岁月 13:30:46
? |