Uhm…
I am AFK, here a quick tip.
If you want to use that RhinoCommon overload, you need to input the exact same amount of arguments (which is 2). There will be other overloads with different amount of parameters.
Thanks for the hint @piac, I also found one mistake on my side, it requires RhinoObject and I was passing in ObjRef. Maybe that also confused the method.
Looking at all the overloads for the Delete
Method https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_DocObjects_Tables_ObjectTable_Delete.htm
You can see that when only one argument is supplied, the function expects a RhinoObject
(hence your error message).
If you supply a bool
to the quiet
argument (like shown in your screenshot) you get the overload you wanted.
Hope to help
Hi @lando.schumpich, @piac,
I actually solved it by simply coercing to rhinoobject.
I assume it’s caused by the duck typing of python.
Nevertheless, I wonder if there isn’t a way to avoid this error.
the way to prevent this error is to supply the correct number of arguments:
for object in sc.doc.Objects:
sc.doc.Objects.Delete(object.Id, True)
My idea was something like if you do this in pure python method:
def func(object,bool=None):
if bool == None: bool=True
#clearly missing object will create an error:
# but bool won't
Well there could be an overload taking just a Guid
as an input. Then your posted code would work