I am using the following code in VB 2008 to output flatsheetmetal parts as dxf files. I would like to do it withoutSolidWorks being visible. Am I missing something?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim stpath As String
Dim Part As SldWorks.ModelDoc2
Dim LongWarnings As Long
Dim boolstatus As Boolean
stpath = "C:\\Test\\"
swApp = CreateObject("sldworks.application")
swApp.UserControl = False
swModel = swApp.OpenDoc6(stpath & "MBC-3.SLDASM", 2, 0,"default", 0, LongWarnings)
swModel.ForceRebuild3(True)
Part = swApp.OpenDoc6(stpath & "MBC-3-RearWall.SLDPRT", 1, 0,"default", 0, LongWarnings)
Part.Extension.SelectByID2("Flat-Pattern1", "BODYFEATURE", 0, 0,0, False, 0, Nothing, 0)
boolstatus = Part.ExportFlatPatternView(stpath & "DXF &PDF\\" & stSize & " - MBC-3-RearWall.DXF", 0)
swApp.QuitDoc("MBC-3-RearWall.SLDPRT")
swApp.QuitDoc("MBC-3.SLDASM")
swApp.QuitDoc("MBC-3-LayoutSketches.SLDPRT")
swApp.CloseAllDocuments(False)
swApp.ExitApp()
Part = Nothing
swModel = Nothing
swApp = Nothing
End SubSolidworksApi macros
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim stpath As String
Dim Part As SldWorks.ModelDoc2
Dim LongWarnings As Long
Dim boolstatus As Boolean
stpath = "C:\\Test\\"
swApp = CreateObject("sldworks.application")
swApp.UserControl = False
swModel = swApp.OpenDoc6(stpath & "MBC-3.SLDASM", 2, 0,"default", 0, LongWarnings)
swModel.ForceRebuild3(True)
Part = swApp.OpenDoc6(stpath & "MBC-3-RearWall.SLDPRT", 1, 0,"default", 0, LongWarnings)
Part.Extension.SelectByID2("Flat-Pattern1", "BODYFEATURE", 0, 0,0, False, 0, Nothing, 0)
boolstatus = Part.ExportFlatPatternView(stpath & "DXF &PDF\\" & stSize & " - MBC-3-RearWall.DXF", 0)
swApp.QuitDoc("MBC-3-RearWall.SLDPRT")
swApp.QuitDoc("MBC-3.SLDASM")
swApp.QuitDoc("MBC-3-LayoutSketches.SLDPRT")
swApp.CloseAllDocuments(False)
swApp.ExitApp()
Part = Nothing
swModel = Nothing
swApp = Nothing
End SubSolidworksApi macros
