Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

python set preferences values

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
haggi
1349 Views, 10 Replies

python set preferences values

Hi,

 

I'd like to set some scene preferences with python. e.g. turing autobackup on, setting the path for autobackup (if this is possible) and the name for autobackup, turing on compress on save and so on. Is this possible and if yes, how?

 

And I need a way to list all missing external files with python.

 

I aprecciate any help. Thanks.

 

10 REPLIES 10
Message 2 of 11
drew.avis
in reply to: haggi

Hi, it doesn't look like MaxPlus exposes this functionality directly.  You can get to the autosave settings via the MAXScript autosave interface through pymxs.  See http://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_B5405D51_E4D7_4448_9588_8D06B873578...

 

For example:

from pymxs import runtime as rt
autosave = rt.autosave
print "Autosave enabled? {}".format(autosave.enable)
print "Autosave filename: {}".format(autosave.filename)


Drew Avis
Content Experience Designer
Message 3 of 11
haggi_master
in reply to: drew.avis

Very cool, thanks a lot. This will help. And a very similiar question:

 

I've tried to set the "Reference Coordinate System" in the toolbar to "World". With maxscript it works fine:

 

toolMode.coordsys #world

 

but the same in python:

 

pymxs.runtime.toolMode.coordsys("#world")

causes an error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
RuntimeError: MAXScript exception rasied.
-- Runtime error: Illegal coordsys mode type: "#world"

 

Any ideas?

 

 

Message 4 of 11
drew.avis
in reply to: haggi_master

You just need to cast the MAXScript name value as a pymxs.runtime.Name:

 

pymxs.runtime.toolMode.coordsys(pymxs.runtime.Name("world"))


Drew Avis
Content Experience Designer
Message 5 of 11
haggi_master
in reply to: drew.avis

Great thanks a lot, I'll try it.

Message 6 of 11
haggi_master
in reply to: haggi_master

Works fine, great. Now I can set the toolMode.coordsys, but how can I query it? A simple:

 

cs = rt.toolMode.coordsys()

 

results in an error message, it needs an argument. Any ideas?

Message 7 of 11
drew.avis
in reply to: haggi_master

Try:

cs = pymxs.runtime.getRefCoordSys()

toolmode.coordsys() only sets the value.

 

Drew



Drew Avis
Content Experience Designer
Message 8 of 11
Anonymous
in reply to: drew.avis

Is there a way through pymxs to use the coordsys on a node and apply a transform?

Message 9 of 11
drew.avis
in reply to: Anonymous

Pymxs does not expose the "in coordsys" context expression, but transforms on the node should be in the node's local coordsys.  Here's a simple rotate on a box:

 

from pymxs import runtime as rt

b = rt.box()
a = rt.angleaxis(20.0, rt.Point3(0,0,1))
rt.rotate (b, a)

 This will produce the same result no matter what the toolMode setting is.

 

Does that answer your question?

 

Drew



Drew Avis
Content Experience Designer
Message 10 of 11
Anonymous
in reply to: drew.avis

I wish that was an option the only way I can zero out the parent coodsys is using an eval. Was hoping to do achieve the same thing using pymxs.

 

MaxPlus.Core.EvalMAXScript("coordsys parent $'%s'.pos = Point3 0 0 0" % node_name)
MaxPlus.Core.EvalMAXScript("coordsys parent $'%s'.rotation = Quat 0 0 0 1" % node_name
Message 11 of 11

In PyMXS, any MaxScript constant value, starting with a # character, is considered a pymxs.runtime.Name object, which is constructed from a string without the # character.  Specifically:

 

import pymxs
mxs = pymxs.runtime
mxs.toolMode.coordsys( mxs.Name( "world" )  )

 

 

A little late to the party here, but in case anybody else stumbles on this ...

 

Michaelson Britt

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report