AnsweredAssumed Answered

Select Normal

Question asked by alia sfaxya on Oct 31, 2018
Latest reply on Nov 2, 2018 by Artem Taturevych

Good morning, i 'm trying to determine the normal of part in solidworks using this algorithm in vb.net :

swModel = swApp.ActiveDoc

        swAssy = swModel

        swModel.ClearSelection2(True)

        swDocExt = swModel.Extension()

        boo = swDocExt.SelectByID2("part@assembly", "COMPONENT", 0, 0, 0, True, 1, Nothing, 0)

 

 

  Dim vNorm As Object

swModel = swApp.ActiveDoc

    swSelMgr = swModel.SelectionManager

    swFace = swSelMgr.GetSelectedObject6(1, 0)

        vNorm = swFace.Normal

        Debug.Print("Normal = (" & vNorm(0) & ", " & vNorm(1) & ", " & vNorm(2) & ")")

 

but, i got an error in red line : Object reference not set to an instance of an object.

Outcomes