IsObjectValid(object_id) returning error

Hi everyone, I’m getting an unusual behaviour when using IsObjectValid(object_id) to check a particular geometry.

Sometimes, it returns the message: “00000000-0000-0000-0000-000000000000 does not exist in ObjectTable”, which kills the script. I was expecting that in this case the method would return a False boolean. Is this working as intended?

I also found that with the boolean methods (BooleanDifference, BooleanUnion, etc), if the boolean fails, instead of returning False, the methods return “00000000-0000-0000-0000-000000000000”, despite documentation saying it should return False.

I think it is working as intended.
IsObjectValid() calls into the coercerhinoobject() from here

You see that it does raise errors for some situations, in lieu of returning a bool

You can perhaps wrap it in a try block, and catch the ValueError

1 Like

Thank you Will, that’s what I am doing atm.

I’m still a bit surprised this is expected behaviour. It would make coding much easier if False was returned instead. It’s also a bit unintuitive that “IsObjectValid” can return an invalid object.

yeah it should raise an error rather than returning anything. maybe you can do a pull request.