Quick Python Help Needed

I’m writing my first script for blender (scripts in other languages) and can’t get a mesh to rotate 90deg around x axis. I’m coding on 2.45, python is installed. I’m assuming that this is a 2 liner but my attempts with RotX, getOrientation and matrix calculations throw back errors. Can anybody point me to an adequate Blender Python reference or just pull together a snippet i can use?

http://www.blender.org/documentation/244PythonDoc/index.html

Good blender python reference above. (for the time being)

Once you get the object it should be like



ob.RotX += 3.14159/2 (or use some other, more accurate value of pi/2)


The screen must be redrawn to show the changes

Thanx. Works just fine now.

I have another problem: How do I get my script to execute a .exe?

I’m making a simple exporter and calling the exe as the final step which simply cannot be (realistically) avoided :frowning:

You can use the python os module’s exec* series of commands:

http://docs.python.org/lib/os-process.html

I’ve never used them, so I can’t offer much help beyond pointing you to those docs.

When you say you are executing the .exe, are you calling the program to which your exporting? Or are you calling something to finish the export process?

My research has pointed me in that direction but whenever i use os.exec or os.system I get

unable to read script file

This is true for blender and full python.

To clarify, blender will be writing a config file and calling an exe to complete the export. I don’t need to monitor the process in any way.

PROGRESS: If I use os.startfile the exe launches but i can’t pass an argument.

MORE PROGRESS: The os.system command was working just fine all along, the error was coming from the exe :o

Last question (i hope):
Using os.system means my script is now dependent on python. Is there an elegant way of checking for a full install?


try:
     import os...all other python dependent modules
     Run your code
except:
     print "A full install of python is required to run this script" #Or you could use a popup box
     Exit From Script...

That should test for the existence of the os module, and if not there print a warning message

Thank you so much.
A beta version of my “Nexuiz Weapon Exporter” is now out thanks to you. :smiley:
You can read more about it in the thread on the alientrap forums:
http://www.alientrap.org/forum/viewtopic.php?p=25720#25720