-
Re: Export .PNG in perspective view
Artem Taturevych Mar 17, 2016 5:06 PM (in response to None None)I think you need to use this method: 2015 SOLIDWORKS API Help - AddPerspective Method (IModelView)
Part.ActiveView.AddPerspective
-
Re: Export .PNG in perspective view
None None Mar 18, 2016 4:21 AM (in response to Artem Taturevych)Thank you for the input, but I still can't get the code to work.
I have added the macro, cloud you give It a look?
Thanks in advance.
-
Re: Export .PNG in perspective view
Deepak Gupta Mar 18, 2016 4:42 AM (in response to None None)Does this help. Just added the perspective to the sub.
Sub CreatePNG()
Dim sFilename As String
Dim docType As swDocumentTypes_e
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
sFilename = Part.GetPathName
sFilename = Left(sFilename, Len(sFilename) - 7)
sFilename = sFilename & ".png"
'If CheckBox1() = False Then 'add command here = False
If Part.ActiveView.HasPerspective = True Then 'Check Perspective
Part.SaveAs2 sFilename, 0, True, False
Else
Part.ActiveView.AddPerspective
Part.SaveAs2 sFilename, 0, True, False
End If
End Sub
-
Re: Export .PNG in perspective view
None None Mar 18, 2016 5:29 AM (in response to Deepak Gupta)Thanks Deepak, just what I needed. I modified the code to this:
If CheckBox1 = True Then
Part.ActiveView.RemovePerspective
sFilename = Part.GetPathName
sFilename = Left(sFilename, Len(sFilename) - 7)
sFilename = sFilename & ".png"
Part.SaveAs2 sFilename, 0, True, False
Else
Part.ActiveView.AddPerspective
sFilename = Part.GetPathName
sFilename = Left(sFilename, Len(sFilename) - 7)
sFilename = sFilename & ".png"
Part.SaveAs2 sFilename, 0, True, False
End If
-
-
-