Area :: Header
Autodesk University
The future of making things
Discussion Groups


New Member
Posts: 1
Registered: ‎07-16-2006

How to verify if a RigidBody exists?

33 Views, 0 Replies
02-28-2012 02:54 PM
Hello, I'm new to python and I've been ask at work to make a script which is supposed to save us a lot of time cleaning Mocap captures.

I got my code working pretty well. The idea is to get a list of components which have the FBModelMarkerOptical class, and then for each one of those, get it's RigidBody and work with it.

The problem is that MotionBuilder crashes when it finds a component which DOESN't have a RigidBody, and I don't really know how to ask if it has one.

My code looks like this:

if lMarker and lMarker.ClassName() == "FBModelMarkerOptical":
RigidObject = lMarker.GetRigidBody()
RigidObject.Done = False
RigidObject.Done = True

Earlier today, I tried with if lMarker.GetRigidBody().IsValid(): but it's still crashing when it finds a component without RigidBody.

How can I check if it has a RigidBody and then set RigidObject?

Thanks very much!
Please use plain text.