AnsweredAssumed Answered

VB to save using current model name

Question asked by Josh Pickard on Oct 5, 2019
Latest reply on Oct 7, 2019 by Josh Pickard

I recorded a macro that moved the view to isometric and saved the result as pdf.  I need an image of every assembly I have in isometric view. The problem is that the macro saves every part the same way.  So it overwrites the last run model. How do I get vb to use the name of the currently open model? Then I can use the task scheduler to run the macro on every model in my directory. Here is the macro as it currently is.

 

Dim swApp As Object

 

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

 

Sub main()

 

Set swApp = Application.SldWorks

 

Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized

 

' Named View
Part.ShowNamedView2 "*Isometric", 7
Part.ViewZoomtofit2

 

' Save As
longstatus = Part.SaveAs3("M:\QUALITY\isoViews\18737.PDF", 0, 0)
End Sub

 

====================================================

Thanks in advance for any help I get. I really appreciate this.

Outcomes