Vicon Stream Device - Change Server Address - Python

Vicon Stream Device - Change Server Address - Python

maxime-picot
Contributor Contributor
941 Views
4 Replies
Message 1 of 5

Vicon Stream Device - Change Server Address - Python

maxime-picot
Contributor
Contributor

Hello everyone !

 

I would like to modify the "Server Address" value of my vicon stream device (of type "ViconSimpleDeviceOptical") in python.

However, I cannot access this value, I cannot find it anywhere, not even in the property list of the device. Is there a way to access and modify this value?

 

maximepicot_0-1722436501173.png

 

Thanks ! : )

0 Likes
Accepted solutions (2)
942 Views
4 Replies
Replies (4)
Message 2 of 5

damian.pajda
Advocate
Advocate
Accepted solution

those settings are saved in txt file

Documents\MB\[mobu version]\config\[PC_Name].ViconOpticalDevice.txt

 

so maybe some workaround could be modifing this file by python and recreating the device.

 

damianpajda_0-1722462223119.png

 

Message 3 of 5

maxime-picot
Contributor
Contributor

Oh nice thanks you, that help a lot !

 

Currently, I'm merging a scene that already containt this device, because I don't know how to import it from python.

Do you know how to do it ?

 

0 Likes
Message 4 of 5

damian.pajda
Advocate
Advocate
Accepted solution

I just tested it on mobu 2020  and looks like my suggestion is wrong :(.

This code is creating device, but it doesn't get values from that config file:

viconStreamDevice = FBCreateObject( 'Browsing/Templates/Devices', 'Vicon Stream Device', 'Vicon Stream Device' )
FBSystem().Scene.Devices.append( viconStreamDevice )

Getting proper settings from file works only when device is dragged from browser.

I don't have experience in using devices by python...

Quick research on internet shows that others also have similar issue and your solution with merging fbx file is working: https://stackoverflow.com/questions/50497136/set-up-vicon-stream-device-via-python

BTW. there was some update of device functions in Mobu 2023, they even added some sample script showing how to setup Vicon Device. But I haven't tested it yet. If you have Mobu 2023 or later, maybe it would work.

https://help.autodesk.com/view/MOBPRO/2024/ENU/?guid=MotionBuilder_SDK_py_ref_classpyfbsdk_1_1_f_b_d...

# This example shows how to create a Vicon Stream Device (a third-party device), initialize it and add it to the scene:
 
# Create the Vicon Stream Device
viconStreamDevice = FBCreateObject( 'Browsing/Templates/Devices', 'Vicon Stream Device', 'Vicon Stream Device' )
 
if viconStreamDevice:
    # Initialize the device
    viconStreamDevice.DeviceOperation( kDeviceOperations.kOpInit )
 
    # Import the device to the current file
    FBSystem().Scene.Devices.append( viconStreamDevice )
 
    print( 'Vicon Stream Device initialized and added to the scene' )
else:
    print( 'Vicon Stream Device not found' )

 

0 Likes
Message 5 of 5

maxime-picot
Contributor
Contributor

It works for me, thanks you very much !