AnsweredAssumed Answered

how can i get the midpoint of singer SketchSegment

Question asked by Lenny Yang on Jan 6, 2019
Latest reply on Jan 6, 2019 by Lenny Yang

Hi All ,

How can i get the midpoint of a sketchsegment.

I just want to get coordinate of the midpoint ,no need select it.

 

I have try this code ,but it teturn a  wrong result to me.

 

here is the code===========================================

 

Function GetSketchSegMidPoint(SketchSeg As SketchSegment) As Object

 

        Dim swCurve As Curve = SketchSeg.GetCurve

        Dim Edgearr As Object

        Dim nStartParam As Single

        Dim nEndParam As Single

        Dim bIsClosed As Boolean

        Dim bIsPeriodic As Boolean

        Dim vMidPt As Object

        Dim bRet As Boolean

        bRet = swCurve.GetEndParams(nStartParam, nEndParam, bIsClosed, bIsPeriodic)

        dblMidParam = (nStartParam + nEndParam) / 2

        vMidPt  = swCurve.Evaluate(dblMidParam)

        TempPoint(0) = vMidPt(0)

        TempPoint(1) = vMidPt(1)

        TempPoint(2) = vMidPt(2)

        Return TempPoint

 

    End Function

 

here is the code===========================================

Outcomes