I’m using this code
objs = rs.JoinMeshes(objs, delete_input=True) and I have an issue with it returning a GUID of
I get this when some of the meshes it is trying to join are so called Bad objects.
Is this expected behaviour? How can I check for bad objects in python?
Can you post your meshes, that you are trying to join, and a small code snippet that is not working for you?
Sure thing. Try this script LayersToFBX_cmd.py (8.4 KB) on this file. guid error.zip (9.4 MB)
At the input, Select the layer called Error and accept default options.
The script goes through the layers selected, mesh the objects, join the meshes according to materials and then exports as FBX. But for some reason this bunch of meshes returns a 0-guid from
JoinMeshes and I’m not sure how to error check for it…
Open your file and run this from the command line:
_-Mesh _PolygonDensity=50 _Enter
When the meshing is finished, you will see this:
The "Mesh" command created 5 bad objects.
Which is probably the cause of the join problem. It would be nice to try to figure out what surfaces and/or polysurfaces are not meshing.
I’m travelling and haven’t had a chance to try what you suggest. But just from what you write, would it be possible for me to do error handling after the
Mesh command in the script to pick up on bad objects there before feeding them into
have you tried to either check the RhinoObject with
rh_obj.IsValid or for System.Guid.Empty ?
print System.Guid.Empty == System.Guid("00000000-0000-0000-0000-000000000000")
Hi, Havent’ tried the first method, but the way I remembered it is that as soon as I try to access the GUID to check for emptyness, errors happen.
@bjornsyse, you could catch it:
newobjs = rs.JoinMeshes(objs, delete_input=True)
# Check for errors in JoinMeshes?
if newobjs == System.Guid.Empty:
print "This is your error"
assert False, "Abort: bad mesh object detected !"
print "new: " , newobjs, type(newobjs)
Thanks! I’ll try that when I get back from vacation.