Description
Prompts the user to pick an object.
Tip: You can use "PickElement [object_name]" to set output parameters.
Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:
For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.
For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).
Scripting Syntax
PickObject( LeftMessage, MiddleMessage, [PickedElement], [ButtonPressed], [ModifierPressed] )
Parameters
|
Parameter |
Type |
Description |
|
LeftMessage |
Status bar message for the left mouse button. |
|
|
MiddleMessage |
Status bar message for the middle mouse button. |
|
|
PickedElement [out] |
Returns the picked object. |
|
|
ButtonPressed [out] |
Returns the mouse button clicked by the user. Possible Values: • 0: Right mouse button (or the Esc key), which means the user aborted the picking session • 1: Left mouse button • 2: Middle mouse button |
|
|
ModifierPressed [out] |
Returns the modifier key pressed by the user. Possible Values: • 0: None • 1: Shift modifier key • 2: Ctrl modifier key • 3: Shift-Ctrl modifier key |
Examples
VBScript Example
' The following example will use "PickObject" to pick two objects
' consecutively and will make the first object parent of the second one.
dim parent, child, button, modifier
NewScene
CreatePrim "Cone", "MeshSurface"
CreatePrim "Cylinder", "MeshSurface"
Translate , -0.118156772275078, -5.87851913444323, 0.587851913444323, _
siRelative, siView, siObj, siXYZ
DeselectAll
PickObject "Select parent", "Select parent", parent, button
if button <> 0 then
PickObject "Select child", "Select child", child, button, modifier
if button <> 0 then
if modifier = 0 then
ParentObj parent, child
logMessage "object " & parent & " is now parent of object " & child
else
ParentObj child, parent
logMessage "object " & child & " is now parent of object " & parent
end if
end if
end if
SOFTIMAGE|XSI v6.01