A Python client for Ansys Composite PrepPost (ACP).
Note
PyACP requires Ansys 2024 R2 to run. Unless you have advance access to the Ansys 2024 R2 release, you will not be able to use PyACP until the release is publicly available.
Install PyACP with:
pip install ansys-acp-core
For installing PyACP in development mode, see the Development Setup instructions below.
The PyACP documentation can be viewed online at https://acp.docs.pyansys.com.
The ACP server can be started with launch_acp
:
Once the server is running, we can start working with PyACP. For example, to load an ACP Model from an existing file:
>>> remote_filename = acp.upload_file(local_path="<MODEL_PATH>")
>>> model = acp.import_model(path=remote_filename)
>>> model.name
'ACP Model'
Installing PyACP in developer mode allows you to modify the source and enhance it. Before contributing to the project, please refer to the PyAnsys Developer's guide.
You will need to follow these steps:
-
Start by cloning this repository, and entering the newly created directory:
-
Make sure you have the latest version of poetry:
Note
At this point, you may need to restart your shell or editor to ensure that the new
poetry
command is available. -
Install the project and all its development dependencies using poetry. This also takes care of creating a new virtual environment:
This step installs PyACP in an editable mode (no build step is needed, no re-install when changing the code).
-
Activate your development virtual environment with:
The PyACP test suite uses pytest. You can run it with
As part of the test suite, we run some performance benchmarks. These can be run with
Additional options can be found in the pytest-benchmark documentation.
NOTE: The benchmarks use the tc-netem
Linux kernel module to simulate a slow network connection within a Docker container. This is available only on Linux, not on Docker for MacOS or Windows.
The benchmark results from the main
branch are uploaded to https://acp.docs.pyansys.com/benchmarks.
Style and linter checks are run through the pre-commit tool. You can run these checks with
We also recommend installing pre-commit into your repository:
This will run the pre-commit hooks on the changed files before every git commit
. If you ever need to create a commit without running the hooks, you can skip them with git commit -n
.
Before generating the documentation, configure the PyACP server via the ansys-launcher
, see Launching ACP above. If Ansys is installed the examples can directly built with Sphinx.
On Linux & MacOS:
On Windows:
cd doc; .\make.bat html
The generated HTML files can be viewed with the browser of your choice.
Alternatively you can build the documentation by starting a mapdl and pydpf-composites docker container. First ensure that you have accepted the DPF Preview License Agreement by setting the ANSYS_DPF_ACCEPT_LA environment variable to Y (see DPF Preview License Agreement ). In addition the ANSYSLMD_LICENSE_FILE environment variable needs be set to a valid license server (e.g 1055@mylicenseserver.com
). Then start the docker containers with:
Then build the documentation with the Sphinx commands mentioned above.
The following commands can be used to build and check the PyACP package:
This creates both a source distribution, and a wheel file. An alternative is
PyACP
is licensed under the MIT license. Please see the LICENSE for more details.