Table of Contents

ideastatica-connection-api

The Python package for the Connection Rest API 2.0

  • API version: 2.0
  • Package version: 25.0.4.0896

IDEA StatiCa Connection API, used for the automated design and calculation of steel connections.

Requirements.

Python 3.7+

Installation

pip install

We recommend using pip to install the package into your environment.

pip install ideastatica_connection_api

Then import the package in your project:

import ideastatica_connection_api

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Usage

ClientApiClientFactory manages creation of clients on the running service. We currently only support connecting to a service running on a localhost (eg. 'http://localhost:5000/').

To start the service, manually navigate to the "C:\Program Files\IDEA StatiCa\StatiCa 25.0" folder. Using CLI:

IdeaStatiCa.ConnectionRestApi.exe -port:5193

Parameter -port: is optional. The default port is 5000.

# Connect any new service to latest version of IDEA StatiCa.
client_factory = ConnectionApiClientFactory('http://localhost:5000/')
conClient = client_factory.create_connection_api_client();

Alternatively, you can leverage the ConnectionApiServiceAttacher. ConnectionApiServiceAttacher manages the creation of client instances that connect to an already running service:

import logging
import sys
import os
import json
from pprint import pprint
from urllib.parse import urljoin

# Get the parent directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))

# Add the parent directory to sys.path
sys.path.append(parent_dir)

import ideastatica_connection_api
import ideastatica_connection_api.connection_api_service_attacher as connection_api_service_attacher

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

baseUrl = "http://localhost:5000"

dir_path = os.path.dirname(os.path.realpath(__file__))
project_file_path = os.path.join(dir_path, '..\projects', 'HSS_norm_cond.ideaCon')
print(project_file_path)


# Create client attached to already running service
with connection_api_service_attacher.ConnectionApiServiceAttacher(baseUrl).create_api_client() as api_client:
    try:
        # Open project
        uploadRes = api_client.project.open_project_from_filepath(project_file_path)

        # Get the project data
        project_data = api_client.project.get_project_data(api_client.project.active_project_id)
        pprint(project_data)

        # Get list of all connections in the project
        connections_in_project = api_client.connection.get_connections(api_client.project.active_project_id)

        # first connection in the project 
        connection1 = connections_in_project[0]
        pprint(connection1)

        # run stress-strain CBFEM analysis for the connection id = 1
        calcParams = ideastatica_connection_api.ConCalculationParameter() # ConCalculationParameter | List of connections to calculate and a type of CBFEM analysis (optional)
        calcParams.connection_ids = [connection1.id]

        # run stress-strain analysis for the connection
        con1_cbfem_results = api_client.calculation.calculate(api_client.project.active_project_id, calcParams)
        pprint(con1_cbfem_results)
        
        # get detailed results. Results are list of strings
        # the number of strings in the list correspond to the number of calculated connections
        results_text = api_client.calculation.get_raw_json_results(api_client.project.active_project_id, calcParams)
        firstConnectionResult = results_text[0]
        pprint(firstConnectionResult)

        raw_results = json.loads(firstConnectionResult)
        pprint(raw_results)

        detailed_results = api_client.calculation.get_results(api_client.project.active_project_id, calcParams)
        pprint(detailed_results)

        # get connection setup
        connection_setup =  api_client.project.get_setup(api_client.project.active_project_id)
        pprint(connection_setup)

        # modify setup
        connection_setup.hss_limit_plastic_strain = 0.02
        modifiedSetup = api_client.project.update_setup(api_client.project.active_project_id, connection_setup)

        # recalculate connection
        recalculate_results = api_client.calculation.calculate(api_client.project.active_project_id, calcParams)
        pprint(recalculate_results)

    except Exception as e:
        print("Operation failed : %s\n" % e)

Getting Started

Please follow the installation procedure and then run the following:

Documentation for API Endpoints

The ConnectionApiClient wraps all API endpoing controllers into object based or action baseds API endpoints.

Methods marked with an ^ denote that they have an additional extension in the Client.

CalculationApi

Method Description
calculate Run CBFEM caluclation and return the summary of the results
get_raw_json_results Get json string which represents raw CBFEM results (an instance of CheckResultsData)
get_results Get detailed results of the CBFEM analysis

ClientApi

Method Description
connect_client Connect a client to the ConnectionRestApi service. Method returns a unique identifier of the client.
get_version Get the IdeaStatica version

ConnectionApi

Method Description
get_connection Get data about a specific connection in the project
get_connections Get data about all connections in the project
get_production_cost Get production cost of the connection
update_connection Update data of a specific connection in the project

ConversionApi

Method Description
change_code Change design code of project.
get_conversion_mapping Get default conversions for converting the project to different design code.

ExportApi

Method Description
export_ifc^ Export connection to IFC format
export_iom Export connection to XML which includes https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs
export_iom_connection_data Get https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Connection/ConnectionData.cs for required connection

LoadEffectApi

Method Description
add_load_effect Add new load effect to the connection
delete_load_effect Delete load effect loadEffectId
get_load_effect Get load impulses from loadEffectId
get_load_effects Get all load effects which are defined in connectionId
get_load_settings Get Load settings for connection in project
set_load_settings Set Load settings for connection in project
update_load_effect Update load impulses in conLoading

MaterialApi

Method Description
add_bolt_assembly Add bolt assembly to the project
add_cross_section Add cross section to the project
add_material_bolt_grade Add material to the project
add_material_concrete Add material to the project
add_material_steel Add material to the project
add_material_weld Add material to the project
get_all_materials Get materials which are used in the project projectId
get_bolt_assemblies Get bolt assemblies which are used in the project projectId
get_bolt_grade_materials Get materials which are used in the project projectId
get_concrete_materials Get materials which are used in the project projectId
get_cross_sections Get cross sections which are used in the project projectId
get_steel_materials Get materials which are used in the project projectId
get_welding_materials Get materials which are used in the project projectId

MemberApi

Method Description
get_member Get information about the requires member in the connection
get_members Get information about all members in the connection
set_bearing_member Set bearing member for memberIt
update_member Update the member in the connection by newMemberData

OperationApi

Method Description
delete_operations Delete all operations for the connection
get_common_operation_properties Get common operation properties
get_operations Get the list of operations for the connection
update_common_operation_properties Update common properties for all operations

ParameterApi

Method Description
clear_parameters Clear parameters and links for the connection connectionId in the project projectId
evaluate_expression Evaluate the expression and return the result
get_parameters Get all parameters which are defined for projectId and connectionId
update Update parameters for the connection connectionId in the project projectId by values passed in parameters

PresentationApi

Method Description
get_data_scene3_d Returns data for scene3D
get_data_scene3_d_text Return serialized data for scene3D in json format

ProjectApi

Method Description
close_project Close the project. Needed for releasing resources in the service.
download_project^ Download the actual ideacon project from the service. It includes alle changes which were made by previous API calls.
get_active_projects Get the list of projects in the service which were opened by the client which was connected by M:IdeaStatiCa.ConnectionRestApi.Controllers.ClientController.ConnectClient
get_project_data Get data of the project.
get_setup Get setup from project
import_iom^ Create the IDEA Connection project from IOM provided in xml format. The parameter 'containerXmlFile' passed in HTTP body represents : <see href="https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs">IdeaRS.OpenModel.OpenModelContainer which is serialized to XML string by <see href="https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs">IdeaRS.OpenModel.Tools.OpenModelContainerToXml
open_project^ Open ideacon project from ideaConFile
update_from_iom^ Update the IDEA Connection project by <see href="https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs">IdeaRS.OpenModel.OpenModelContainer (model and results). IOM is passed in the body of the request as the xml string. <see href="https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs">IdeaRS.OpenModel.Tools.OpenModelContainerToXml should be used to generate the valid xml string
update_project_data Updates ConProjectData of project
update_setup Update setup of the project

ReportApi

Method Description
generate_pdf^ Generates report for projectId and connectionId
generate_word^ Generates report for projectId and connectionId

TemplateApi

Method Description
apply_template Apply the connection template applyTemplateParam on the connection connectionId in the project projectId
clear_design Clear the design of the connection connectionId in the project projectId
create_con_template Create a template for the connection connectionId in the project projectId
get_connection_topology Get topology of the connection in json format
get_default_template_mapping Get the default mappings for the application of the connection template passed in templateToApply on connectionId in the project projectId

Documentation for Models

Notes

This Python package is automatically generated by the OpenAPI Generator project: