Table of Contents

ConversionApi

Method Description
ChangeCodeAsync Changes the design code of the project.
GetConversionMappingAsync Gets default conversion mappings for converting the project to a different design code.

ChangeCodeAsync

void ChangeCodeAsync (Guid projectId, ConConversionSettings conConversionSettings = null)

Changes the design code of the project.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service (only ECEN projects are supported).
conConversionSettings ConConversionSettings Conversion table for materials in the project (pairs 'ECEN MATERIAL' to 'TARGET DESIGN CODE MATERIAL'). [optional]

Return type

void (empty response body)

Example

Note: this example is autogenerated.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;

namespace Example
{
    public class ChangeCodeAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
            
            using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
            {
                using (var conClient = await clientFactory.CreateApiClient())
                {

                    // Open the project and get its id
                    var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
                    Guid projectId = projData.ProjectId;
                    
                    // (Required) Select parameters
                    var conConversionSettings = new ConConversionSettings(); // ConConversionSettings | Conversion table for materials in the project (pairs 'ECEN MATERIAL' to 'TARGET DESIGN CODE MATERIAL'). (optional) 

                    try
                    {
                        // Changes the design code of the project.
                        conClient.Conversion.ChangeCodeAsync(projectId, conConversionSettings);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Conversion.ChangeCodeAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaRS.OpenModel;
using IdeaStatiCa.Api.Connection.Model.Conversion;
using IdeaStatiCa.ConnectionApi;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// Changes the design code of an ECEN (Eurocode) project to AISC (American design code).
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task ChangeCode(IConnectionApiClient conClient)
        {
            //Only projects with the ECEN (Eurocode) design code can be converted.
            string filePath = "Inputs/simple cleat connection.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            //Get the default mapping of materials, cross-sections and fasteners for the conversion to AISC (American design code).
            ConConversionSettings conversionSettings = await conClient.Conversion.GetConversionMappingAsync(conClient.ActiveProjectId, CountryCode.American);

            //TO DO: Here we can modify the proposed TargetValue of the individual mappings if we would like to.

            //Change the design code of the project using the conversion settings.
            // v4: ChangeCode returns 204 NoContent — success has no body.
            await conClient.Conversion.ChangeCodeAsync(conClient.ActiveProjectId, conversionSettings);
            Console.WriteLine($"Change of design code to {conversionSettings.TargetDesignCode} finished.");

            string exampleFolder = GetExampleFolderPathOnDesktop("ChangeCode");
            string saveFilePath = Path.Combine(exampleFolder, "cleat-connection-AISC.ideaCon");

            //Save the converted project.
            await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
            Console.WriteLine("Project saved to: " + saveFilePath);

            //Close the opened project.
            await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
        }
    }
}

Looking for a code sample? request some help on our discussion page.

REST Usage

Http Request

All URIs are relative to http://localhost

POST /api/4/projects/{projectId}/change-code

Using the ChangeCodeWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Changes the design code of the project.
    conClient.Conversion.ChangeCodeWithHttpInfo(projectId, conConversionSettings);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ConversionApi.ChangeCodeWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 No Content -
401 Unauthorized -
404 Not Found -
422 Unprocessable Content -
500 Internal Server Error -
501 Not Implemented -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetConversionMappingAsync

ConConversionSettings GetConversionMappingAsync (Guid projectId, CountryCode? countryCode = null)

Gets default conversion mappings for converting the project to a different design code.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service (only ECEN design code is supported).
countryCode CountryCode? The requested design code for the converted project. [optional]

Return type

ConConversionSettings

Example

Note: this example is autogenerated.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;

namespace Example
{
    public class GetConversionMappingAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
            
            using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
            {
                using (var conClient = await clientFactory.CreateApiClient())
                {

                    // Open the project and get its id
                    var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
                    Guid projectId = projData.ProjectId;
                    
                    // (Required) Select parameters
                    countryCode = (CountryCode) "none";  // CountryCode? | The requested design code for the converted project. (optional) 

                    try
                    {
                        // Gets default conversion mappings for converting the project to a different design code.
                        ConConversionSettings result = await conClient.Conversion.GetConversionMappingAsync(projectId, countryCode);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Conversion.GetConversionMappingAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaRS.OpenModel;
using IdeaStatiCa.Api.Connection.Model.Conversion;
using IdeaStatiCa.ConnectionApi;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// Gets the default conversion mappings for converting an ECEN (Eurocode) project to a different design code.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetConversionMapping(IConnectionApiClient conClient)
        {
            //Only projects with the ECEN (Eurocode) design code can be converted.
            string filePath = "Inputs/simple cleat connection.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            //Get the default mapping of materials, cross-sections and fasteners for the conversion to AISC (American design code).
            ConConversionSettings conversionMapping = await conClient.Conversion.GetConversionMappingAsync(conClient.ActiveProjectId, CountryCode.American);

            Console.WriteLine($"Default conversion mapping to design code: {conversionMapping.TargetDesignCode}");
            Console.WriteLine($"Steel: {conversionMapping.Steel?.Count ?? 0}, Bolt grades: {conversionMapping.BoltGrade?.Count ?? 0}, " +
                $"Welds: {conversionMapping.Welds?.Count ?? 0}, Cross-sections: {conversionMapping.CrossSections?.Count ?? 0}");

            foreach (ConversionMapping steelMapping in conversionMapping.Steel)
            {
                Console.WriteLine($"Steel material: {steelMapping.SourceValue} -> {steelMapping.TargetValue}");
            }

            foreach (ConversionMapping crossSectionMapping in conversionMapping.CrossSections)
            {
                Console.WriteLine($"Cross-section: {crossSectionMapping.SourceValue} -> {crossSectionMapping.TargetValue}");
            }

            //Close the opened project.
            await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
        }
    }
}

Looking for a code sample? request some help on our discussion page.

REST Usage

Http Request

All URIs are relative to http://localhost

GET /api/4/projects/{projectId}/get-default-mapping

Using the GetConversionMappingWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Gets default conversion mappings for converting the project to a different design code.
    ApiResponse<ConConversionSettings> response = conClient.Conversion.GetConversionMappingWithHttpInfo(projectId, countryCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ConversionApi.GetConversionMappingWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
404 Not Found -
422 Unprocessable Content -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]