Saving a file to custom path

2,343 views
Skip to first unread message

Lidia Martinez

unread,
Feb 19, 2015, 1:21:44 PM2/19/15
to python_in...@googlegroups.com
Hi pythons,
weird stuff if happening. I try to save a file to a custom path i created, not inside of the default workspace. For example:  C:/myfolder/ 
After a while trying to understand why passing a path to the cmds.file(save = True) command doesn't work, I come across this two lines:

cmds.file( rename = sceneName) # I change the name of the scene, but the path on the top bar keeps being the default workspace. If i pass a full path, it gets appended to the default workspace path.

fileSaved = cmds.file( force = True, save = True, type = 'mayaBinary') # Save can't have any path, so i save... but i cannot set any path to save to.

I try save as... , and no comprehensible code gets flushed into the command line. 

I find no answer. The only thing I notice is something about a weird customizable: pv_performAction , which I don't really understand, not mentioned very often.


So, how the hell do i just save the current scene file to an .mb file in a custom path?



Thanks!
--
Lidia

Kurian O.S

unread,
Feb 19, 2015, 1:34:24 PM2/19/15
to python_in...@googlegroups.com

import maya.cmds as cmds
customPth = “/net/username/test/testscene.mb”
cmds.file(rename = customPth)
cmds.file(s=True,f=True, typ=”mayaBinary”)

This works for me, but remember if you trying to save a mayaAscii to mayaBinary then it may fail if it has any unknown nodes. 



--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8zscL-Kth%3Dj49aQgdFAYPZCtOrWEhG2HNM1bDwVtgjsYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
--:: Kurian ::--

Paul Molodowitch

unread,
Feb 19, 2015, 6:44:23 PM2/19/15
to python_inside_maya
Also, make sure the directory you're saving to works.

Another alternative:

import pymel.core as pm
pm.saveAs('/my/awesome/path.mb', f=True)

Paul Molodowitch

unread,
Feb 19, 2015, 6:44:42 PM2/19/15
to python_inside_maya
err... by works, I mean already exists...
Reply all
Reply to author
Forward
0 new messages