16 Replies Latest reply on May 28, 2018 8:35 AM by Ananth Balasubramanian

    Selecting  the "front plane" in solidworks api

    Ananth Balasubramanian

      Guys I've been trying to select the "front plane" and draw a  sketch on it. When I execute the file,  the code gives me an error saying " object not set to reference".But its already declared as a boolean. Why is it still showing it as " not set to a reference"

       

      Can you please help ?

      Thanks a lot

       

       

       

      public Class Rectangleform

          Dim swapp As New SldWorks

          Dim swmodel As IModelDoc2

       

       

          Dim plane As IModelDocExtension

          Dim sketch As ISketchManager

       

       

       

       

       

       

       

       

       

       

          Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

              swapp.Visible = True

              swapp.NewPart()

              swapp.IActiveDoc.Visible = True

       

       

              Selectfrontplane()

              sketch.InsertSketch(True)

       

       

       

       

          End Sub

       

       

          Public Function Selectfrontplane() As Boolean

              Dim Name As String = "Front Plane"

              Dim Type As String = "PLANE"

              Dim X As Double = 0

              Dim Y As Double = 0

              Dim Z As Double = 0

              Dim Append As Boolean = False

              Dim Mark As Integer = 0

              Dim Callout As Callout = Nothing

              Dim SelectOption As Integer = 0

              Dim value As Boolean = True

       

       

              value = plane.SelectByID2(Name, Type, X, Y, Z, False, 0, Callout, SelectOption)

       

       

              Return value

          End Function

       

       

      End Class