Hello
I created an application in VB.Net that manages the relationship between our ERP and SolidWorks. In particular, she manages the injection of revisions into the ERP SQL database, the creation of PDF, DXF and eDrawings plans and the insertion of links in the database. It also creates JPG views of the parts and assemblies referenced in the ERP and then inserts the link into the database.
I had thought of getting the explorer preview but they are not all correct and even less in ISO orientation. On the other hand, the treatment is long. But we throw it about once a week.
Here's a simplified version of the feature that handles the generation of clips and images:
Sub TraitementCreaDocsSwPrt(ByVal Fichier As String, ByRef SW_Errors As Integer, ByRef SW_Warning As Integer, ByRef SW_Errors_MEP As Integer, ByRef SW_Warning_MEP As Integer)
Dim SW_Model As SldWorks.ModelDoc2, SW_Model_MEP As SldWorks.ModelDoc2
Dim SW_ModelDocExtension As SldWorks.ModelDocExtension
Dim Info_MEP As FileInfo
Try
SW_Model = SW_App.OpenDoc6(Fichier, swDocumentTypes_e.swDocPART, swOpenDocOptions_e.swOpenDocOptions_Silent, "", SW_Errors, SW_Warning)
If SW_Errors = Nothing Then
SW_ModelDocExtension = SW_Model.Extension
SW_ModelDocExtension.HideFeatureManager(True)
SW_Model.ShowNamedView2("*Isométrique", swStandardViews_e.swIsometricView)
SW_Model.ViewZoomtofit2()
SW_Model.SaveAs3(Info_dossier_Export.FullName & "\" & Path.GetFileNameWithoutExtension(Fichier) & ".jpg", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent)
SW_Model.SaveAs3(Info_dossier_Export.FullName & "\" & Path.GetFileNameWithoutExtension(Fichier) & ".eprt", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent)
Info_MEP = New FileInfo(Left(Fichier, Fichier.Length - 7) & ".slddrw")
If Info_MEP.Exists = True Then
SW_Model_MEP = SW_App.OpenDoc6(Info_MEP.FullName, swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", SW_Errors_MEP, SW_Warning_MEP)
SW_Model.SaveAs3(Info_dossier_Export.FullName & "\" & Path.GetFileNameWithoutExtension(Fichier) & ".dxf", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent)
Export_Pdf(SW_App, SW_Model_MEP, Info_dossier_Export.FullName & "\" & Path.GetFileNameWithoutExtension(Fichier) & ".pdf")
Else
' Traitement de l'erreur de présence de la MEP
End If
Else
' Traitement de l'erreur d'ouverture du fichier
End If
If ProcessSW.HasExited = False Then
SW_App.CloseAllDocuments(True)
End If
Catch Ex As Exception
' Traitement de l'erreur
End Try
End Sub
My application is in 64bits. I don't think it's possible to code a 32bit.
I hope I helped you.
Have a nice day