Table of Contents

PresentationApi

Method Description
GetDataScene3DAsync Returns data for Scene3D visualization.
GetDataScene3DTextAsync Returns serialized data for Scene3D in JSON format.

GetDataScene3DAsync

DrawData GetDataScene3DAsync (Guid projectId, int connectionId)

Returns data for Scene3D visualization.

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 to be presented in Scene3D.

Return type

DrawData

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 GetDataScene3DAsyncExample
    {
        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
                    connectionId = 56;  // int | The ID of the connection to be presented in Scene3D.

                    try
                    {
                        // Returns data for Scene3D visualization.
                        DrawData result = await conClient.Presentation.GetDataScene3DAsync(projectId, connectionId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Presentation.GetDataScene3DAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaStatiCa.ConnectionApi;
using IdeaStatiCa.ConnectionApi.Model;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// Gets the Scene3D visualization data (triangulated mesh of the connection model) of a given connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetDataScene3D(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;

            //Get the data for the Scene3D visualization of the connection.
            DrawData sceneData = await conClient.Presentation.GetDataScene3DAsync(conClient.ActiveProjectId, connectionId);

            //Vertices and normals are stored as flat lists of coordinates (x, y, z per vertex).
            Console.WriteLine($"Scene3D data of connection {connectionId}:");
            Console.WriteLine($"  Groups: {sceneData.Groups.Count}");
            Console.WriteLine($"  Vertices: {sceneData.Vertices.Count / 3}");
            Console.WriteLine($"  Normals: {sceneData.Normals.Count / 3}");

            //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}/connections/{connectionId}/presentations

Using the GetDataScene3DWithHttpInfo variant

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

try
{
    // Returns data for Scene3D visualization.
    ApiResponse<DrawData> response = conClient.Presentation.GetDataScene3DWithHttpInfo(projectId, connectionId);
    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 PresentationApi.GetDataScene3DWithHttpInfo: " + 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 -
500 Internal Server Error -

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

GetDataScene3DTextAsync

string GetDataScene3DTextAsync (Guid projectId, int connectionId)

Returns serialized data for Scene3D in JSON format.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project.
connectionId int The ID of the connection to be presented.

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 GetDataScene3DTextAsyncExample
    {
        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
                    connectionId = 56;  // int | The ID of the connection to be presented.

                    try
                    {
                        // Returns serialized data for Scene3D in JSON format.
                        string result = await conClient.Presentation.GetDataScene3DTextAsync(projectId, connectionId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Presentation.GetDataScene3DTextAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaStatiCa.ConnectionApi;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// Gets the Scene3D visualization data of a given connection serialized as a JSON string and saves it to a file.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetDataScene3DText(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/simple cleat connection - sections.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Get the serialized Scene3D data of the connection in JSON format.
            string sceneJson = await conClient.Presentation.GetDataScene3DTextAsync(conClient.ActiveProjectId, connectionId);

            string exampleFolder = GetExampleFolderPathOnDesktop("GetDataScene3DText");

            string fileName = "scene3d.json";
            string jsonFilePath = Path.Combine(exampleFolder, fileName);

            await File.WriteAllTextAsync(jsonFilePath, sceneJson);

            Console.WriteLine($"Scene3D data of connection {connectionId} ({sceneJson.Length} characters) saved to: {jsonFilePath}");

            //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}/connections/{connectionId}/presentations/text

Using the GetDataScene3DTextWithHttpInfo variant

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

try
{
    // Returns serialized data for Scene3D in JSON format.
    ApiResponse<string> response = conClient.Presentation.GetDataScene3DTextWithHttpInfo(projectId, connectionId);
    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 PresentationApi.GetDataScene3DTextWithHttpInfo: " + 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]