Skip to content

Commit 55228e1

Browse files
franknlipyansys-ci-botPipKat
authored
fix some doc mistakes (#91)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Kathy Pippert <[email protected]>
1 parent bdf0e46 commit 55228e1

File tree

6 files changed

+52
-39
lines changed

6 files changed

+52
-39
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix some doc mistakes

doc/source/getting-started/connection.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,27 @@ Workbench. Different options exist, including local and remote connections.
77
Local connection
88
================
99

10-
You can connect PyWorkbench to a local connection of Ansys Workbench by running
10+
You can connect PyWorkbench to a local session of Ansys Workbench by running
1111
the following steps:
1212

1313
1. Start Ansys Workbench
1414
2. In the Workbench Command Window, type ``StartServer()``
1515
3. Take a note of the returned port number
16-
4. Use previous port number to connect PyWorkbench to the server
16+
4. Use the port number to connect PyWorkbench to the server:
17+
18+
.. code-block:: python
19+
20+
from ansys.workbench.core import connect_workbench
21+
22+
workbench = connect_workbench(port=port)
1723
1824
Remote connection
1925
=================
26+
You can connect PyWorkbench to an Ansys Workbench session running on a remote
27+
computer by giving its computer name or IP and the port number that the service uses:
28+
29+
.. code-block:: python
30+
31+
from ansys.workbench.core import connect_workbench
32+
33+
workbench = connect_workbench(host=host_name_or_IP, port=port)

doc/source/user-guide.rst

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,35 @@ Start Workbench client and connect to a running Workbench server
1010
To start a Workbench client that connects to a running Workbench server on the cloud, you
1111
must 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

2828
Launch Workbench server and start a client
2929
==========================================
3030

3131
During the development phase or when debugging, it is useful to start the
3232
Workbench 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,
3636
like in the preceding example.
3737

3838
Alternatively, you can launch a Workbench server and start a client programmatically in a
3939
client-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

7877
You 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
8685
all 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
106105
You can upload and download data files to and from the server using the ``upload_file()`` and ``download_file``
107106
methods. The client-side working directory is used to hold these files unless absolute paths or target directories
108107
are 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
157155
directly 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

174172
PyMechanical

src/ansys/workbench/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
"""PyWorkbench client in Python: ansys-workbench-core."""
23+
"""PyWorkbench Python client."""
2424

2525
import importlib.metadata as importlib_metadata
2626

src/ansys/workbench/core/public_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
"""Module for launching a Workbench server on a local or remote Windows machine."""
23+
"""Module for starting PyWorkbench."""
2424

2525
import logging
2626
import os
@@ -263,7 +263,7 @@ def launch_workbench(
263263
264264
Parameters
265265
----------
266-
release : str, default: "242"
266+
release : str, default: "251"
267267
Workbench release to launch.
268268
client_workdir : str, default: None
269269
Path to a writable directory on the client computer. The default is ``None``,
@@ -283,7 +283,7 @@ def launch_workbench(
283283
284284
Returns
285285
-------
286-
ClientWrapper
286+
WorkbenchClient
287287
Instance of the PyWorkbench client that is connected to the launched server.
288288
289289
Examples
@@ -312,7 +312,7 @@ def connect_workbench(port, client_workdir=None, host=None):
312312
313313
Returns
314314
-------
315-
ClientWrapper
315+
WorkbenchClient
316316
Instance of the PyWorkbench client that is connected to the server.
317317
318318
Examples

src/ansys/workbench/core/workbench_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040
class WorkbenchClient:
41-
"""Provides the PyWorkbench client.
41+
"""Functions of a PyWorkbench client.
4242
4343
Parameters
4444
----------
@@ -109,7 +109,7 @@ def set_console_log_level(self, log_level):
109109
def set_log_file(self, log_file):
110110
"""Set a local log file for the Workbench server log.
111111
112-
Create a locl log file if one does not exist and append it to the existing log file.
112+
Create a local log file if one does not exist and append it to the existing log file.
113113
114114
Parameters
115115
----------
@@ -136,7 +136,7 @@ def reset_log_file(self):
136136
__log_console_handler = None
137137

138138
def run_script_string(self, script_string, log_level="error"):
139-
"""Run a script on the server.
139+
"""Run a script as given in the input string on the server.
140140
141141
Parameters
142142
----------
@@ -183,7 +183,7 @@ def run_script_file(self, script_file_name, log_level="error"):
183183
Parameters
184184
----------
185185
script_file_name : str
186-
Name of the script file to run. The script file is located in the client
186+
Name of the script file to run. The script file should be located in the client
187187
working directory
188188
log_level : str, default: "error"
189189
Level of logging. Options are "critical" "debug", "error", "info", and "warning".
@@ -214,7 +214,7 @@ def upload_file(self, *file_list, show_progress=True):
214214
Returns
215215
-------
216216
list[str]
217-
Names of the uploaded file.
217+
Names of the uploaded files.
218218
"""
219219
if not self._is_connected():
220220
logging.error("Workbench client is not yet connected to a server.")
@@ -311,7 +311,7 @@ def download_file(self, file_name, show_progress=True, target_dir=None):
311311
Returns
312312
-------
313313
str
314-
Names of the one or more downloaded files.
314+
Name of the downloaded file.
315315
"""
316316
if not self._is_connected():
317317
logging.error("Workbench client is not yet connected to a server.")
@@ -439,7 +439,7 @@ def start_mechanical_server(self, system_name):
439439
Returns
440440
-------
441441
int
442-
Port number of the PyMechanical server used to start the PyMechanical client.
442+
Port of the PyMechanical server to use to start the PyMechanical client.
443443
444444
Examples
445445
--------
@@ -504,7 +504,7 @@ def start_sherlock_server(self, system_name):
504504
Returns
505505
-------
506506
int
507-
Prt number of the PySherlock server used to start a PySherlock client.
507+
Port of the PySherlock server to use to start a PySherlock client.
508508
509509
Examples
510510
--------

0 commit comments

Comments
 (0)