Hi,
Is there a way to check if a body with a specific id exist in my project using python? If I try, for example, to use a command with a body id that does not exist, how do I get the error code using python?
Thanks,
Hi,
Is there a way to check if a body with a specific id exist in my project using python? If I try, for example, to use a command with a body id that does not exist, how do I get the error code using python?
Thanks,
Hi,
I can think of two ways to do this. You will not necessarily get an error code but you can catch and detect the error.
cubit.cmd("reset") cubit.cmd("brick x 10") try: b = cubit.body(2) except RuntimeError: print("Error")
cubit.parse_cubit_list()
to get the body by id. If the body does not exist, it will return an empty tuple.body_exists = cubit.parse_cubit_list("body", "2") if body_exists: print("Found it") else: print("Error")
Karl