Hello,
I want to make a script that continuously redraws objects based on parameters provided via a dialog box.
I currently have this function which is showing the dialog box, collecting the parameters, and redrawing the object.
def RebuildOpticalZone(optical_zone_id):
args = RebuildCurveArgs()
dlg = RebuildCurveDialog(args)
rc = dlg.ShowModal(RhinoEtoApp.MainWindow)
if rc and args.IsValid():
optical_zone_new = createOpticalZone(args.Clearance, args.BCR, args.BOZD)
if optical_zone_new:
if args.DeleteInput:
sc.doc.Objects.Replace(optical_zone_id, optical_zone_new)
else:
sc.doc.Objects.Add(optical_zone_new, optical_zone_new.Object().Attributes)
sc.doc.Views.Redraw()
I call the RebuildOpticalZone function from the main function:
if( __name__ == "__main__" ):
RebuildOpticalZone(optical_zone_id)
I would like to add keyboard listening functionality, whereby the dialog box shows up after pressing a key. The objects are then redrawn after providing the parameters.
I found there is a Rhino.GetKey() command but have not managed to make it work. Would it be possible to provide some sample code?
Thanks.