abqpy

repository·2026·Indexed 43 days ago

https://github.com/haiiliin/abqpy

A Python package providing type hints and execution APIs for Abaqus Python scripting. It enables developers to write and validate Abaqus models in standard IDEs with autocomplete and type checking, and provides a CLI and programmatic bridge to execute scripts within the Abaqus/CAE or Abaqus Python environments.

Tokens
95.2K
Snippets
261
Records
402
Agent score
56%

What's inside abqpy

  1. What is abqpy?

    2026

    abqpy is a Python package designed to improve the experience of writing Abaqus Python scripts. It provides two primary capabilities:

    1. Type Hints: It provides type hints for the Abaqus Python scripting API. This allows you to write Abaqus scripts fluently in your favorite IDE (with autocomplete and type checking) without needing to have Abaqus open.
    2. Execution APIs: It provides simple APIs to execute Abaqus commands. This enables you to build models, submit jobs, and extract output data within a single Python script, potentially without opening Abaqus/CAE.
  2. Overview of abqpy

    2026

    abqpy is a Python package designed to provide type hints for Abaqus Python scripts, making it easier to write and maintain them. It also provides a simplified API to execute Abaqus commands, allowing you to create models, submit jobs, and extract output data via Python scripts without needing to manually open the Abaqus/CAE interface.

    Key Features:

    • Type hints for Abaqus/Python scripting.
    • API for model creation, job submission, and data extraction.
    • Support for Abaqus 2016 and newer.
    • Requires Python 3.8+.
  3. Overview of the Abaqus Scripting User's Guide

    2026
    The Abaqus Scripting User's Guide provides instructions for using the Python programming language and the Abaqus Scripting Interface to automate Abaqus/CAE models and analysis jobs. It also covers accessing Abaqus output databases (.odb files) via both the Python Scripting Interface and a C++ API.
  4. What is the Abaqus Scripting Interface?

    2026

    The Abaqus Scripting Interface is a Python-based API used to programmatically access Abaqus models and data. It extends the standard Python object-oriented language to provide access to Abaqus/CAE and Abaqus/Viewer functionality.

    Key capabilities include:

    • Model Manipulation: Create and modify components like parts, materials, loads, and steps.
    • Job Management: Create, modify, and submit Abaqus analysis jobs.
    • Data I/O: Read from and write to Abaqus output databases.
    • Result Visualization: View and process the results of an analysis.

    Note on Extensibility: Because the interface is a customized extension of standard Python, you cannot extend Abaqus base types to create new user-defined classes.

  5. Accessing an Output Database (ODB) via Python or C++

    2026

    You can access data in an Abaqus Output Database (ODB) using either the Abaqus Scripting Interface (Python) or the C++ Application Programming Interface (API).

    Supported operations include:

    • Reading model data, field data, and history data.
    • Writing field and history data.

    For specific command references, consult the documentation for the respective language interface.

  6. Ways to use Python with Abaqus

    2026

    Python is the standard programming language for Abaqus products and is integrated into several core workflows:

    • Environment Configuration: The Abaqus environment file utilizes Python statements.
    • Input File Parametrization: Parameter definitions on data lines within the [PARAMETER] option of an Abaqus input file are written as Python statements.
    • Parametric Studies: Executing parametric studies requires writing and running Python scripting files (.psf).
    • Command Recording: Abaqus/CAE automatically records user actions as Python commands in replay (.rpy) files.
    • Task Automation: You can automate Abaqus/CAE tasks by executing Python scripts via the main menu bar, the Macro Manager, or the Command Line Interface (CLI).
    • Data Access: Python scripts are used to programmatically access and process output databases (.odb).
  7. Use Utility and View commands in abqpy

    2026

    The abaqus.UtilityAndView class provides access to utility and view-related commands within the Abaqus environment via abqpy.

    Utility Commands

    Utility commands allow you to:

    • Create SymbolicConstant and Boolean objects.
    • Rename keys to Repository objects.
    • Manage the use of deprecated commands.
    • Request user input and display status information.
    • Execute arbitrary Python commands or functions.
    • Register callbacks for Abaqus Scripting Interface events (e.g., when commands are about to be executed or objects are about to be deleted).
    • Upgrade Abaqus kernel or GUI scripts between different Abaqus releases.

    View Commands

    View commands are used to transform three-dimensional views stored in Session and Viewport objects for display on the screen.

  8. Understand the Abaqus object model hierarchy

    2026

    The Abaqus object model extends Python with approximately 500 new object types. It is organized into three primary top-level domains:

    1. Session: Contains objects that are not saved between Abaqus/CAE sessions (e.g., viewports, remote queues, user-defined views).
    2. Mdb (Model Database): Contains objects saved in a model database that can be recovered between sessions. This includes the Model object (which contains Part, Section, Material, Step, etc.) and the Job object.
    3. Odb (Output Database): Contains both model and results data saved in an output database.

    Most Abaqus Scripting Interface commands begin with one of these three objects.

    # Accessing Session, Mdb, and Odb objects
    session.viewports["Viewport-1"].bringToFront()
    
    # Accessing Mdb objects
    mdb.models["wheel"].rootAssembly.regenerate()
    
    # Accessing Odb objects
    stress = odb.steps["Step-1"].frames[3].fieldOutputs["S"]
  9. Access History Output data

    2026

    History output is intended for frequent requests of small data portions, such as X-Y plots of a specific variable over time. Unlike field output, you can request individual variables (e.g., a single stress component).

    History output is organized into HistoryRegion objects. A HistoryRegion can be defined for:

    • A single node
    • An integration point
    • A specific region
    • The whole model

    All history requests related to a specific point or region are collected into its corresponding HistoryRegion object.

  10. Understand the Abaqus Scripting Interface object model

    2026

    The Abaqus Scripting Interface is built on object-oriented programming (OOP) principles. To interact with Abaqus via Python, you must understand the relationship between objects, constructors, methods, and members:

    • Objects: Encapsulate data and functions. Some objects are created via constructors, while others are created automatically as members of a parent object (e.g., Vertex objects are created when a Part's geometry is defined).
    • Constructors: Methods that create new objects. By convention, constructors and object types start with an uppercase character (e.g., Viewport).
    • Methods: Functions that operate on an object. By convention, methods start with a lowercase character (e.g., setValues()).
    • Members: Properties of an object (e.g., width). Members are read-only; you cannot change them using direct assignment.

    Use the Access description in the reference index to find how to access an object, and the Path description to find the correct path to a constructor.

  11. How the output database object model relates to commands

    2026

    The Abaqus output database (ODB) is structured as a hierarchy of objects. To read or write data, you must navigate this hierarchy using commands that follow the object model's structure.

    Key relationships in the hierarchy include:

    • An Odb object is the root, created when opening or creating an output database.
    • An OdbStep object is a member of the Odb object.
    • A Frame object is a member of an OdbStep object.
    • A FieldOutput object contains fieldValue and fieldLocation members.

    You access specific data by stepping through this hierarchy. For example, to access a specific frame within a step, or a specific field value within a frame, you use the object's members (often accessed via dictionary-like keys or indices).

    If you are unsure of an object's structure, you can inspect its available members using the objectname.__members__ command in the command line interface.

    # Accessing a Frame object within a specific OdbStep
    odb.steps["10 hz vibration"].frames[3]
    
    # Accessing a specific field value within a FieldOutput object
    odb.steps["10 hz vibration"].frames[3].fieldOutputs["U"].values[47]
  12. Distinguish between Constructors and Methods

    2026

    The Abaqus Scripting Interface uses specific naming conventions to distinguish between creating objects and operating on them:

    • Constructors: Methods that create a new object. They begin with an uppercase character (e.g., Viewport(...), FieldOutput(...)). Constructors always return the object being created.
    • Methods: Operations performed on an existing object. They begin with a lowercase character (e.g., makeCurrent(), getSubset()).

    If a documentation entry provides a Path, it is typically a constructor path showing how to instantiate that object.