Open a vpb file from a script

Open a vpb file from a script

leonardo.k
Advocate Advocate
639 Views
5 Replies
Message 1 of 6

Open a vpb file from a script

leonardo.k
Advocate
Advocate

Hey guys, need a little help here.

I have a lot os files sometimes to open, and I wonder if is possible to make a VSET with some script that I can open this files.

I try with getOpen but this way Vred open the File>Open Menu, and I need to open the vpb files direct from script.

Can anyone help me on that?

0 Likes
Accepted solutions (1)
640 Views
5 Replies
Replies (5)
Message 2 of 6

__daniel.lincoln__
Autodesk
Autodesk
Accepted solution
vrFileIOService.loadFile('C:/ProgramData/Autodesk/VREDPro-16.0/examples/Automotive_Genesis.vpb')
0 Likes
Message 3 of 6

leonardo.k
Advocate
Advocate
Nice!! many thanks!!!!!
Message 4 of 6

leonardo.k
Advocate
Advocate
This works, but the file is open inside the one that I already using, there is a way to close the open file and then open the next one?
0 Likes
Message 5 of 6

__daniel.lincoln__
Autodesk
Autodesk

Hi,

 

This should do what you asked, but it sounds like you may need to setup some type of batch process.

import subprocess
subprocess.Popen(["C:/Program Files/Autodesk/VREDPro-16.0/bin/WIN64/VREDPro.exe", "C:/ProgramData/Autodesk/VREDPro-16.0/examples/Automotive_Genesis.vpb"])
terminateVred()

There are some batch processing examples here:

https://help.autodesk.com/view/VREDPRODUCTS/2024/ENU/?guid=VRED_Tutorials_VREDCore_Tutorials

 

Regards,

Dan

 

0 Likes
Message 6 of 6

Christian_Garimberti
Advisor
Advisor

You can try using a vrFileIOService.newScene() before to load your file.

 

or using the V1 Api

vrFileIO.load(filename, filenames, parent, newFile, showImportOptions)

with newfile True should call a newScene() before to load

 

best

Chris

 

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes