Is it possible to write a macro that automatically generates a jpeg in a isometric view (for every part or assembly the same view)
Thanks in advance
Artem Taturevych, Deepak Gupta Can one of you help with this issue?
I recently recorded a macro succesfully the only problem is the saving.
I already tried to copy some saving settings from other macro's, but that didn't work.
So I set it back to the original setting
Now, the file keeps overwriting (as seen in code)
Preferably, the JPEG is saved in the folder where the part/assembly is in.
Can anybody help?
Dim swApp As Object
Dim Part As ObjectDim boolstatus As BooleanDim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDocDim myModelView As ObjectSet myModelView = Part.ActiveViewmyModelView.FrameState = swWindowState_e.swWindowMaximized
' Named ViewPart.ShowNamedView2 "*Isometric", 7Part.ViewZoomtofit2boolstatus = Part.Extension.InsertScene("\scenes\01 basic scenes\11 white kitchen.p2s")boolstatus = Part.Extension.InsertScene("\scenes\01 basic scenes\00 3 point faded.p2s")Part.ClearSelection2 TruePart.ActivateSelectedFeatureboolstatus = Part.SetLightSourcePropertyValuesVB("Ambient-1", 1, 0, 16777215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, False)boolstatus = Part.LockLightToModel(0, True)Part.GraphicsRedrawPart.ClearSelection2 True
' Save Aslongstatus = Part.SaveAs3("D:\Users\RM\Desktop\110406.JPG", 0, 2)End Sub
Check macro codes from this post and modify as needed:Macro to save jpg of iso view
Thanks. I modified it.
I just started learning macro's, so i have 2 questions;
1. After I added some view settings (3 point faded, white kitchen and light) i'm getting the following error(Picture)
2. I only want to make jpegs from assembly's, which part of the code do i need to change?
Reno Meertens wrote: Thanks. I modified it.I just started learning macro's, so i have 2 questions;1. After I added some view settings (3 point faded, white kitchen and light) i'm getting the following error(Picture)2. I only want to make jpegs from assembly's, which part of the code do i need to change?
Reno Meertens wrote:
I do not think that the changes should create that error, so share you changed macro to debug.
And for assembly make following changes (macro codes would be different to what you have)
Retrieving data ...