|
Public Function CurveLength(ByVal ID As ObjectId, ByRef Len As Double) As Boolean
CurveLength = True
Dim DB As Database = HostApplicationServices.WorkingDatabase
Using Trans As Transaction = DB.TransactionManager.StartTransaction
Try
Dim Ent As Entity = Trans.GetObject(ID, OpenMode.ForRead)
Dim Cur As Curve = Ent '此处如果不是线,会出错,用了TRY了,为什么不能跳到CATCH 处执行
Len = Cur.GetDistanceAtParameter(Cur.EndParam)
Catch ex As Exception
CurveLength = False
MsgBox("不正常")
End Try
End Using
End Function
Dim Cur As Curve = Ent '此处如果不是线,会出错,用了TRY了,为什么不能跳到CATCH 处执行
|
|