Getting Operator Inputs

From Shopbot Wiki


Getting Input from the Tool operator

There are several ways to get communicate with the tool operator, and to get and use answers from them.

The PAUSE command

A PAUSE command, without a time value after it or a comment before it, will display a "Continue" box like this.


If the PAUSE command follows a comment, that comment will appear in a message box. The only options the operator has, though, is OK to continue or CANCEL to end the file. If you had these lines in your file:

'Start cutting now?

Then this box would appear on the screen:


The INPUT command

The INPUT command is much more useful and versatile, and let's the operator not only give answers to questions, but give the file numeric answers as well. An input statement like this

INPUT "How thick is your material?" &thickness

Would present the tool operator with this box, and whatever number they typed would be saved in the &thickness variable.


You can also have the operator make decisions by giving them codes to type in, like this:

INPUT "Type (Y) to zero the Z-axis here." &ZeroAnswer


and test for multiple inputs like this, like this:

INPUT "Type (A) to move to 0,0 or (B) to move to 12,12." &MoveAnswer
IF &MoveAnswer = A THEN M2,0,0
IF &MoveAnswer = B THEN M2,12,12


(NOTE:) Be careful when using the INPUT statement this way to make sure that you think about what would happen
if the operator typed in a incorrect value or something that the file didn't expect. If the next line in the file
above cut a part file in offset mode, an incorrect value typed in (like  "C") would cut the file from the current
location, which might not be what you want.

One can prevent accidental input mistakes with other program statements. The file below stops the main program until either correct data is entered or the operator OKs the custom input. If you'd rather not use a called program, insert this code in your main program. Just remember to replace "end" with "goto NEXT_LABEL"

In this program, the drawer box width variable ( &_U_Box_Width ) is the desired input, but only in widths of 142, 195 and 227 mm:

   INPUT "Enter box width in mm:" &_U_Box_Width  
       if &_U_Box_Width = CUSTOM then GOTO CUSTOM_SIZE
       if &_U_Box_Width = 142 then END 
       if &_U_Box_Width = 195 then END
       if &_U_Box_Width = 227 then END
      INPUT "Non-scheduled Box Width--try again or type   CUSTOM    " &_U_Box_Width  
   CUSTOM_SIZE:	'Projects and R+D use.
      INPUT "Enter the   CUSTOM   box width in mm:  " &_U_Box_Width  
      MSGBOX (Is this Correct?   CUSTOM Box width:     &_U_Box_Width    , YesNoCancel, Check your data!)
          IF &MsgAnswer=No  THEN GOTO CUSTOM_SIZE

The MSGBOX command

BillYoung, Gaston, Don
Personal tools