Python command to set WebInterface Preferences Port Number

Python command to set WebInterface Preferences Port Number

Shawn_Collins-Lopez
Enthusiast Enthusiast
1,218 Views
13 Replies
Message 1 of 14

Python command to set WebInterface Preferences Port Number

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Hi, Looking for a Python command to simply change the WebInterface Port Number from 8888.

 

https://help.autodesk.com/view/VREDPRODUCTS/2022/ENU/?guid=VRED_Python_Documentation_Python_Examples...

These two example scripts did not work:

# start host on port 1040startVredServer(1040)
# listen to host on localhost, port 1040
# server ip address or hostname and port number.startVredClient("localhost", 1040)

The Python Documentation does not list a code for this!

https://knowledge.autodesk.com/support/vred-products/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU...

 

Thank you,

Shawn

0 Likes
Accepted solutions (1)
1,219 Views
13 Replies
Replies (13)
Message 2 of 14

Christian_Garimberti
Advisor
Advisor

Hi, i tried the the two sample and they are working...

but maybe they are not what you want... they start the connector on a server and on a client, using the specified port.

If you want to only change the webinterface port maybe you can start Vred with the -wport option

"C:\Program Files\Autodesk\VREDPro-14.0\bin\WIN64\VREDPro.exe" -wport 1040

here https://knowledge.autodesk.com/support/vred-products/learn-explore/caas/sfdcarticles/sfdcarticles/VR... are other command line options.

I don't know if it is possible to dynamically change the port once Vred is already opened via python

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
Message 3 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Hi Chris,  Thank you for the help.  Yes I just want  to change the Port with Python when VRED loads.

I tested your launch string: "C:\Program Files\Autodesk\VREDPro-14.0\bin\WIN64\VREDPro.exe" -wport 1040

No luck no port change still 8888

 

I tried: -wport 1040

No luck just errors

Unable to convert:-wport 1040

File "<string>", line 1

-wport 1040

^

SyntaxError: invalid syntax

 

Thank you for the help!

 

0 Likes
Message 4 of 14

chr33z
Advocate
Advocate

Hi,

 

please try

"C:\Program Files\Autodesk\VREDPro-14.0\bin\WIN64\VREDPro.exe" -wport "1040"

with the port in "quotes". VRED expects the port argument passed as a string instead of an integer .

 

Cheers!

0 Likes
Message 5 of 14

Christian_Garimberti
Advisor
Advisor

if you use -wport option in the start commandline, don't check the preferences... it remains 8888, but Vred is working on the specified port

Note... in the preferences you should leave the webserver option ON.

Immagine 2021-04-29 091759.png

 

About the errors... when you see them and where?

 

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
Message 6 of 14

chr33z
Advocate
Advocate

Sorry! I was wrong...

 

I was instead successfull with this command line option:

"C:\Program Files\Autodesk\VREDPro-14.0\bin\WIN64\VREDPro.exe" -wport=1040

 

0 Likes
Message 7 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Hi, None of the commands change the port on startup for me.  I'm in the Enterprise system and build so the VRED Preferences always overwrite the port back to the last saved.

 

If not possible to do it dynamically with Python than I will abandon this effort and continue the manually changing of the Port on each VRED session.

 

Thank you for your help!

Shawn

0 Likes
Message 8 of 14

sinje_thiedemann
Autodesk
Autodesk
Accepted solution

Hi Shawn,

not sure if this works in your enterprise environment, but here is an alternative to the command line.

Create a shortcut for VREDPro.exe, and modify it like this (append  -wport=1040 to Target)

image.png

 

This changes the port during startup. Also passing the webserver port to VRED on startup automatically enables the web server, regardless of if it is disabled in the Preferences.

But you said you need to be able to switch the ports with Python dynamically during runtime? This is currently not possible.

 

Kind regards

Sinje

0 Likes
Message 9 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Thank you Sinje! 

The goal was a Python script solution but thank you for confirming it cannot be done in VRED. 

 

Within our Enterprise environment the modified Target Shortcut would need to be tested.  We have the need to change ports on 50+ computers so this solution might not work for us.

 

Thank you,

Shawn

0 Likes
Message 10 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Hi Sinje, 

 

Did a quick test and the append  -wport=1040 to Target did not work in our Enterprise environment.  The user preferences seems to overwrite any port change at startup.

 

Thank you,

Shawn

0 Likes
Message 11 of 14

sinje_thiedemann
Autodesk
Autodesk

It is a bit unexpected to me that it does not work.

Sorry for the potential stupid questions, but I'd like to make two things sure:

1. that you have started VRED through the modified shortcut

2. How do you check which port is used? See also Chris' message above: https://forums.autodesk.com/t5/vred-forum/python-command-to-set-webinterface-preferences-port-number...

Thanks

Sinje

0 Likes
Message 12 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Hi Sinje,

 

1. that you have started VRED through the modified shortcut

Yes I tested starting through the modified shortcut...

"C:\Program Files\Autodesk\VREDPro-13.2\bin\WIN64\VREDPro.exe" -wport=1040

2. How do you check which port is used? 

Open Preference - Webinterface - Port is 8888. 

As I mentioned before if I change the port in Webinterface shutdown VRED reload it the new Port number sticks.  Its in the saved preferences from my use.  The new shortcut seems to not be able to override the VRED preferences on startup.  Anyway I need a dynamic Python solution.

 

Thank you,

Shawn

0 Likes
Message 13 of 14

sinje_thiedemann
Autodesk
Autodesk

Hi Shawn,

 

2. How do you check which port is used? 

Open Preference - Webinterface - Port is 8888. 

 

Ok, that is what Chris explained in his post above. The number shown in the Preferences GUI does not change by this. It just shows what is in the Preferences (and that is still 8888). The web server however is started on 1040.

0 Likes
Message 14 of 14

Shawn_Collins-Lopez
Enthusiast
Enthusiast

Ok thank you for the clarification.  If I cant verify the port in VRED I will not be able to use the feature.  Running many sessions of VRED at one time need to know who is which port after loaded...

0 Likes