2 Replies Latest reply on Jan 15, 2016 6:56 AM by Vincent Pomerleau

    What's wrong in this

    Vincent Pomerleau


      I'm not really good at vb, do anyone see the problem in this:

      Sub main()



          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swSelMgr As SldWorks.SelectionMgr

          Dim swFeat As SldWorks.Feature

          Dim cwDoc As camworkslib.cwDoc

          Dim cwSelMgr As camworkslib.CWSelectionMgr

          Dim millOperation As camworkslib.CWMillOperation

          Dim setupselected As Object

          Dim setup As Object

          Dim mirrorAxis As Object

          Dim axisbl As Boolean


              Set swApp = Application.SldWorks

              Set swModel = swApp.ActiveDoc

              Set swSelMgr = swModel.SelectionManager

              Set cw = New camworkslib.CWApp

              Set cwDoc = cw.IGetActiveDoc


              'Method to get the selected setup


              Set cwSelMgr = cwDoc.IGetSelectionMgr

              Set setupselected = cwSelMgr.GetSelectionsOfType(7, 1)

              If setupselected Is Nothing Then

                  MsgBox "Please select a setup"

              End If


              'Mirror selected operations


              Set setup = setupselected.Item(0)

              Set Operations = setup.IGetEnumOperations


                  For k = 0 To Operations.Count - 1

                      Set currentOp = Operations.Item(k)

                      axisbl = swModel.Extension.SelectByID2("MIRROR", "AXIS", 0, 0, 0, False, 0, Nothing, 0)

                      Set mirrorAxis = swSelMgr.GetSelectedObject(1)

                      Call millOperation.SetMirrorToolpath(True, False, mirrorAxis, True, False, 0, 0)

                  Next k


          End Sub


      Camworks is an addin that also have the API

      When I call millOperation.SetMirrorToolpath , the error say that my object (mirroraxis) is empty