Select one or multiple curves with additional command line options

Beginner question here.
For a script in python I would like to select one or multiple curves while having the possibilities to set some parameters in the command line. I know that this is not possible using rhinoscriptsyntax but only by using rhino commons.
You guys also already told me about this example:


But due to my lack of experience, this script is over my head.
What command (or class?) should I use instead of Rhino.Input.Custom.GetPoint() to select one or several curves?
191227_Handrail.py (4.1 KB)

Hi @Jonathan1, see if below is useful, i’ve only added 2 of the options.

GetObjectsAndOptions.py (2.0 KB)

_
c.

Thank you Clement!
That’s really helpful.

I tried to embed your script into mine.
The selection with the command line options works well. Thank you!
But somehow I’m not able to further use the selected curves in my script.
I have the feeling that I don’t understand something very basic. Like what line 91 actually does for example (return …). Could you tell me what I miss?
I marked the part where I struggle with three lines of #.

Or do i need to write two separate definitions first one for the selection and then the second to create my geometry?

191228_HandrailWithOptions.py (6.7 KB)

Hi @Jonathan1,

if you have everything in one single function, there is no need to use return after picking the curves. Returning of the tuple containing the curves as objects and all the option values has been removed. Since your variable crvs is expecting a list of object ids i’ve also changed this:

rh_objs = [obj_ref.Object() for obj_ref in go.Objects()]
if not rh_objs: return

to this:

crvs = [obj_ref.Object().Id for obj_ref in go.Objects()]
if not crvs: return

btw. Often it makes sense to create your code with multiple functions so you can later re-use them.

191228_HandrailWithOptions.py (6.7 KB)
_
c.

1 Like

Thank you Clement for taking time for this. Much appreciated!
I would never have found the obj_ref.Object.Id on my own.