You must create the keywords associated with pick steps in the same order as the pick steps in which the keywords are used. For example, if you have two pick steps, you must create the keyword passed into the first pick step before you create the second keyword, which is passed into the second pick step. Creating the keywords associated with pick steps in the same order as the pick steps in which the keywords are used ensures that the necessary setup commands are issued in the proper order for the command to work correctly. You can specify many parameters when picking items from the viewport. You specify some of these parameters in the AFXPickStep constructor, and you specify other parameters by calling various methods of the pick step. To construct a pick step, you must at least supply the following:
The following example shows how you can write a pick step: class MyProcedure(AFXProcedure): def __init__(self, owner): AFXProcedure.__init__(self, owner) self.cmd = AFXGuiCommand(self, 'myMethod', 'myObject') self.nodeKw = AFXObjectKeyword(self.cmd, 'node', True) def getFirstStep(self): return AFXPickStep(self, self.nodeKw, 'Select a node', AFXPickStep.NODES) Optional parameters in the constructor allow you to specify the following:
If the user is allowed to pick only one entity, the procedure will automatically advance to the next step after the user picks an entity; however, the user can back up to the previous step to change the selection. If the user is allowed to pick one or more entities, the user must commit the selections by clicking mouse button 2 or by clicking the button on the prompt line.The highlight level controls the color of the selected entities. In some procedures, different colors are used between steps to distinguish the selections. The sequence style controls how a sequence of picked objects is represented in the command string. If the sequence style is AFXPickStep.ARRAY, the picked objects will be represented as the concatenation of slices of arrays; for example, v[3:4] + v[5:8], where v is a vertex array. You cannot use the AFXPickStep.ARRAY sequence style to pick a combination of entities with multiple types because only objects of the same type can be concatenated. In addition, you cannot use the AFXPickStep.ARRAY sequence style to pick interesting points because interesting points are constructed on-the-fly and are not accessible from slices of an array. If the sequence style is AFXPickStep.TUPLE, the picked objects will be represented as a tuple of individual objects; for example, ( v[3], v[5], v[6], v[7]). The style you choose depends on the format accepted by the command that you intend to issue. Some commands in Abaqus/CAE accept both styles, but some accept only one or the other. For further details on the arguments to the AFXPickStep constructor, see the Abaqus GUI Toolkit Reference Guide. |