用上面两个 Option Explicit Sub GetSplineMidPt() Dim Cv As Curve Dim objEnt As AcadEntity Dim pickedPnt As Variant Dim MidPnt As Variant On Error Resume Next Retry: ThisDrawing.Utility.GetEntity objEnt, pickedPnt, "Select a Spline:" If Err <> 0 Then Err.Clear MsgBox "You missed it." Else Set Cv = New Curve Set Cv.Entity = objEnt MidPnt = Cv.GetPointAtDistance(Cv.length / 2#) MsgBox "中点坐标 : " & MidPnt(0) & " , " & MidPnt(1) & " , " & MidPnt(2), , "Curve.cls Example" Exit Sub End If GoTo Retry End Sub |