From 0bef076bd5703000b82c6bc817b73b50eab46594 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Wed, 3 Jul 2024 08:14:17 +0200 Subject: [PATCH] Add API for Modeling Ply geometry export (#62) --- .pre-commit-config.yaml | 2 +- src/ansys/api/acp/VERSION | 2 +- src/ansys/api/acp/v0/enum_types.proto | 13 +++++ src/ansys/api/acp/v0/material.proto | 2 + src/ansys/api/acp/v0/modeling_ply.proto | 6 +++ .../api/acp/v0/ply_geometry_export.proto | 50 +++++++++++++++++++ src/ansys/api/acp/v0/solid_model.proto | 10 ++-- 7 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 src/ansys/api/acp/v0/ply_geometry_export.proto diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7ca703..a8f6bd6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,4 +16,4 @@ repos: hooks: - id: add-license-headers args: - - --start_year=2022 \ No newline at end of file + - --start_year=2022 diff --git a/src/ansys/api/acp/VERSION b/src/ansys/api/acp/VERSION index 8d76ca4..c11082e 100644 --- a/src/ansys/api/acp/VERSION +++ b/src/ansys/api/acp/VERSION @@ -1 +1 @@ -0.1.0.dev8 +0.1.0.dev9 diff --git a/src/ansys/api/acp/v0/enum_types.proto b/src/ansys/api/acp/v0/enum_types.proto index dc2871f..4aaefa2 100644 --- a/src/ansys/api/acp/v0/enum_types.proto +++ b/src/ansys/api/acp/v0/enum_types.proto @@ -64,3 +64,16 @@ enum BooleanOperationType { ADD = 1; REMOVE = 2; } + +enum OffsetType { + NO_OFFSET = 0; + BOTTOM_OFFSET = 1; + MIDDLE_OFFSET = 2; + TOP_OFFSET = 3; +} + +enum ArrowType { + NO_ARROW = 0; + HALF_ARROW = 1; + STANDARD_ARROW = 2; +} diff --git a/src/ansys/api/acp/v0/material.proto b/src/ansys/api/acp/v0/material.proto index 1396e49..2ad551e 100644 --- a/src/ansys/api/acp/v0/material.proto +++ b/src/ansys/api/acp/v0/material.proto @@ -286,5 +286,7 @@ service ObjectService { rpc Create(CreateRequest) returns (ObjectInfo); + // Custom methods + rpc SaveToFile(SaveToFileRequest) returns (base.Empty); } diff --git a/src/ansys/api/acp/v0/modeling_ply.proto b/src/ansys/api/acp/v0/modeling_ply.proto index e586614..3a84d34 100644 --- a/src/ansys/api/acp/v0/modeling_ply.proto +++ b/src/ansys/api/acp/v0/modeling_ply.proto @@ -28,6 +28,7 @@ import "ansys/api/acp/v0/enum_types.proto"; import "ansys/api/acp/v0/array_types.proto"; import "ansys/api/acp/v0/ply_material.proto"; import "ansys/api/acp/v0/linked_selection_rule.proto"; +import "ansys/api/acp/v0/ply_geometry_export.proto"; enum ThicknessType { NOMINAL = 0; @@ -101,4 +102,9 @@ service ObjectService { rpc Delete(base.DeleteRequest) returns (base.Empty); rpc Create(CreateRequest) returns (ObjectInfo); + + // Custom methods + + rpc ExportGeometries(ply_geometry_export.ExportGeometriesRequest) + returns (base.Empty); } diff --git a/src/ansys/api/acp/v0/ply_geometry_export.proto b/src/ansys/api/acp/v0/ply_geometry_export.proto new file mode 100644 index 0000000..aab682a --- /dev/null +++ b/src/ansys/api/acp/v0/ply_geometry_export.proto @@ -0,0 +1,50 @@ +// Copyright (C) 2022 - 2024 ANSYS, Inc. and/or its affiliates. +// SPDX-License-Identifier: MIT +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +syntax = "proto3"; +package ansys.api.acp.v0.ply_geometry_export; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/enum_types.proto"; + +enum ExportFormat { + STEP = 0; + IGES = 1; + STL = 2; +} + +message ExportOptions { + ExportFormat format = 1; + enum_types.OffsetType offset_type = 2; + bool include_boundary = 3; + bool include_surface = 4; + bool include_first_material_direction = 5; + bool include_second_material_direction = 6; + double arrow_length = 7; + enum_types.ArrowType arrow_type = 8; +} + +message ExportGeometriesRequest { + string path = 1; + repeated base.ResourcePath plies = 2; + ExportOptions options = 3; +} diff --git a/src/ansys/api/acp/v0/solid_model.proto b/src/ansys/api/acp/v0/solid_model.proto index 344ed06..5a1fbd9 100644 --- a/src/ansys/api/acp/v0/solid_model.proto +++ b/src/ansys/api/acp/v0/solid_model.proto @@ -59,15 +59,15 @@ message DropOffSettings { message ExportSettings { bool use_default_section_index = 1; - int32 section_index = 2; + int64 section_index = 2; bool use_default_coordinate_system_index = 3; - int32 coordinate_system_index = 4; + int64 coordinate_system_index = 4; bool use_default_material_index = 5; - int32 material_index = 6; + int64 material_index = 6; bool use_default_node_index = 7; - int32 node_index = 8; + int64 node_index = 8; bool use_default_element_index = 9; - int32 element_index = 10; + int64 element_index = 10; bool use_solsh_elements = 11; bool write_degenerated_elements = 12; bool drop_hanging_nodes = 13;