Does not exist in Object Table

Hi,

I have a script that has been working before, but now I get a “does not exist in Object Table” error.
I doesn’t matter which surface I choose.

Basically the error apears when using even rs.Area() command

Please help!

Posting your geometry/code is highly recommended. Works for me:

python_area

Hi,

Strangely I also get it to work when creating a new grasshopper file. But going back to the old one results in the same error.

Could this be because the original file was made in Rhino 5 and now I use it in Rhino 6 maybe?

Any Ideas?

Posting your geometry/code is highly recommended.

unnamed.gh (3.7 KB) Untitled.3dm (27.3 KB)

Unable to read your R6 .3dm file in R5. Can you internalize your surfaces into the GH file?

it’s most likely a scriptcontext problem. Joseph’s example works because the geometry “exists” in the grasshopper document, and that is where rhinoscriptsyntax is focused.
Your example is not working(consistently), because the geometry exists in the rhinodocument.
Try something like this: (type input set to guid for your referenced surface).

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

#rhinoscriptsyntax
sc.doc = Rhino.RhinoDoc.ActiveDoc
obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(x)
print rs.coerceguid(obj)
print rs.Area(obj)
sc.doc = ghdoc

Even better…just use rhinocommon. (no need to mess with setting scriptcontext)
type hint for input surface set to “Surface”.

import Rhino
print x.ToBrep().GetArea()

Thanks,

I have always done my coding in rhinoscriptsyntax as I feel safe working with it.
But in the future I’ll be using rhinocommon if that is more “safe”, but I’m not that happy to change my entire code for this project.

If there are a reason why this has occured since it’s not working on any surface anymore?

Thanks again!

hrmm…uhm, I have to admit, I did not expect this to work. I just downloaded your files and it seems to work as you expect, with a surface/multiple surfaces referenced from the Rhino document.
I tested on Version 6 SR17
(6.17.19204.4491, 07/23/2019)

import rhinoscriptsyntax as rs

xArea = 0

for i in x:
    xArea = xArea + rs.Area(i)
    print xArea

do you mean that you get the same error or is it working for you?

it works…but I feel like it shouldn’t be…
EDIT: okay, I think I understand this, (this is why I stay away from rhinoscriptsyntax in a ghpython component…I always get a little mixed up). I was not entirely clear in my previous post.
The referenced geometry, (from the rhino document), is stored in the surface parameter. At this point, it is Grasshopper geometry, not Rhino geometry.
By setting the type hint, (which I think is the default), to “ghdoc object when geometry (rhinoscriptsyntax)”, any rhinoscripsyntax functions you call, from within grasshopper, will operate on that gh geometry, (NOT the Rhino geometry). Note, this only applies to geometry…as it says in the type hint.
IF…you wanted to get any other information about that geometry, (user text, layer name, object color, etc), you would need to use scriptcontext and get it from the active rhino document. (again, IF you are using rhinoscriptsyntax).

As far as your script not working on your particular file, perhaps there is something strange going on, especially if you copy/paste into a new rhino document and it still doesn’t work. In your GH file, maybe dump any surface parameters and re-reference in your surfaces?
maybe try this, to verify the surfaces are valid.

import rhinoscriptsyntax as rs

xArea = 0

for i in x:
    xArea = xArea + rs.Area(i)
    print i
    print xArea
    geo = rs.coercegeometry(i)
    print geo.IsValid
1 Like

The starnge thing is that it doesn’t work in my original file (Which I would like to keep for my self) =).
And neither if I copy/paste theses specific parts to a new document.
But if I start an empty document and write it in from scartch it works fine.

Thats why I think that there are some error in my original file.
I know that there were a problem some days ago then uploading it to onedrive, but since I could open it eitherway I didn’t thought that should have resulted in some error.

I would really much like the plugin to work as it is if possible.

This is the full message if anyone is interested:

Runtime error (ValueErrorException): 4d8f052e-babb-4cb5-bfc6-4b33d1d0e57d does not exist in ObjectTable

Traceback:
line 1065, in coercerhinoobject, “C:\Users\SB\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py”
line 237, in Area, “C:\Users\SB\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\geometry.py”
line 20, in script

if there is any way you can post a fuller version of the part that is failing, it would be helpful.
What geometry are you trying to coerce, and where is it coming from?