Message: Parameter must be a Guid or string representing a Guid

Hi, im working in some algortihms in rhino python wihout grasshopper, when i run my code appears a message “Message: Parameter must be a Guid or string representing a Guid” im not really getting what it means because i cant solve the problem and its the first time it appear to me.

I used to worked with rhinoscript and never appear.

Im kind of new with python in rhino so please if anyone cant enlight me with a little theory or a text that somebody can refer me to, i will really apreciate it.

Thanks

2 Likes

Probably you are trying to pass something that hasn’t yet been added to the document to a rhinoscriptsyntax method that is expecting a GUID of an object that already exists in the document… The best is to put a breakpoint in the script editor just before the line where it errors out and check exactly what you’re passing in…

HTH, --Mitch

1 Like

Ok, but how i can add that thing the guid or the string, what i understand is that the string is a variable so when i try to pass that informatiuon to a function, the message appear, this is a little examplo of what im talking about.

import rhinoscriptsyntax as rs

c = rs.GetCurveObject(“select curve”)
copy = rs.CopyObject( c, [0,0,10])
rs.DeleteObject(copy)

what is the problem with this example.

Thanks for the also answers. .

Hi Carlos,

rs.GetCurveObject will return a list with specifics of the curve picked ( see documentation)
If you simply need the curve Guid, use rs.GetObject (with the filter set to 4 (curve objects) if you only want curve to be picked)

HTH
-Willem

As per what Willem said, it is important not only to understand what functions expect for input arguments, but also to know what they return. They could return a variety of things, from a string or a GUID (not the same thing), to a number, to a Boolean value (True/False) to a list or tuple, to even a nested list…

In addition to carefully reading the help file for Rhinoscriptsyntax - which is really good and has lots of examples - setting breakpoints in the editor and stopping the script to look at the state of the variables at problem spots is also very helpful in understanding what is happening.

–Mitch

Im read your comments and know im understanding what happens to my code, thanks a lot, very helpfuls advices.

One more thing, what i thing im starting to learn is that i have to know what function are returning because not every fucntion return the same data.

Is there any form in that one fucntion that no returns guid, returns a guid, i try that with a variable but that is not working.

I’m sorry, your question is not very clear to me - can you restate it differently or post a concrete example of a situation that is not working?

Thanks, --Mitch

GetCurveObject does not return a GUID. It returns a list that contains a GUID and a bunch of other things. Check the help file for details.

This script should do what you want:

import rhinoscriptsyntax as rs

rc = rs.GetCurveObject("Select curve")
if rc:
    copy = rs.CopyObject(rc[0], [0,0,10])
    rs.DeleteObject(rc[0])
1 Like

is there no other simple automated way to pass this issue. im having it all the time in general…GUID is hell (lol)