@@ -10,36 +10,35 @@ Start Workbench client and connect to a running Workbench server
1010To start a Workbench client that connects to a running Workbench server on the cloud, you
1111must provide the following information:
1212
13- - Server name or IP address
1413- Port number
15- - Client-side working directory, which is the default location for client-side files
14+ - Server name or IP address, which is an optional parameter and when not specified, localhost is used
15+ - Client-side working directory, which is an optional parameter indicating the default location for client-side files
1616
1717.. code-block :: python
1818
19- from ansys.workbench.core.workbench_client import connect_workbench
19+ from ansys.workbench.core import connect_workbench
2020
2121 host = " server_machine_name_or_IP"
2222 port = server_port_number
2323 wb = connect_workbench(host = host, port = port)
2424
25- Other options to the ``connect_workbench() `` function include specifying a working directory for
26- the client instead of using the default directory.
25+ The `` client_workdir `` parameter for the ``connect_workbench() `` function specifies a working
26+ directory for the client instead of using the default directory.
2727
2828Launch Workbench server and start a client
2929==========================================
3030
3131During the development phase or when debugging, it is useful to start the
3232Workbench server on your desktop or some computer within the company network.
3333
34- You can always start a Workbench server by running the ``StartServer() `` function
35- in any running Workbench session. You then use the returned server port to start a client,
34+ You can always start a Workbench server by running the ``StartServer() `` command
35+ in any Workbench session. You then use the returned server port to start a client,
3636like in the preceding example.
3737
3838Alternatively, you can launch a Workbench server and start a client programmatically in a
3939client-side Python script.
4040
41- This code launches a server on a local Windows machine with
42- valid user credentials:
41+ This code launches a server on a local Windows machine:
4342
4443.. code-block :: python
4544
@@ -76,13 +75,13 @@ Run scripts on Workbench server
7675===============================
7776
7877You can use these methods to run IronPython-based Workbench scripts, which contain commands or
79- queries, on the Workbench server :
78+ queries, with PyWorkbench :
8079
8180- ``run_script_file ``: Runs a script file in the client working directory.
8281- ``run_script_string ``: Runs a script contained in the given string.
8382
84- In the ` ``wb_script_result `` global variable in the script, you can assign any output that needs
85- to be returned from these methods as a JSON string. For example, this Workbench script returns
83+ To the ``wb_script_result `` global variable in the script, you can assign any output that needs
84+ to be returned from these methods, as a JSON string. For example, this Workbench script returns
8685all message summaries from the Workbench session:
8786
8887.. code-block :: python
@@ -92,9 +91,9 @@ all message summaries from the Workbench session:
9291 messages = [m.Summary for m in GetMessages()]
9392 wb_script_result = json.dumps(messages)
9493
95- You can also call these these methods with different logging levels. While the default logging
96- level is ``error ``, this line outputs all ``info ``, ``warning ``, and ``error `` levels
97- to the logger when the script run :
94+ You can also call these methods with different logging levels. While the default logging
95+ level is ``error ``, the following example outputs all ``info ``, ``warning ``, and ``error `` levels
96+ to the logger when the script runs :
9897
9998.. code-block :: python
10099
@@ -106,10 +105,10 @@ Upload and download files
106105You can upload and download data files to and from the server using the ``upload_file() `` and ``download_file ``
107106methods. The client-side working directory is used to hold these files unless absolute paths or target directories
108107are specified. There is also a working directory on the server for the same purpose. To obtain the server’s working
109- directory, you can use the the ``GetServerWorkingDirectory() `` Workbench query that runs on the server.
108+ directory, you can use the ``GetServerWorkingDirectory() `` query in the scripts that run on the server.
110109
111- This code uploads all part files with a given prefix, all AGDB files in the working directory, and another file
112- outside of the working directory from the client to the server:
110+ This code uploads all part files of a given prefix and all AGDB files in the working directory, along with another file
111+ outside of the working directory, from the client to the server:
113112
114113.. code-block :: python
115114
@@ -123,15 +122,14 @@ newly created Workbench system:
123122 wb.run_script_string(
124123 r """ import os
125124 work_dir = GetServerWorkingDirectory( )
126- geometry_file = os. path. join( work_dir, "2pipes . agdb")
125+ geometry_file = os. path. join( work_dir, "two_pipes . agdb")
127126 template = GetTemplate( TemplateName="Static Structural", Solver="ANSYS")
128127 system = CreateSystemFromTemplate( Template=template, Name="Static Structural ( ANSYS) ")
129128 system. GetContainer( ComponentName="Geometry") . SetFile( FilePath=geometry_file)
130129 """
131130 )
132131
133- This server-side Workbench script copies a Mechanical solver output file to the server's working directory
134- for downloading later:
132+ This server-side Workbench script copies a Mechanical solver output file to the server's working directory:
135133
136134.. code-block :: python
137135
@@ -146,13 +144,13 @@ for downloading later:
146144 """
147145 )
148146
149- This client script downloads all files with OUT extensions from the server's working directory:
147+ This client script downloads all files with `` .out `` extensions from the server's working directory:
150148
151149.. code-block :: python
152150
153151 wb.download_file(" *.out" )
154152
155- There is a special client method to upload a data file from the
153+ There is a special client method to upload a data file from the Ansys
156154`example-data <https://github.com/ansys/example-data/tree/master/pyworkbench >`_ repository
157155directly to the Workbench server. You should specify the file path relative to the
158156``pyworkbench `` folder in the ``example-data `` repository:
@@ -168,7 +166,7 @@ turn off the progress bar with an optional argument:
168166
169167 wb.download_file(" solve.out" , show_progress = False )
170168
171- Start other PyAnsys services from systems in a PyWorkbench project
169+ Start other PyAnsys services for systems in a Workbench project
172170==================================================================
173171
174172PyMechanical
0 commit comments