Example #1
0
def PickPosition(inMessage="Pick Position"):
    if not inMessage:
        inMessage = "Pick Position"
    picked = XSI.PickPosition(inMessage, inMessage, None, None, None, None)
    button = picked("ButtonPressed")
    if button:
        x = picked("PosX")
        y = picked("PosY")
        z = picked("PosZ")
        outVec = XSIMath.CreateVector3(x, y, z)
        return outVec
    else:
        return None
Example #2
0
def PickPositionInVolume(inMessage="Pick Position"):
    # enable snap option
    XSI.SetValue("preferences.SnapProperties.Enable2D", True, None)
    XSI.SetValue("preferences.SnapProperties.Enable", True, None)

    if not inMessage:
        inMessage = "Pick Position"

    picked = XSI.PickPosition(inMessage, inMessage, None, None, None, None)

    button = picked("ButtonPressed")
    if button:
        x = picked("PosX")
        y = picked("PosY")
        z = picked("PosZ")
    else:
        return None
    outVec = XSIMath.CreateVector3(x, y, z)

    # disable snap option
    XSI.SetValue("preferences.SnapProperties.Enable2D", False, None)
    XSI.SetValue("preferences.SnapProperties.Enable", False, None)

    return outVec