AnsweredAssumed Answered

Export .PNG in perspective view

Question asked by None None on Mar 17, 2016
Latest reply on Mar 18, 2016 by None None

Hello fellow solidworkers,

 

I want to export a .PNG file in persepective view when i have checked a checkbox (SetPerspective) I have found the following API command Perspective (IView). When i try to use it, it does not work.

 

I hope somebody can help.

 

Code:

Option Explicit

Option Compare Text

 

 

Dim swApp As SldWorks.SldWorks

Dim Part As ModelDoc2

Dim lErrors As Long

Dim lWarnings As Long

Dim swModel As ModelDoc2

 

 

Sub CreatePNG()

Dim sFilename       As String

 

 

Dim docType As swDocumentTypes_e

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

'If CheckBox1() = False Then 'add command here = False

 

 

sFilename = Part.GetPathName

sFilename = Left(sFilename, Len(sFilename) - 7)

sFilename = sFilename & ".png"

Part.SaveAs2 sFilename, 0, True, False

 

 

End Sub

 

Private Sub ButCreatePNG_Click()

CreatePNG

 

EDIT:  simplified the code, added marco

Attachments

Outcomes