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.
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…
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)
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)
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.