Launch a local session#
If Ansys 2024 R1 or later and PyAnsys Geometry are installed, you can create a local backend session using Discovery, SpaceClaim, or the Geometry service. Once the backend is running, PyAnsys Geometry can manage the connection.
To launch and establish a connection to the service, open Python and use the following commands for either Discovery, SpaceClaim, or the Geometry service.
from ansys.geometry.core import launch_modeler_with_discovery
modeler = launch_modeler_with_discovery()
from ansys.geometry.core import launch_modeler_with_spaceclaim
modeler = launch_modeler_with_spaceclaim()
from ansys.geometry.core import launch_modeler_with_geometry_service
modeler = launch_modeler_with_geometry_service()
When launching via Geometry Service, if you have a custom local install, you can define the path of this install in the ANSYS_GEOMETRY_SERVICE_ROOT environment variable. In that case, the launcher uses this location by default.
$env:ANSYS_GEOMETRY_SERVICE_ROOT="C:\Program Files\ANSYS Inc\v252\GeometryService"
# or
$env:ANSYS_GEOMETRY_SERVICE_ROOT="C:\myCustomPath\CoreGeometryService"
SET ANSYS_GEOMETRY_SERVICE_ROOT="C:\Program Files\ANSYS Inc\v252\GeometryService"
# or
SET ANSYS_GEOMETRY_SERVICE_ROOT="C:\myCustomPath\CoreGeometryService"
export ANSYS_GEOMETRY_SERVICE_ROOT=/my_path/to/core_geometry_service
For more information on the arguments accepted by the launcher methods, see their API documentation:
Note
Because this is the first release of the Geometry service, you cannot yet define a product version or API version.