Is there a way to use batch rendering or schedual rendering in order to create rendered images for several saved camera views or user saved views?
I want to render sevral views overnight....
I think i found the problem.
For some reason, the task schedule only works for me when i run SW as admin.
Set up an animation. You can key frame the camera positions and render out the animation for each of your camera views.
Or copy your top level model how many ever times and save each at one of the camera views you want to render, then schedule the files to render with the SolidWorks Task Scheduler.
I set a simple animation with key frames but how exactly do i make SW render it in the exact keyframes using photoview360 engine?
Do you mean to save a movie in those keyframes? if yes than how to make it save only the keyframes.
If this is what you meant than it can only save bmp files, or avi which is not what i need - i need jpeg...
There is a drop down when you setup the animation to have it render PV360 frames. You can also save out Targa files. Use something like IrfanView to convert to batch convert to jpeg.
You could also just open the file you want to render, set the camera you want to render and the then schedule a render. Then change the camera and schedule another render, change the camera and schedule another render. You don't have to have a different file for each view you want to render.
Open the Task Scheduler before you leave that day and it will process out the renderings at the different camera views.
I must be doing something wrong…
What am I missing? Why is my scheduled task not being carried out?
it is as if the scheduled task is not beeing registered at all.
I am running SW 2013 SP1.0 Premium on win7 x64
You schedule the renders from teh PV360 tool bar.
When you schedule the render you set a date and time for the render to process
If you schedule multiple renders the next renders will start after the previous ones complete if you check that option.
You shouldn't have to do anything in the Task Scheduler. Just make sure it's open. When you do open it the scheduled renders will be listed along with thier scheduled time/date to process.
To test, schedule a render in PV360 for at time 5 minutes in the future. Then open the Task Scheduler. Wait for the scheduled process time to pass. You should see the render start process after the scheduled time has passed.
Either I am missing something basic or I have a problem with SW...
I did exactly as you write and I do not see the scheduled job nor does it start.
I know there has been some issues like this with scheduling renders in the past. I'm on 2013 SP2 and its working correctly here. Maybe trying upgrading to the next SP?
I've installed sp2.0 and i still can't get the scheduled task to be registered.
It simply will not schedule the rendered task.
If I use the task scheduler though, I can create other tasks but not the render job via SW.
I though the render task schedule was working because ""Start after previous task" was enabled when i tried to create the task.
However, the render task is still not created.
I can use the task scheduler to create other tasks but not a render task via SW.
Any suggestions from anyone?
I use a macro to render all the cameras in a model. Works well as far as I can tell.
Can you post the macro you use to do that?
In case you haven't looked up this thread in a while - I posted the macro and the OP posted some improvements to it.
How do you create such a macro?
do you have an example?
Here is the macro I use. But it's a bit like having someone come by the house when the couch is full of laundry... I cobbled it together from different examples I found online, and once I got it working I quit messing with it.
It has a couple of issues that I wish I would have resolved before distributing it, but it does work for me as it is.
To run the macro
The renders are stored as render_cameraview.png
Let me know if it works for you. If anyone wants to make it more user friendly send me a copy.
GREATE and THNX!
It is working for me.
How can I add the SW fileName to the rendered output file name?
Thank toy for the reply.
The display issue is solved but I have a related question which I will post in PV360 as well…
I’ve tried to add another “layer” to the macro as follows:
Go over the all the configuration and display states and for each, renders each camera view.
I have a test model with a single configuration, 3 display states and 3 camera views – 9 renders in total.
The macro, in this case, should create 3 sets of 3 renders, 3 for each display state – 9 renders in total
Last time I run the it, it created the 1st 3 renders for the current display state, the 2nd 3 sets for the next display state but for the last display state it generated blank renders.
I added the command:
status = swRayTraceRenderer.CloseRayTraceRender
right before the display should change but it did not help.
Should I reset VP360 after I change the display state? If yes than how?
If you test this macro change the TASK_WORKING_DIR to the directory where you want the renders to be saved.
Dim swApp As Object
Dim Part As Object
Dim swConfMgr As ConfigurationManager
'Dim swDoc As ModelDoc2
Dim swConf As Configuration
Dim vConfigNameArr As Variant
Dim vConfigName As Variant
Dim vDisplayStatesNamesArr() As String
Dim vDPName As Variant
Dim countDP As Integer
' Preconditions: SolidWorks model is open and contains at least one camera.
' Postconditions: The cameras are turned on and off.
' Utility struct to combine the name and ID of a camera
Name As String
Id As Long
'Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelView As SldWorks.ModelView
Dim swCamera As SldWorks.Camera
Dim lNumCameras As Long
Dim lCameraId As Long
Dim swFeature As SldWorks.Feature
Dim aCameras() As Camera_t
Dim bValue As Boolean
Dim sFeatureName As String
Dim lTypeOfCamera As Long
Dim lTypeOfCameraPosition As Long
Dim TASK_WORKING_DIR As String
Dim FILE_NAME As String
Set swApp = Application.SldWorks ' Connect to SolidWorks
Set swModel = swApp.ActiveDoc ' Get active document
Set swModelView = swModel.ActiveView ' Get the active model view for the active document
Set swConfMgr = swModel.ConfigurationManager
Set swConf = swConfMgr.ActiveConfiguration
vConfigNameArr = swModel.GetConfigurationNames
' Get current directory (destination of render)
TASK_WORKING_DIR = <YOUR_RENDER_DIRECTORY>
FILE_NAME = InputBox("Enter Render Name")
' Check if a camera view is active
Set swCamera = swModelView.Camera
If (swCamera Is Nothing) Then
Debug.Print "No active camera."
Debug.Print "Camera is active."
Debug.Print " Name = " & swCamera.Id
swModelView.Camera = Nothing ' Turn off camera view
Dim lOutFile As String
Dim status As Boolean
Dim swRayTraceRenderer, swRayTraceRenderOptions As Object
Set swRayTraceRenderer = swApp.GetRayTraceRenderer(swPhotoView) ' Access PhotoView 360
Set swRayTraceRenderOptions = swRayTraceRenderer.RayTraceRendererOptions ' Get and set rendering options
' Get the number of cameras
lNumCameras = swModel.Extension.GetCameraCount
Debug.Print "Number of cameras = " & lNumCameras
ReDim aCameras(lNumCameras - 1)
For lCameraId = 0 To (lNumCameras - 1)
' Valid ID:
' 0 <= ID <= (ModelDocExtension::GetCameraCount - 1)
' IDs are reassigned if a camera is deleted
aCameras(lCameraId).Id = lCameraId
Set swCamera = swModel.Extension.GetCameraById(lCameraId) ' Get the camera
Set swFeature = swCamera
sFeatureName = swFeature.Name ' Get the names of the feature and camera
aCameras(lCameraId).Name = sFeatureName
lTypeOfCamera = swCamera.Type ' Get the type of camera
lTypeOfCameraPosition = swCamera.PositionType ' Get the type of camera position
'Loop over configurations
For Each vConfigName In vConfigNameArr
Debug.Print "Configuration = " & vConfigName
Set swConf = swModel.GetConfigurationByName(vConfigName)
countDP = swConf.GetDisplayStatesCount()
Debug.Print " Count Display states: " & countDP
vDisplayStatesNamesArr = swConf.GetDisplayStates()
'Loop over display states
For Each vDPName In vDisplayStatesNamesArr
Debug.Print " Display state = " & vDPName
'activate display state
'InputBox ("Press to switch Display")
'MsgBox "Switch to Display " & vDPName, vbOKOnly
' Now switch the view to each camera
For lCameraId = 0 To (lNumCameras - 1)
bValue = swModelView.SetCameraByName(aCameras(lCameraId).Name)
If (bValue = False) Then
Debug.Print "Failed to set model view to use camera " & aCameras(lCameraId).Name
Debug.Print "Model view set to use camera " & aCameras(lCameraId).Name
lOutFile = TASK_WORKING_DIR & "render_" & FILE_NAME & "_" & vDPName & "_" & lCameraId
status = swRayTraceRenderer.RenderToFile(lOutFile, 0, 0) ' Render
swModelView.Camera = Nothing
Retrieving data ...