3 Replies Latest reply on Apr 28, 2014 9:14 PM by Sanya Shmidt

    Change sketch parameter using API

    Sanya Shmidt

      Hello!    

      Can someone point me to a discussion or give an example of code please for changing sketch parameter in vb.net?

      Do I need API sdk installed or not really ? Can I just create a windows form and reference Solidworks?

       

      something similar to one below (which is not working),

       

      Imports SldWorks

      Imports System.Diagnostics

      Imports System

       

       

      Public Class Form1

        

          Dim swApp As SldWorks.SldWorks = CreateObject("SldWorks.Application")

          Dim swModel As SldWorks.ModelDoc2

       

          Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

       

          End Sub

       

          Private Sub btn_apply_Click(sender As Object, e As EventArgs) Handles btn_apply.Click

       

              swModel = swApp.ActiveDoc  ' <-----saying Additional information: Object reference not set to an instance of an object.

       

               swModel.Parameter("BH@Sketch1").SystemValue = 44

       

          End Sub

      End Class