You're getting an error because you aren't using the required arguments with ICurve::GetLength.
Anyway, ICurve::GetLength is obsolete, like Deepak said. You should use ICurve::GetLength2 if you want the base curve and ICurve::GetLength3 if you want the trimmed curve. So you might try out each one and see which one gives you the result you need. See the API Help remarks for GetLength3 to learn more.
Here's how to get the length of a selected edge using ICurve::GetLength3. The length is printed in the immediate window.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swEdge As SldWorks.Edge
Dim swCurve As SldWorks.Curve
Dim swCurveParams As SldWorks.CurveParamData
Dim dblLength As Double
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
For i = 1 To swSelMgr.GetSelectedObjectCount2(-1)
If swSelMgr.GetSelectedObjectType3(i, -1) = 1 Then
Set swEdge = swSelMgr.GetSelectedObject6(i, -1)
Set swCurve = swEdge.GetCurve
Set swCurveParams = swEdge.GetCurveParams3
dblLength = swCurve.GetLength3(swCurveParams.UMinValue, swCurveParams.UMaxValue)
dblLength = Round(dblLength, 4)
Debug.Print " Length = " & dblLength * 1000 & "mm"; g
Hi...Thank you so much..kieth.. your macro is working fine....
I would like to know about the solid work object type as i am not aware about it..is there any document or link for that?
and also please help for how to improve API knowledge...