Allowing the user to type in points

If you want to allow the user to type in the coordinates of a point as an alternative to picking in the viewport, you can call the addPointKeyIn method and pass it a tuple keyword.

The addPointKeyIn method posts a text field on the prompt line. The type of the keyword passed into the addPointKeyIn method determines what values are collected from the user; for example, two or three values and whether those values are float or integer types. For example, in the constructor of your procedure you could define an additional keyword as shown in the following code:

    self.pointKw1 = AFXObjectKeyword(self.cmd, 'point', True)
    self.pointKw2 = AFXTupleKeyword(self.cmd, 'point', True,
        3, 3, AFXTUPLE_TYPE_FLOAT)

In one of the steps of your procedure you could add a key-in option, as shown below:

    step = AFXPickStep(self, self.pointKw1, 'Select a point', 
        AFXPickStep.POINTS)
    step.addPointKeyIn(self.pointKw2)

If a step has a key-in text field, the user enters some values in the text field, and the user commits the values by pressing Enter, those values will be used in the command. Alternatively, if a step has a key-in text field and the user selects an entity in the viewport, that entity will be used in the command, regardless of whether anything was typed in the text field. The mode automatically takes care of deactivating whichever keyword needs to be deactivated based on these rules. In the previous example, if the user types in a point, self.pointKw1 will be deactivated and self.pointKw2 will be activated. In addition, self.pointKw2 will contain the value entered by the user.