API (Application Programming Interface) integration using AutoPIPE


Beginning with AutoPIPE version 25.00.00.xx, a new functionality has been introduced, API, that enables the manipulation of AutoPIPE's database DAT file using an application called Python. 

Python is a high-level, interpreted programming language known for its simplicity, readability, versatility. It was first released in 1991 and is wildly used in web development, data analysis, AI, scientific computing, and more. Python is open sourced, thus there is no licensing issues. Multiple versions of the application can be installed simultaneously. 

Getting Started:

To get started with this exciting feature, open filename: index.html located on your computer: 

Be sure to use this HTML file for all documentation related to the API feature including installation and command details (see "Topic covered in the Indec.html file" section below).

Note:

    1. ***Important*** - Add new system Variable as mentioned in the Getting Started tab of the index.html page.

Protect Against Data Loss

Currently, overwriting is prohibited, and the API always writes to a new file. This precaution is taken because saving through the API might result in potential data loss due to unsupported data. It’s always advisable to take a backup of your model.

Supported Models

The API natively supports AutoPIPE models created with the same version of AutoPIPE. If the API version is 25.0.0.x , it supports models that were last modified with AutoPIPE 25.0.0.x. Additionally, the API also supports opening models created with older versions of AutoPIPE, if a compatible version of AutoPIPE (same major version as the API) is installed on the system.

Models that were last modified in a newer version of AutoPIPE are not supported. For example, Models that were last modified in AutoPIPE version 25.0.0.x cannot be opened using API version 24.0.0.x.

Disclaimer

Currently, overwriting is prohibited, and the API always writes to a new file. This precaution is taken because saving through the API might result in potential data loss due to unsupported data. It’s always advisable to take a backup of your model.

Prerequisite

Python 3.12.xx (xx = 03 to 10) 

Notes:

        1. Do not use and other version of python, must use version 3.12.xx (xx = 03 to 10) 
        2. Python 3.12.xx End of support according to Python.org - 2028-10 (https://www.python.org/downloads/)

Environment: 

A Python development environment is a setup that includes all the tools and configurations needed to write , test, and debug Python code efficiently. Here sare the key components and reasons why they are important

    1. Python Interpreter - Python program itself. The core component that executes the Python code.
    2. Integrated Development Environment (IDE) or Text Editor - (ex. PyCharm, VS Code, Jupyter Notebook) Syntax highlighting, code completion, debugging tool
    3. Package Manager - (ex. pip or conda) - help manage libraries project has all the necessary packages
    4. Virtual Environment - (ex. venv, virtualenv) creates isolated environment for projects, preventing conflicts between dependencies of different projects. 
    5. Version Control System - (ex. Git) commonly used to track changes in your code, collaborate with other, and manage different versions of the project

Examples

Open the Example folder located at "C:\Program Files\Bentley\AutoPIPE xxxx\DataAPI\Example Scripts" to discover a collection of example scripts designed to enhance your understanding of coding basic scenarios.

      1. adding_components.py - adding pipe property, segment, valve, 
      2. batch_update_supports.py - change all Spring Supports to V-Stop
      3. class1_tutorial.py - recreate AutoPIPE example model class1_tutorial.dat
      4. create_template.py - create a template to be used when starting a model. Read info from excel file: general model options, pipe properties. 
      5. search_and_report.py - search for all DAT files in a folder, extract number of supports, and reports model name and number of support in python terminal. 
      6. search_components.py - search for all DAT files in a folder, extract all flange data, and add into an excel report. 
      7. template_data.xlsx - Excel file of information used for create_template.py
      8. total_surface_area.py -  calculate and report total curved surface area of straight runs
      9. walkthru.py - recreate AutoPIPE example model walkthru.dat

Topics covered in the index.html file:

 

See Also

Known issue when using API

Bentley AutoPIPE