AnsweredAssumed Answered

A Couple Of Debugging Questions In VB.NET

Question asked by Aj Jones on Oct 31, 2012
Latest reply on Oct 31, 2012 by Aj Jones

I'm copying code from a VB Macro I wrote and putting it into using MS VS 2012 Express.  I went through a lot of the macros made by SolidWorks and then once I got certain things to work in .NET, I tried converting the whole code. A lot of the errors I have been able to fix, but a few things I still have questions on, and I was wondering if anyone knew what needs to be fixed.


The two things I have imported into the project are:

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst


--- For one thing, anything with   swApp = Application.SldWorks   seemed to error out.  From the looks of it, and looking at other VB.NET code this is not needed in VB.NET correct?


---  When selecting a plane the "swThisConfiguration, Empty" part gets an error stating it is not declared and that it may be inaccessible due to its protection level.


boolstatus = swModelDocExt.SelectByID2("FrontPlane@" & PartName, "PLANE", 0, 0, 0, False, 0, Nothing, swSelectOptionDefault)

swDim = swModel.Parameter("D1@CL OF FRONT OR@" & PartName & ".SLDASM")

dimValue = swDim.GetSystemValue3(swThisConfiguration, Empty)


--- When checking that the document is an assembly I get an error for the <> part of the document "Overload resolution failed because no accessible '<>' can be called within these arguments

If Model.GetType <> swDocASSEMBLY Then


Also getting errors for anything ending with "Empty" saying System.Empty is not accessible in this context because it is 'Friend'.

Part.Extension.RunCommand(swCommands_SaveAs, Empty)