|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| continuous execution on python
|
|
|
Hi,
I would like to execute continuously some piece of code,
here is a dummy example:
from pyfbsdk import * import time
myModel = FBFindModelByName('Cube') myModel.Selected = True
for n in range(1, 10):
myModel.Translation = FBVector3d (n,2,2)
time.sleep(1)
I want the cube to move every second, instead when I execute it, the navigator will freeze for 10 second and then the cube will jump to final position.
How can I do this?
Thank you!
V’
|
|
|
|
Motionbuilder is not multi threaded in that way. In fact it is not multi threaded at all. When the script is running, the application will lock up till completion.
The best way to achieve what you are after would be to use a relation constraint. Use the system time node as the input. Convert it into seconds and use that to trigger moving the object.
|
|
|
|
|
Hi,
tnx for the reply Olie. I gave the previous example just as an example, what I want to do is actually communicating by UDP with another soft.
Now using this method, as there is no global variable if I am not wrong, I need to each time to open a port, read and close the port (I tested it and I cannot run it faster than 15-20Hz).
Do you see any way to do it better?
Cheers
S’
Author: volvic
|
| Replied: 18 January 2012 11:31 PM
|
|
|
|
|
|
Hi,
tnx for the reply Olie. I gave the previous example just as an example, what I want to do is actually communicating by UDP with another soft.
Now using this method, as there is no global variable if I am not wrong, I need to each time to open a port, read and close the port (I tested it and I cannot run it faster than 15-20Hz).
Do you see any way to do it better?
Cheers
S’
Author: volvic
|
| Replied: 18 January 2012 11:31 PM
|
|
|
|
|
|
Hi,
tnx for the reply Olie. I gave the previous example just as an example, what I want to do is actually communicating by UDP with another soft.
Now using this method, as there is no global variable if I am not wrong, I need to each time to open a port, read and close the port (I tested it and I cannot run it faster than 15-20Hz).
Do you see any way to do it better?
Cheers
S’
Author: volvic
|
| Replied: 19 January 2012 12:13 AM
|
|
|
|
|
|
Hi,
tnx for the reply Olie. I gave the previous example just as an example, what I want to do is actually communicating by UDP with another soft.
Now using this method, as there is no global variable if I am not wrong, I need to each time to open a port, read and close the port (I tested it and I cannot run it faster than 15-20Hz).
Do you see any way to do it better?
Cheers
S’
Author: volvic
|
| Replied: 19 January 2012 01:56 AM
|
|
|
|
|
You could instead send the command directly to motionbuilder via “telnetlib”. Part of this blog post shows how to do it:
http://www.chrisevans3d.com/pub_blog/?p=8
I have used this technique myself a few times and it does work without interrupting Motionbuilder.
Stev
|
|
|
Hi,
tnx for the reply Olie. I gave the previous example just as an example, what I want to do is actually communicating by UDP with another soft.
Now using this method, as there is no global variable if I am not wrong, I need to each time to open a port, read and close the port (I tested it and I cannot run it faster than 15-20Hz).
Do you see any way to do it better?
Cheers
S’
Sounds like what you need is a custom device. Devices allow motionbuilder to communicate with outside sources. They will operate in realtime, at least up to 60hz. You could set one up to communicate with your other software.
This is getting into the realms of plugin development though. Not sure if you have time or money for that kind of thing.
|
|
|
|
|
|