Hi all,
I've got 25 cameras set-up and I would like to render each one for 3 hours.
I want to create a vba code to run all in batch mode.
The code is almost done (thanks internet 🙂 but I'm stuck in last step with is lanching the render and save it in a folder as .jpg file.
I read someone who used ..... oRenderManager.rendertofile "C:\temp\render1.jpg" ... but it doesn't work with me (don't know why) I'm getting run-time error 13.
Does anybody know how to lanch a camera based render and save it as *.jpg file in a folder?
Thanks in advance,
Jorge
Ps: please see below the code so far...
##############################################
Sub StudioRender()
' Find the Studio Add-In
Dim oStudioAddin As ApplicationAddIn
Set oStudioAddin = ThisApplication.ApplicationAddIns.Item(29)
If oStudioAddin Is Nothing Then
MsgBox "Inventor Studio Addin not loaded."
Exit Sub
End If
' Get the Inventor Studio object.
' Dim oInventorStudio As InventorStudioLib.InventorStudio
Set oInventorStudio = oStudioAddin.Automation
'Dim xxx As ApplicationAddIn
' Get the environment manager for the active document.
Dim oEnvironmentMgr As EnvironmentManager
Set oEnvironmentMgr = ThisApplication.ActiveDocument.EnvironmentManager
' Get the current environment.
Dim oCurrentEnvironment As Environment
Dim strEditID As String
Call oEnvironmentMgr.GetCurrentEnvironment(oCurrentEnvironment, strEditID)
' Activate the Studio environment.
Dim oStudioEnvironment As Environment
Set oStudioEnvironment = oInventorStudio.Activate
' Get a reference to the RenderManager
' Dim oRenderManager As InventorStudioLib.RenderManager
Set oRenderManager = oInventorStudio.RenderManager
' Set the active lighting style.
'oInventorStudio.ActiveLightingStyle = oInventorStudio.StudioLightingStyles.Item("Grid Light")
X = 1
Do Until X > oInventorStudio.StudioCameras.Count
'activate lights per room
'code here
' Set the Camera.
oRenderManager.camera = oInventorStudio.StudioCameras.Item(X)
' Set the active Scene.
'oInventorStudio.ActiveSceneStyle = oInventorStudio.StudioSceneStyles.Item("Starfield")
' Set the output resolution to the size of the current view.
oRenderManager.ImageWidth = ThisApplication.ActiveView.Width
oRenderManager.ImageHeight = ThisApplication.ActiveView.Height
'oRenderManager.AntiAliasing
' Render the image.
oRenderManager.rendertofile "C:\temp\render1.jpg" ' >>> this is where I get the error
X = X + 1
Loop
' Reset the environment to whatever it was before
' we entered the Studio environment.
Call oEnvironmentMgr.SetCurrentEnvironment(oCurrentEnvironment)
End Sub
#############################
Can you try the code if you un-comment the line below:
' Dim oRenderManager As InventorStudioLib.RenderManager
Can't find what you're looking for? Ask the community or share your knowledge.