Preview | SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BCBarry Cavanaugh29/09/2008
Hello,
using the Document manager API I have successfully created a vb.net console app that extracts the PNG preview using the GetPreviewPNGBitmap() method.
but...
when I use this same method in a asp.net app, I get the following when I call the method:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
I see the warnings in the API help documentation saying that this function may not work with ASP.NET, and sure enough I can't get it to work.
has anyone run up against this problem? Any suggestions?
thanks in advance....code below:
Dim sDocFileName As String = "C:\Documents and Settings\bcavan\My Documents\Visual Studio 2008\WebSites\WebSite1\Upload\Extraction\037-001-876.sldprt"
Dim sExtractDir As String = "C:\Documents and Settings\bcavan\My Documents\Visual Studio 2008\WebSites\WebSite1\Upload\Extraction"
Dim swClassFact As SwDMClassFactory
Dim swDocMgr As SwDMApplication
Dim swDoc As SwDMDocument10
Dim swCfgMgr As SwDMConfigurationMgr
Dim vCfgNameArr As Object
Dim vCfgName As Object
Dim swCfg As SwDMConfiguration7
Dim pPreview As IPictureDisp
Dim pPreview2 As IPictureDisp
Dim nDocType As Long
Dim nRetVal As Long
Dim i As Long
Dim bRet As Boolean
nDocType = SwDmDocumentType.swDmDocumentPart
swClassFact = CreateObject("SwDocumentMgr.SwDMClassFactory")
swDocMgr = swClassFact.GetApplication("my code")
swDoc = swDocMgr.GetDocument(sDocFileName, nDocType, False, nRetVal)
swDoc = CType(swDoc, SwDMDocument10)
pPreview2 = swDoc.GetPreviewPNGBitmap(nRetVal) ' ERROR OCCURS HERE
Dim myImage2 As Image = IPictureToImage(pPreview2)
Dim myFilename = Path.GetFileNameWithoutExtension(swDoc.FullName)
myImage2.Save(sExtractDir & "\" & myFilename & ".PNG")
using the Document manager API I have successfully created a vb.net console app that extracts the PNG preview using the GetPreviewPNGBitmap() method.
but...
when I use this same method in a asp.net app, I get the following when I call the method:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
I see the warnings in the API help documentation saying that this function may not work with ASP.NET, and sure enough I can't get it to work.
has anyone run up against this problem? Any suggestions?
thanks in advance....code below:
Dim sDocFileName As String = "C:\Documents and Settings\bcavan\My Documents\Visual Studio 2008\WebSites\WebSite1\Upload\Extraction\037-001-876.sldprt"
Dim sExtractDir As String = "C:\Documents and Settings\bcavan\My Documents\Visual Studio 2008\WebSites\WebSite1\Upload\Extraction"
Dim swClassFact As SwDMClassFactory
Dim swDocMgr As SwDMApplication
Dim swDoc As SwDMDocument10
Dim swCfgMgr As SwDMConfigurationMgr
Dim vCfgNameArr As Object
Dim vCfgName As Object
Dim swCfg As SwDMConfiguration7
Dim pPreview As IPictureDisp
Dim pPreview2 As IPictureDisp
Dim nDocType As Long
Dim nRetVal As Long
Dim i As Long
Dim bRet As Boolean
nDocType = SwDmDocumentType.swDmDocumentPart
swClassFact = CreateObject("SwDocumentMgr.SwDMClassFactory")
swDocMgr = swClassFact.GetApplication("my code")
swDoc = swDocMgr.GetDocument(sDocFileName, nDocType, False, nRetVal)
swDoc = CType(swDoc, SwDMDocument10)
pPreview2 = swDoc.GetPreviewPNGBitmap(nRetVal) ' ERROR OCCURS HERE
Dim myImage2 As Image = IPictureToImage(pPreview2)
Dim myFilename = Path.GetFileNameWithoutExtension(swDoc.FullName)
myImage2.Save(sExtractDir & "\" & myFilename & ".PNG")