im trying to make an macro that is going to save me some time
first of all im trying to find the name of the view that is blue in the picture
i have made a custom view of that point that i called "bottom left "
but i want the original name of that view point
so i can use this macro in every pc that we run solidwork on
so my first question is what is the name of that point ?
my second problem that im having is that
i want to save the jpg`s with their respected custom names (isometric1 , bottomleft1)
and it wil only save 1 view at this moment as it override`s the isometric view
Can someone point out what i did wrong here
its been a long time since i done macro`s so im a bit rusty
Dim swApp As Object
Dim Part As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim FilePath As String
Dim PathSize As Long
Dim PathNoExtention As String
Dim NewFilePath As String
Dim FilePath2 As String
Dim PathSize2 As Long
Dim PathNoExtention2 As String
Dim NewFilePath2 As String
Dim FilePath3 As String
Dim PathSize3 As Long
Dim PathNoExtention3 As String
Dim NewFilePath3 As String
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.AddPerspective
Call swApp.SetUserPreferenceToggle(swDisplayShadowsInShadedMode, True)
Call swApp.SetUserPreferenceToggle(swDraftQualityAmbientOcclusion, True)
FilePath = Part.GetPathName
PathSize = Strings.Len(FilePath)
PathNoExtention = Strings.Left(FilePath, PathSize - 6)
NewFilePath = PathNoExtention & "jpg"
FilePath2 = Part.GetPathName
PathSize2 = Strings.Len(FilePath2)
PathNoExtention2 = Strings.Left(FilePath2, PathSize2 - 6)
NewFilePath2 = PathNoExtention2 & "png"
FilePath3 = Part.GetPathName
PathSize3 = Strings.Len(FilePath3)
PathNoExtention3 = Strings.Left(FilePath3, PathSize3 - 6)
NewFilePath3 = PathNoExtention3 & "tif"
'1th save file
Part.ShowNamedView2 "*Isometric", 7
Part.SaveAs2 NewFilePath, 0, True, False
'2th save file
Part.ShowNamedView2 "bottom left", -1
Part.SaveAs2 NewFilePath2, 0, True, False
'3th save file
Call swApp.SetUserPreferenceToggle(swDisplayShadowsInShadedMode, False)
Part.ShowNamedView2 "*Isometric", 7
Part.SaveAs2 NewFilePath3, 0, True, False
MsgBox "Saved As : Multiple.JPG!"
End Sub
SolidworksApi macros