Bad GUID: Message: 00000000-0000-0000-0000-000000000000 does not exist in ObjectTable

Hi,

I am coming up with this error when running the line of code pasted below: Message: 00000000-0000-0000-0000-000000000000 does not exist in ObjectTable

I am assuming this is some type of bad object? Is there error checking I can employ for this?

Here is the line of code:
id_c = Rhino.RhinoDoc.ActiveDoc.Objects.Add(obj_c)

I’m running Rhino 5 using python.

Thanks,

Eric

Hi @eric.bunn,
Maybe something is wrong with the “obj_c”.
Majority of rhinocommon classes have “IsValid” property. So you can try that before adding “obj_c” to the document.

djordje,

You probably recognized this as part of the code routine you gave me:

copy

    obj_c = rs.coercegeometry(id)
    
    # bake
    id_c = Rhino.RhinoDoc.ActiveDoc.Objects.Add(obj_c)
    id_c_L.append(id_c)

So you’re saying that I should check obj_c to see if it is valid using IsValid? Not 100% sure how to do this?

Eric

What’s the value of id that you are passing into the very first statement in your sample
obj_c = rs.coercegeometry(id)

I’m going to guess that is Guid.Empty or 0000000…

Steve,

Here is all the code I am using (pasted below). In the loop you will see I am printing each object starting with id to obj_c and finally id_c. If fails after id_ c is assigned. Here are the print statements when if fails:

(print(id)):  cf4667cb-ec56-4620-be66-a6f4a1b3d0bb
(print(obj_c)):  <Rhino.Geometry.Brep object at 0x0000000000000096 [Rhino.Geometry.Brep]>
(print(id_c)) = 00000000-0000-0000-0000-000000000000

Mostly the code works and runs effectively. Randomly it fails on the code following id_c creation.

import rhinoscriptsyntax as rs
import Rhino

id_L = rs.GetObjects("select objs from Rhino", group=True)

id_c_L = []
for id in id_L:
    
    print(id)
    
    # copy
    obj_c = rs.coercegeometry(id)
    print(obj_c)
    
    # bake
    id_c = Rhino.RhinoDoc.ActiveDoc.Objects.Add(obj_c)
    id_c_L.append(id_c)
    print(id_c)
    
    # optionally copy properties
    # layer
    layName = rs.ObjectLayer(id)
    rs.ObjectLayer(id_c, layName)
    
    # color
    color = rs.ObjectColor(id)
    rs.ObjectColor(id_c, color)
    
    # name
    name = rs.ObjectName(id)
    rs.ObjectName(id_c, name)


# group
groupName = "group_c"
allGroupName_L = rs.GroupNames()
if groupName not in allGroupName_L:
    rs.AddGroup(groupName)

rs.AddObjectsToGroup(id_c_L, groupName)

I’ve tracked the problem down to bad objects in Rhino. These are imported step files and when you run SelBadObjects they come up as bad. I wrapped the ObjectLayer, ObjectColor and ObjectName functions in a try and except function with except simply continuing the loop and skipping the geometry. The macro now does not crash but the bad items don’t get copied. I need to find a work around for this since I receive a fair amount of customer supplied files that usually have some issues like these.

The items I want to copy are in a group. If I use CopyObjects it works but puts the copy within the group. I want an independent copy and independent group. This code worked well for that but doesn’t work when you come across a bad object.

Any suggestions would be greatly appreciated.

Eric

Hi Eric,
What I meant was:

    # bake
    if obj_c.IsValid:
        id_c = Rhino.RhinoDoc.ActiveDoc.Objects.Add(obj_c)
        id_c_L.append(id_c)

But if step import file is bad, it would not help, because the geometry is wrong in the first place.

Djordje

Thank you. We have chronic problems with this not only in Rhino but in Solidworks as well. Most of these customer supplied models come from reputable CAD packages like Solidworks , Inventor, ProE etc. It is a rarity to get geometry that comes from Rhino. Rhino will typically bring this geometry in and allow one to work with it and we do this all the time. I have to figure out a way to be able to work with this geometry, as is, unfortunately.

Hi Eric,
I would post one such model here on forum. I understand that it is confidential, but there is no other way.
Then see what users will recommend in possible fixing it.

Djordje

I like the idea. I will just post the bad geometry. The geometry has naked edges. I would assume that is why it comes up bad. I did determine a work around using CopyObjects and several other functions to extract the copy from the group. I’ll post the code. I do though want to figure out if it is possible to do using the original routine.

Eric

Hi,

I’ve uploaded a zipped directory with a 3dm file containing several pieces of geometry. One is a simple extrusion which I’ve labeled Good, and the other is geometry imported from a foreign CAD file by way of a step file. Probably exported from Solidworks. I’ve labeled it Bad. If you run Select Bad Objects in Rhino it comes up bad and I’ve identified that it has naked edges in it. This is a common problem in Rhino with foreign CAD Files in my experience (20+ years using Rhino).

In the same directory is a python file that, when run, works on the good object and fails on the bad object.

Looking for a way to accomplish what this macro accomplishes on the good object with the bad object. If I just simple copy the object manually it works fine. I use this geometry only for reference when building a package design for it in Rhino.

Thanks for the help.

Eric

Bad Objects Copy.zip (2.6 MB)

Yeah, well, that is a real mess. There are so many problem areas, there is no real way to fix it easily without rebuilding it all… If you are only needing a copy of it to reference, then you can use this to copy the object with its attributes (even if it is bad):

import rhinoscriptsyntax as rs

def CopyObjectsAndAttributes():
    
    id_L = rs.GetObjects("Select Objects to Copy", group=True)
    for source_id in id_L:
        copy_id=rs.CopyObject(source_id)
        rs.MatchObjectAttributes(copy_id,source_id)
    
CopyObjectsAndAttributes()

Thank you. I will try this out. Yes just need a copy only. Not really doing anything with the geometry. Just reference geometry as I said.

Eric