ScriptSpot

Forum topic · General Scripting

Batch Manager Output Error

By Libby · 2015-01-05

Description

I've been working on an automation script and I seem to have hit a small wall on one of the steps I'm working on.

In this example I have a scene with an object and some basic cameras, "Front", "Back", "Left", "Right". I started working on this neat little script script that at first seemed to work well.

batchRenderMgr.netRender = true
Front = batchRenderMgr.CreateView $Front
Front.overridePreset = on
Front.outputFilename = "\\\\Server\outputs\teapot_frontview.tif"
Front.name = "Front"

Repeat for Back, left and right Cameras.

The above works great in that it will create a view in the batch manger based on the named camera, call forth the settings I want and even give me a file output name. However the issues is that unless I manually click on the "save" button in the Render Output file and hit "ok" in the TIF Image Control, it will Not render when submitted to the Farm.. The Farm servers have the error "3dsmax adapter error : 3dsmax.exe process no response." Im still learning Maxscript so I'm hoping that this is just a learning curve that I am overlooking something simple here and not a bug in Maxscript.

The reason I need this to work without me having to go into it manually is that it is part of a larger automation process I'm working on. Thank you in advanced for all your help and knowledge.

Comments (5)

Beautiful Script! Thank you so much!

Libby · 2015-01-09

Barigazy
First Not only does this improve what I had but adds to it. Currently I was just pulling a studio with pre made cameras. This goes far beyond and will allow me to build my cameras procedurally to match the object being rendered, I had not learned how to do that yet..Thank you... This is prefect! I've been playing with this script all morning breaking it apart so I can better learn how each step works.

I started having the batch error again when I ran the script from a brand new scene. I was wrong about it being a permissions error. It seems to be a setting I have on one of my saved studios... anyway if I clear out an old studio and run your script it works. I'm still investigating exactly what it is that causes that to happen and I have a feeling that it is something very simple that I am just over looking and I will post when I figure it out.

Thank you so much again, I absolutely love it!

zahid hasan · 2016-02-23

Hi,

did you solve the max crash? please tell us about it.
We made a script to work with Batchmanger. the problem was file format as we think.
if we open the image output name once after the script and ok the filename, then the max dont crash. otherwise it crashes after saving empty files(zero size).

regards

Update

Libby · 2015-01-07

We had a major crash with our farm computers yesterday and when they got back up and running the script now works. I'm glad it works now, however I don't like not knowing why it suddenly works... Was it a permission issue with the farm computers?

barigazy · 2015-01-08

See this example. Run this code on empty scene.

-- batchRender setup
fn batchRender camArr path: imagename: ext: =
(
local batch = batchRenderMgr, appendPath = pathConfig.appendPath
batch.netRender = on
for c in camArr do
(
imagename = imagename + "_" + c.name + "view" + ext
view = batch.CreateView c
view.overridePreset = on
view.outputFilename = appendPath path imagename
view.name = c.name
)
)
--create four cameras
fn createFourOrthoCameras camType:#target origin:[0,0,0] distanceFromOrigin:100 height:0 =
(
local camNames = #("Front", "Back", "Left", "Right"), camWire = #(red,green,blue,yellow)
local camTM = #(
(matrix3 x_axis z_axis (-y_axis) [origin.x, (origin.y - distanceFromOrigin), height]), \ -- front
(matrix3 (-x_axis) z_axis y_axis [origin.x, (origin.y + distanceFromOrigin), height]), \ -- back
(matrix3 (-y_axis) z_axis (-x_axis) [(origin.x - distanceFromOrigin), origin.y, height]), \ -- left
(matrix3 y_axis z_axis x_axis [(origin.x + distanceFromOrigin), origin.y, height]) -- right
)
for i = 1 to camNames.count do
(
camera = Freecamera name:camNames[i] wirecolor:camWire[i] transform:camTM[i] orthoProjection:on
if camType == #target do
(
camera.type = camType
camera.target.pos = [origin.x,origin.y,height]
camera.target.wirecolor = camWire[i]
)
)
)

-- EXAMPLE
tea = Teapot radius:50
createFourOrthoCameras camType:#free origin:tea.pos distanceFromOrigin:300 height:50
batchRender #($Front, $Back, $Left, $Right) path:@"\\Server\outputs" imagename:"teapot" ext:".tif"