Hi all, I'm trying to made a Vb.net code that should import an model and update some equation dimensions.
This is the first time i'm using VS with SW api. So i really can't understand what I'm doing wrong .
I have added "SldWorks.dll" and "SwConst.dll" to the project references, then i added the code :
Imports SolidWorks.Interop.sldworks Imports SolidWorks.Interop.swconst
(here i also tried with "Imports SldWorks instead SolidWorks, but nothing)
VS is getting and warning saying me that the imports are unnecessary, so i tryied to continue by starting Solidworks and open a part with this code :
Function ModelParts() Dim Part As SldWorks.IModelDoc2 Dim swEquationMgr As SldWorks.EquationMgr Dim Options As Integer Dim Errors As Integer Dim Warnings As Integer Dim longEquation As Long Dim boolstatus As Boolean = False Dim longstatus As Integer = 0 Dim longwarning As Integer = 0 Dim app As String = "" SwApp = CreateObject("SldWorks.Application") SwApp = New SldWorks.SldWorks() Part = SwApp.OpenDoc6(WorkPath & "\test.sldprt", 1, 0, "", longstatus, longwarning) swEquationMgr = Part.GetEquationMgr If swEquationMgr Is Nothing Then ErrorMsg(SwApp, "Failed to get the equation manager of file " & "test.sldprt") STOP longEquation = swEquationMgr.SetEquationAndConfigurationOption(0, """A""=1000", SwConst.swInConfigurationOpts_e.swAllConfiguration, Nothing) swEquationMgr.EvaluateAll() Part.EditRebuild3() boolstatus = Part.Save3(Options, Errors, Warnings) If longEquation <> 1 Then ErrorMsg(SwApp, "Failed to modify the dimension " & "A") SwApp.ExitApp SwApp = Nothing Return 1 End Function
When i reach program break at "Stop", i still don't have Solidworks opened, but if i check on Task manager, I can see it running on processes list.
Can someone help please, I really can't uderstand what's the problem. For now seems a problem with the references.
If need more info : I'm using Solidworks 2016 - Visual Studio 2010 (Net Framework 4.5.2).