API: opening a part with SW Viewer
API: opening a part with SW Viewer
(OP)
The following code fails to open a part in SW Viewer. It opens the Viewer, but the OpenDoc6 method doesn't seem to work. Any ideas? Thanks.
========
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim part As ModelDoc2
Dim longstatus As Long, longwarnings As Long
Sub main()
'Set swApp = Application.SldWorks
'Set part = swApp.ActiveDoc
Set swApp = CreateObject("SWViewer.Application")
swApp.Visible = True
'Set retval = swApp.opendoc6(vFile, iType, 2, "", SWerror, SWwarning)
Set part = swApp.opendoc6("C:\1Keith\1types\2009\Assembly.SLDASM", 1, 0, "", longstatus, longwarnings)
End Sub
========
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim part As ModelDoc2
Dim longstatus As Long, longwarnings As Long
Sub main()
'Set swApp = Application.SldWorks
'Set part = swApp.ActiveDoc
Set swApp = CreateObject("SWViewer.Application")
swApp.Visible = True
'Set retval = swApp.opendoc6(vFile, iType, 2, "", SWerror, SWwarning)
Set part = swApp.opendoc6("C:\1Keith\1types\2009\Assembly.SLDASM", 1, 0, "", longstatus, longwarnings)
End Sub






RE: API: opening a part with SW Viewer
It is not part of SolidWorks.
You cannot automate the SolidWorks viewer using SolidWorks API.
-handleman, CSWP (The new, easy test)
RE: API: opening a part with SW Viewer
Another possibility might be to have the program change the default application, call ShellExecute, then change the default back to what it was.
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: API: opening a part with SW Viewer
-handleman, CSWP (The new, easy test)
RE: API: opening a part with SW Viewer
I had heard that OpenDoc6 worked in SW Viewer in SW 2008 but perhaps I was mistaken.
RE: API: opening a part with SW Viewer