|
下面是代码:
-----------------------------------
'使用点数组创建轻量多段线(number为数组的元素个数)
Public Function AddLPline(ByRef pt() As Double, ByVal number As Integer) As AcadLWPolyline
On Error GoTo errHandle
If number Mod 2 0 Then
MsgBox "数组元素个数必须为偶数!"
End If
Set AddLPline = ThisDrawing.ModelSpace.AddLightWeightPolyline(pt)
Exit Function
errHandle:
MsgBox "数组元素个数与参数不符!"
MsgBox Err.Description
End Function
'“主函数”
Sub AddPolyline()
Dim pt(0 To 5) As Double
pt(0) = 0: pt(1) = 0
pt(2) = 30: pt(3) = 30
pt(4) = 30: pt(5) = 100
AddLPline pt, 6
End Sub |
|