I spend a bunch of time trying to collect data send by _Paste command during the execution of the GetPoint class into a loop. The loop is working by entering values manually, but not with the _Paste command.
My goal is to immit the _Points command.
See the capture bellow.
I’ve tried almost every GetBaseClass methods unsuccessfully. (AcceptNothing, AcceptString, EnableTransparentCommands, AcceptEnterWhenDone, …)
I’ve tried with :
Rhino.Input.RhinoGet.GetPoint object
Rhino.Input.Custom.GetPoint object
rhinoscriptsyntax.getPoints → which use the RhinoCommon API as well
I’m all available to discuss this issue, thank you so much for your help.
import Rhino
import scriptcontext as sc
def test_point_paster():
points = []
gp = Rhino.Input.Custom.GetPoint()
gp.SetCommandPrompt("Location of point")
while (True):
gp.Get()
if (gp.CommandResult() != Rhino.Commands.Result.Success):
break
points.append(gp.Point())
gp.SetCommandPrompt("Location of point. Press Enter when done")
for pt in points:
print(pt)
if __name__ == "__main__":
test_point_paster()
An alternative to solve this issue is to use the Grasshopper Player. You can copy a part of your code in a GH Python block and use the new blocks from Rhino V7 :
Get Point
Get String
You can _Paste whater you want during the prompt of those new blocks.
Refer to this Steve Baer’s tutorial for more information: