ConnectionLibraryApi
| Method | Description |
|---|---|
| GetDesignItemPictureAsync | Retrieves the picture associated with the specified design item as a PNG image. |
| GetDesignSetsAsync | Retrieves a list of design sets available for the user. |
| GetTemplateAsync | Retrieves the template associated with the specified design set and design item. |
| ProposeAsync | Proposes a list of design items for a specified connection within a project. |
| PublishConnectionAsync | Publish template to Private or Company set. |
GetDesignItemPictureAsync
void GetDesignItemPictureAsync (Guid? designSetId = null, Guid? designItemId = null)
Retrieves the picture associated with the specified design item as a PNG image.
This method is mapped to API version 2 and produces a PNG image. The image is returned as a file stream result with the file name set to the design item's ID.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| designSetId | Guid? | The unique identifier of the design set. | [optional] |
| designItemId | Guid? | The unique identifier of the design item for which the template is requested. | [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 GetDesignItemPictureAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
try
{
// Retrieves the picture associated with the specified design item as a PNG image.
conClient.ConnectionLibrary.GetDesignItemPictureAsync(designSetId, designItemId);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling ConnectionLibrary.GetDesignItemPictureAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Downloads the preview picture (PNG) of a design item from the Connection Library.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetDesignItemPicture(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple knee connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
int connectionId = connections[0].Id;
//Propose design items from the Connection Library to get a design set id and a design item id.
List<ConDesignItem> proposedItems = await conClient.ConnectionLibrary.ProposeAsync(conClient.ActiveProjectId, connectionId, new ConConnectionLibrarySearchParameters());
if (proposedItems.Count == 0)
{
Console.WriteLine("No design items were proposed for the connection.");
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
return;
}
ConDesignItem designItem = proposedItems[0];
string exampleFolder = GetExampleFolderPathOnDesktop("GetDesignItemPicture");
string saveFilePath = Path.Combine(exampleFolder, designItem.ConDesignItemId + ".png");
//Download the preview picture of the design item and save it as a PNG file.
//SaveDesignItemPictureAsync is a client extension of the get-picture endpoint (GetDesignItemPictureAsync).
await conClient.ConnectionLibrary.SaveDesignItemPictureAsync(designItem.ConDesignSetId, designItem.ConDesignItemId, saveFilePath);
Console.WriteLine($"Picture of design item '{designItem.Name}' 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
GET /api/4/connection-library/get-picture
Using the GetDesignItemPictureWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Retrieves the picture associated with the specified design item as a PNG image.
conClient.ConnectionLibrary.GetDesignItemPictureWithHttpInfo(designSetId, designItemId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConnectionLibraryApi.GetDesignItemPictureWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: image/png
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetDesignSetsAsync
List<ConDesignSet> GetDesignSetsAsync ()
Retrieves a list of design sets available for the user.
This method returns a collection of design sets that are mapped and ready for use. It throws an exception if no design sets are available for the user.
Parameters
This endpoint does not need any parameter.
Return type
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 GetDesignSetsAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
try
{
// Retrieves a list of design sets available for the user.
List<ConDesignSet> result = await conClient.ConnectionLibrary.GetDesignSetsAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling ConnectionLibrary.GetDesignSetsAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Gets all design sets of the Connection Library which are available for the current user.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetDesignSets(IConnectionApiClient conClient)
{
//Get all design sets available for the current user.
//This includes the predefined set delivered with IDEA StatiCa and the user's personal and company sets.
//No project needs to be opened for this call.
List<ConDesignSet> designSets = await conClient.ConnectionLibrary.GetDesignSetsAsync();
Console.WriteLine($"Available design sets: {designSets.Count}");
foreach (ConDesignSet designSet in designSets)
{
Console.WriteLine($"Id: {designSet.Id} Name: {designSet.Name} Type: {designSet.Type}");
}
}
}
}
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/connection-library/get-design-sets
Using the GetDesignSetsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Retrieves a list of design sets available for the user.
ApiResponse<List<ConDesignSet>> response = conClient.ConnectionLibrary.GetDesignSetsWithHttpInfo();
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 ConnectionLibraryApi.GetDesignSetsWithHttpInfo: " + 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 | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetTemplateAsync
string GetTemplateAsync (Guid? designSetId = null, Guid? designItemId = null)
Retrieves the template associated with the specified design set and design item.
This method is mapped to API version 2 and produces a plain text response. It is intended to be used in scenarios where the template of a design item needs to be retrieved for further processing or display.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| designSetId | Guid? | The unique identifier of the design set. | [optional] |
| designItemId | Guid? | The unique identifier of the design item for which the template is requested. | [optional] |
Return type
string
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 GetTemplateAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
try
{
// Retrieves the template associated with the specified design set and design item.
string result = await conClient.ConnectionLibrary.GetTemplateAsync(designSetId, designItemId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling ConnectionLibrary.GetTemplateAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Gets the connection template of a design item from the Connection Library and saves it as a .contemp file.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetTemplate(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple knee connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
int connectionId = connections[0].Id;
//Propose design items from the Connection Library to get a design set id and a design item id.
List<ConDesignItem> proposedItems = await conClient.ConnectionLibrary.ProposeAsync(conClient.ActiveProjectId, connectionId, new ConConnectionLibrarySearchParameters());
if (proposedItems.Count == 0)
{
Console.WriteLine("No design items were proposed for the connection.");
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
return;
}
ConDesignItem designItem = proposedItems[0];
//Get the template of the design item. The content is returned as a base64 encoded string.
string templateBase64 = await conClient.ConnectionLibrary.GetTemplateAsync(designItem.ConDesignSetId, designItem.ConDesignItemId);
//Decode the base64 content to get the template XML.
byte[] templateXml = Convert.FromBase64String(templateBase64);
string exampleFolder = GetExampleFolderPathOnDesktop("GetTemplate");
string saveFilePath = Path.Combine(exampleFolder, designItem.ConDesignItemId + ".contemp");
await File.WriteAllBytesAsync(saveFilePath, templateXml);
Console.WriteLine($"Template of design item '{designItem.Name}' ({templateXml.Length} bytes) 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
GET /api/4/connection-library/get-template
Using the GetTemplateWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Retrieves the template associated with the specified design set and design item.
ApiResponse<string> response = conClient.ConnectionLibrary.GetTemplateWithHttpInfo(designSetId, designItemId);
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 ConnectionLibraryApi.GetTemplateWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ProposeAsync
List<ConDesignItem> ProposeAsync (Guid projectId, int connectionId, ConConnectionLibrarySearchParameters conConnectionLibrarySearchParameters = null)
Proposes a list of design items for a specified connection within a project.
This method retrieves the connection model from the specified project and classifies its typology. It then filters and proposes design items based on the connection's typology and design code.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the project containing the connection. | |
| connectionId | int | The identifier of the connection for which design items are proposed. | |
| conConnectionLibrarySearchParameters | ConConnectionLibrarySearchParameters | Parameters used to filter and refine the search for proposed connection design items, such as set membership and required connection features. | [optional] |
Return type
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 ProposeAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // 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
connectionId = 56; // int | The identifier of the connection for which design items are proposed.
var conConnectionLibrarySearchParameters = new ConConnectionLibrarySearchParameters(); // ConConnectionLibrarySearchParameters | Parameters used to filter and refine the search for proposed connection design items, such as set membership and required connection features. (optional)
try
{
// Proposes a list of design items for a specified connection within a project.
List<ConDesignItem> result = await conClient.ConnectionLibrary.ProposeAsync(projectId, connectionId, conConnectionLibrarySearchParameters);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling ConnectionLibrary.ProposeAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
using ConSearchOption = IdeaStatiCa.Api.Connection.Model.SearchOption;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Proposes suitable design items from the Connection Library for a connection.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task Propose(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple knee connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
int connectionId = connections[0].Id;
//Search parameters can filter the proposals by set membership and connection features.
//Here we search all available sets and ignore all feature filters (the default).
ConConnectionLibrarySearchParameters searchParameters = new ConConnectionLibrarySearchParameters();
searchParameters.HasBolts = ConSearchOption.Ignore;
searchParameters.HasWelds = ConSearchOption.Ignore;
//Propose design items matching the topology and design code of the connection.
List<ConDesignItem> proposedItems = await conClient.ConnectionLibrary.ProposeAsync(conClient.ActiveProjectId, connectionId, searchParameters);
Console.WriteLine($"Proposed design items for connection '{connections[0].Name}': {proposedItems.Count}");
foreach (ConDesignItem designItem in proposedItems)
{
Console.WriteLine($"Name: {designItem.Name} Design code: {designItem.DesignCode} DesignItemId: {designItem.ConDesignItemId}");
}
//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}/connections/{connectionId}/propose
Using the ProposeWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Proposes a list of design items for a specified connection within a project.
ApiResponse<List<ConDesignItem>> response = conClient.ConnectionLibrary.ProposeWithHttpInfo(projectId, connectionId, conConnectionLibrarySearchParameters);
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 ConnectionLibraryApi.ProposeWithHttpInfo: " + 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 |
|---|---|---|
| 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]
PublishConnectionAsync
bool PublishConnectionAsync (Guid projectId, int connectionId, ConTemplatePublishParam conTemplatePublishParam = null)
Publish template to Private or Company set.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the opened project in the ConnectionRestApi service. | |
| connectionId | int | The ID of the connection whose template will be published. | |
| conTemplatePublishParam | ConTemplatePublishParam | Parameters describing the publish operation (name, author, design set type). | [optional] |
Return type
bool
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 PublishConnectionAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // 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
connectionId = 56; // int | The ID of the connection whose template will be published.
var conTemplatePublishParam = new ConTemplatePublishParam(); // ConTemplatePublishParam | Parameters describing the publish operation (name, author, design set type). (optional)
try
{
// Publish template to Private or Company set.
bool result = await conClient.ConnectionLibrary.PublishConnectionAsync(projectId, connectionId, conTemplatePublishParam);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling ConnectionLibrary.PublishConnectionAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Publishes the design of a connection as a template into the user's private set in the Connection Library.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task PublishConnection(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple cleat connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
int connectionId = connections[0].Id;
//Publish the connection design to the Private set (use ConDesignSetType.Company to share it with the whole company).
ConTemplatePublishParam publishParam = new ConTemplatePublishParam
{
Name = "Simple cleat connection",
Author = "Connection API example",
CompanyName = "IDEA StatiCa",
DesignSetType = ConDesignSetType.Private
};
bool published = await conClient.ConnectionLibrary.PublishConnectionAsync(conClient.ActiveProjectId, connectionId, publishParam);
Console.WriteLine(published
? $"Connection '{connections[0].Name}' was published to the {publishParam.DesignSetType} design set."
: $"Publishing of connection '{connections[0].Name}' failed.");
//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}/connections/{connectionId}/publish
Using the PublishConnectionWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Publish template to Private or Company set.
ApiResponse<bool> response = conClient.ConnectionLibrary.PublishConnectionWithHttpInfo(projectId, connectionId, conTemplatePublishParam);
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 ConnectionLibraryApi.PublishConnectionWithHttpInfo: " + 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 |
|---|---|---|
| 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]