Skip to content

Allow multiple additive server connections #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
additional_dependencies: [tomli==2.0.1]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This code shows how to import PyAdditive and use some basic capabilities:

input = pyadditive.SingleBeadInput(
machine=pyadditive.AdditiveMachine(),
material=additive.get_material("Ti64"),
material=additive.material("Ti64"),
id="bead1",
bead_length=0.001, # meters
)
Expand Down
10 changes: 5 additions & 5 deletions examples/00_additive_single_bead.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,24 @@
# ---------------------------------
# Get server connection information using the :meth:`about <Additive.about>` method.

print(additive.about())
additive.about()

###############################################################################
# Select material
# ---------------
# Select a material. You can use the
# :meth:`get_materials_list() <ansys.additive.core.additive.Additive.get_materials_list>`
# :meth:`materials_list() <ansys.additive.core.additive.Additive.materials_list>`
# method to obtain a list of available materials.

print(additive.get_materials_list())
additive.materials_list()

###############################################################################
# You can obtain the parameters for a single material by passing a name
# from the materials list to the
# :meth:`get_material() <ansys.additive.core.additive.Additive.get_material>`
# :meth:`material() <ansys.additive.core.additive.Additive.material>`
# method.

material = additive.get_material("17-4PH")
material = additive.material("17-4PH")

###############################################################################
# Specify machine parameters
Expand Down
8 changes: 4 additions & 4 deletions examples/01_additive_porosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
# Select material
# ---------------
# Select a material. You can use the
# :meth:`get_materials_list() <ansys.additive.core.additive.Additive.get_materials_list>`
# :meth:`materials_list() <ansys.additive.core.additive.Additive.materials_list>`
# method to obtain a list of available materials.

print(additive.get_materials_list())
additive.materials_list()

###############################################################################
# You can obtain the parameters for a single material by passing a name
# from the materials list to the
# :meth:`get_material() <ansys.additive.core.additive.Additive.get_material>`
# :meth:`material() <ansys.additive.core.additive.Additive.material>`
# method.

material = additive.get_material("316L")
material = additive.material("316L")

###############################################################################
# Specify machine parameters
Expand Down
8 changes: 4 additions & 4 deletions examples/02_additive_microstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@
# Select material
# ---------------
# Select a material. You can use the
# :meth:`get_materials_list() <ansys.additive.core.additive.Additive.get_materials_list>`
# :meth:`materials_list() <ansys.additive.core.additive.Additive.materials_list>`
# method to obtain a list of available materials.

print(additive.get_materials_list())
additive.materials_list()

###############################################################################
# You can obtain the parameters for a single material by passing a name
# from the materials list to the
# :meth:`get_material() <ansys.additive.core.additive.Additive.get_material>`
# :meth:`material() <ansys.additive.core.additive.Additive.material>`
# method.

material = additive.get_material("17-4PH")
material = additive.material("17-4PH")

###############################################################################
# Specify machine parameters
Expand Down
8 changes: 4 additions & 4 deletions examples/03_additive_thermal_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@
# Select material
# ---------------
# Select a material. You can use the
# :meth:`get_materials_list() <ansys.additive.additive.Additive.get_materials_list>`
# :meth:`materials_list() <ansys.additive.additive.Additive.materials_list>`
# method to obtain a list of available materials.

print(additive.get_materials_list())
additive.materials_list()

###############################################################################
# You can obtain the parameters for a single material by passing a name
# from the materials list to the
# :meth:`get_material() <ansys.additive.additive.Additive.get_material>`
# :meth:`material() <ansys.additive.additive.Additive.material>`
# method.

material = additive.get_material("17-4PH")
material = additive.material("17-4PH")

###############################################################################
# Specify machine parameters
Expand Down
2 changes: 1 addition & 1 deletion examples/11_advanced_parametric_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# and print a list of available materials prior to selecting one.

additive = Additive()
print(additive.get_materials_list())
additive.materials_list()
material = "IN718"

###############################################################################
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
[project]
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
name = "ansys-additive-core"
version = "0.16.dev2"
version = "0.16.dev3"
description = "A python client for the Ansys Additive service"
readme = "README.rst"
requires-python = ">=3.9,<4"
Expand Down Expand Up @@ -64,7 +64,6 @@ tests = [
# Test specific dependencies
"pytest==7.4.2",
"pytest-cov==4.0.0",
"callee==0.3.1",
]

doc = [
Expand Down Expand Up @@ -122,7 +121,7 @@ show_missing = true

[tool.pytest.ini_options]
minversion = "7.1"
addopts = "-ra --cov=ansys.additive.core --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv --cov-fail-under 90"
addopts = "-ra --cov=ansys.additive.core --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv --cov-fail-under 96"
testpaths = ["tests"]
filterwarnings = ["ignore:::.*protoc_gen_swagger*"]

Expand Down
11 changes: 2 additions & 9 deletions src/ansys/additive/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@

__version__ = importlib_metadata.version(__name__.replace(".", "-"))

APP_NAME = "ansys-pyadditive"
APP_NAME = "pyadditive"
COMPANY_NAME = "Ansys Inc"


# Setup data directory
USER_DATA_PATH = platformdirs.user_data_dir(APP_NAME, COMPANY_NAME)
if not os.path.exists(USER_DATA_PATH): # pragma: no cover
Expand All @@ -44,12 +43,7 @@
if not os.path.exists(EXAMPLES_PATH): # pragma: no cover
os.makedirs(EXAMPLES_PATH)

from ansys.additive.core.additive import (
DEFAULT_ADDITIVE_SERVICE_PORT,
LOCALHOST,
MAX_MESSAGE_LENGTH,
Additive,
)
from ansys.additive.core.additive import Additive
from ansys.additive.core.geometry_file import BuildFile, MachineType, StlFile
from ansys.additive.core.machine import AdditiveMachine, MachineConstants
from ansys.additive.core.material import (
Expand All @@ -64,7 +58,6 @@
MicrostructureSummary,
)
from ansys.additive.core.porosity import PorosityInput, PorositySummary
from ansys.additive.core.server_utils import find_open_port, launch_server
from ansys.additive.core.simulation import SimulationError, SimulationStatus, SimulationType
from ansys.additive.core.single_bead import (
MeltPool,
Expand Down
Loading