I guess in pseudocode it would look something like:
import rhinoscriptsyntax as rs
Points=[[0,0,0],[30,14,0],[-15,-19,0],[0,0,0]]
curve=rs.AddCurve(Points)
rs.SelectObject(curve)
rs.Command("_Gumball " + "On ")
while #("enter key is not pressed"):
#allow user to modify curve using gumball
if #"Enter key is pressed":
#end while loop
Thanks for that Dale. It pauses the script until I press enter however the gumball does not appear until after the script has finished. Is there a way to show the gumball whilst the script is running?
I am trying to achieve something similar to what @jordy1989 is trying to do here - create a dent in an .stl mesh; almost like placing a rock under a sheet although my “rock” has a specific 3d shape. Fortunately the shape of the dent is roughly the same every time although it may be rotated or scaled as desired. I have found that I can achieve the desired dent by using a rectangular CageEdit to the mesh and displacing the cage a predetermined amount.
What I would like the script to do is insert the shape, allow the user to move, rotate and scale the shape to where they want it (the gumball is perfect for this) then apply the cage edit where the shape is. I have everything scripted except the gumball part. Right now the creation of the shape and the Cage Edit scripts are separate to enable the use of the gumball in between however the user has to reselect everything for the second script to work. It would be much easier if this could all be done through one script - hence the desire to use the gumball whilst a script is running.
There really is no way to start and stop a script, allowing some endless operation in between. You might consider breaking you script into two components: a pre and post script, if you will.
That is what I am doing now…
I had wanted a behavior similar to when rs.GetObjects is called where the script allows the user to select multiple objects and press enter when the selection is complete, only I would like the user to be able to use the gumball instead.
i was messing around with the idea of an eraser tool and was able to (sort of) get the ability… (letting the user do things until they press space/return)… couldn’t figure out a way to get the gumball to show up midscript though.
import rhinoscriptsyntax as rs
while True:
pick= rs.GetObject('erase')
if not pick:
break
rs.DeleteObject(pick)