Embedded instances#
This section provides an overview of how you use PyMechanical to embed an instance of Mechanical in Python.
Overview#
The Application
class provides
a Mechanical instance:
from ansys.mechanical.core import App
app = App()
ns = app.DataModel.Project.Model.AddNamedSelection()
The Application
class has access
to the global scripting entry points that are available from built-in Mechanical scripting:
ExtAPI:
Application.ExtAPI
DataModel:
Application.DataModel
Model:
Application.DataModel.Project.Model
Tree:
Application.DataModel.Tree
Graphics:
Application.ExtAPI.Graphics
Besides scripting entry points, many other types and objects are available from built-in Mechanical scripting. To learn how to import scripting entry points, namespaces, and types, see Globals.
Additional configuration#
By default, an instance of the Application
class
is configured in the same way as Mechanical. To customize an instance, see
Configuration.