@siemen wrote:
Ok so I changed the script from this link: Add command line options such that the Getpoint keeps repeating until I Esc out of it. I also removed all options except for the integer option. And I added “intOption.CurrentValue+=1” to make the integer increase by 1 each time you make a point.
But the problem is that it’s not showing the increased integer in the command line until I click on that option. Then it show’s me the current integer.
So it keeps showing me this after each point I place
until I click on the option and then it shows me the updated Integer after placing a few points (4 in this case)
Can anybody help me out here? How do I update the commandline option after placing each point to match that new integer? And perhaps a better question: How do I search and find things like this without having to ask somebody else that knows this?
import Rhino import scriptcontext def CommandLineOptions(): # For this example we will use a GetPoint class, but all of the custom # "Get" classes support command line options. gp = Rhino.Input.Custom.GetPoint() gp.SetCommandPrompt("GetPoint with options") # set up the options intOption = Rhino.Input.Custom.OptionInteger(1, 1, 99) gp.AddOptionInteger("Integer", intOption) while True: # perform the get operation. This will prompt the user to # input a point, but also allow for command line options # defined above get_rc = gp.Get() if gp.CommandResult()!=Rhino.Commands.Result.Success: return gp.CommandResult() if get_rc==Rhino.Input.GetResult.Point: point = gp.Point() scriptcontext.doc.Objects.AddPoint(point) scriptcontext.doc.Views.Redraw() intOption.CurrentValue+=1 elif get_rc==Rhino.Input.GetResult.Option: if gp.OptionIndex()==opList: listIndex = gp.Option().CurrentListOptionIndex continue if get_rc == Rhino.Input.GetResult.Cancel: break return Rhino.Commands.Result.Success if __name__ == "__main__": CommandLineOptions()
Posts: 2
Participants: 2