I am starting with Rhino.Python to develop programming and scripting skills and since I have zero knowledge of written programming (i have only worked with grasshopper’s visual programming) I have delved into the RhinoDeveloper Rhino.Python 101 as it seemed the best way to learn it.
I dont know if things have changed a lot (or if i am the first one to use these guides), but i couldn’t get the script from the bottom of 2. Python Essentials to work.
It seems to fail when using _SelName inside the sweep1 command, as it props a window. I added a hyphen before every SelName to fix it.
Just wanted to let it be known so someone could change it and no more newbies like me would think they couldnt script with python even by copy pasting code
I can’t even run the next chapter’s 4.4.1 a simple function script and get the results shown in the guide by copy pasting and since i am taking this guide to learn from zero, i cannot guess if it is due to python changing or what.
I mean, what does the last mean?
imho, scripting this way using rs.Command is not the best way to get into python programming. See if you can first find rhinoscriptsyntax functions that do the same as the Rhino command you try to mimic. The rhinoscriptsyntax functions are well documented: Rhino - RhinoScriptSyntax
I know I know, that is even stated in the guide. What I mean is that if the document exists, at least lets make it work as intended.
I read that guide quite some time ago and I don’t know if it has been corrected then in any way …
But for what I saw, it was by no means something useful for newcomers to Python.
Clearly a quick and dirty translation from the VBScript guide, with VBScript terms and concepts, even some VBS code …
May be useful to learn something about Rhino’s Python API, but you have to know Python already.
Thanks, we’ll fix these
WWW-1809 Python example errors
- for now, here’s, hopefully. a better time one:
import rhinoscriptsyntax as rs
#This script will rename an object using the current system time
strObjectID = rs.GetObject("Select an object to rename",0,preselect=True,select=True)
strNewName = "Time: " + str(time.asctime(time.localtime()))