I don't fully understand what you're asking it's a little confusing on what 
you mean to specific pieces and how you're trying to achieve it. 

But I can answer your other 2 questions:
By default your renders are saved to: 
C:\Users\user\Documents\maya\projects\default\images\tmp
You can change this easily by changing your fileRule on "images" to: 
cmds.workspace(fileRule= ['images', "%s" % directoryPath])

As for batch renders please look into mayapy 
<https://avtechartist.wordpress.com/2014/02/12/mayapy-interpreter-python-in-maya-standalone/>
 very 
easy tutorial.

Once you have the script working just paste it into your standalone python 
file and it will run as a process. 

On Wednesday, September 28, 2016 at 12:18:21 AM UTC-7, [email protected] 
wrote:
>
> Hi Guys, 
>
> I need to create .command file with an automatic rendering in Maya where I 
> can import multiple Obj files, to different render layers, apply materials 
> and create a batch render for them. 
>
> I have the following script: 
>
> import maya.cmds as cmds 
> import glob 
>
> def importFile(i): 
>     cmds.file(i, i=True, groupReference=True, groupName="myobj") 
>
>
> def moveFile(): 
>     cmds.select("myobj") 
>     
>     cmds.scale(1,1,1, r=True) 
>     cmds.move (0, 14, 0, r=True) 
>     cmds.rotate (-90, 0, 0, r=True) 
>
>
> def materialFile(): 
>     cmds.select("myobj") 
>     myMaterial = "blinn1" 
>     cmds.sets( e=True, forceElement= myMaterial + 'SG' ) 
>
>
> def renderFile(i): 
>     cmds.setAttr("defaultRenderGlobals.imageFilePrefix", i, type="string") 
>     cmds.render(batch=True) 
>
>
> def deleteFile(): 
>     cmds.select("myobj") 
>     cmds.delete() 
>
>
> myglob = 
> glob.glob("/Users/MyMacbook/Documents/maya/projects/default/assets/Ring 
> exports/Obj/*.obj") 
>
> for i in myglob: 
>     importFile(i) 
>     moveFile() 
>     materialFile() 
>     renderFile(i) 
>     deleteFile() 
>
>
> The problem with this script is that it applies the material to the whole 
> obj element. I need to apply different shaders to specifit pieces on the 
> element. 
>
> The other problem is, it renders in the UI and I need to create a bach 
> render. 
>
> After that I need to call all of this actions from a .command file because 
> I will go to a render farm. 
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/136ad94c-c517-4446-b0c0-733404870cda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to