Set up Vicon stream device via Python

576 views Asked by At

I'd like to use python to setup a Vicon streaming device in Motionbuilder 2017.

Vicon Stream Device | Download Page

from pyfbsdk import*

app = FBApplication()
scene = FBSystem().Scene

# Find the device
viconStreamingDevice = FBCreateObject( 'Browsing/Templates/Devices','Vicon Stream Device', "Vicon Stream Device")

# Import the device to the current file
scene.Devices.append(viconStreamingDevice)

# Execute the Device?
# ...

When I click\drag the device into my scene from the asset browser it works correctly. If I use the python script above, the device appears in the scene but doesn't work properly. The images below show what the navigator looks like when I select the device.

Vicon Stream Device | Click\Drag Into Scene

Vicon Stream Device | Python Script

Device information is missing and "model binding:" is greyed out. In addition the scene becomes very fragile and will crash soon after running the script.

What's the difference between click\dragging and using the python script above? Is there a way to import the Vicon Streaming Device to Motionbuilder using python?


Answer Info Below ( Based on Paul Boots Suggestion )

I ended up initializing the device manually and connecting it to a Vicon Shogun session I had open. I set the device offline and saved the file. Below is the code I used in my script to merge the device into the required scenes.

viconStreamDevice = r"D:\ViconStreamDevice.fbx"
MOptions = FBFbxOptions( True, viconStreamDevice )
app.FileMerge( viconStreamDevice, False, MOptions )
1

There are 1 answers

2
Paul Boots On BEST ANSWER

I had similar issues with adding devices in a c++ tool. My work around was to create a template file containing my device and open that from the c++ code. You can try same trick using python.