Hello
I have an assembly with 50 configurations, and I want to have an image of each configuration.
For this I created a macro that gives me:
______________________________________________________________________________________________
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim I As Integer
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
boolstatus = Part.Extension.SelectByID2("1@Assemblage1.SLDASM", "CONFIGURATIONS", 0, 0, 0, False, 0, Nothing, 0)
For I = 1 To 50
boolstatus = Part.ShowConfiguration2(I)
boolstatus = Part.ForceRebuild3(True)
longstatus = Part.SaveAs3("C:\Users\michel2\Desktop\Macro\I.JPG", 0, 0)
Next I
End Sub
________________________________________________________________________________________________________
I created a loop with "For I = 1 to 50" and "Next I" with my steps in the middle:
Line 1 : Choosing the configuration
Line 2: Rebuild
line 3: save as JPG in the specified path
The problem I have when I launch my macro is that I can see my configurations scroll by, but in the end I only have an image of the last saved configuration (named I.JPG), The I does not increment in the file name (line 3) and so with each new save the I.JPG file is deleted and replaced by the new one.
Is there a way to automatically increment the file name? If anyone has an example of a macro...
Thank you in advance for your help.