Skip to content

Commit 647a7da

Browse files
authored
Refactor message definitions (#5)
* Add protobuf defintions for thermal history * Update file message definitions * Fix geometry content definition * Refactor message definitions * Convert tabs to spaces
1 parent e91b6ab commit 647a7da

File tree

3 files changed

+108
-54
lines changed

3 files changed

+108
-54
lines changed

ansys/api/additive/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
1.0.0

ansys/api/additive/v0/additive_domain.proto

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,74 @@ message CoaxialAverageSensorInputs {
150150
repeated Range z_heights = 2;
151151
}
152152

153-
enum GeometryFileType {
154-
GEOMETRY_FILE_TYPE_NONE = 0;
155-
GEOMETRY_FILE_TYPE_STL = 1;
156-
GEOMETRY_FILE_TYPE_BUILD_FILE = 2;
153+
enum BuildFileMachineType {
154+
BUILD_FILE_MACHINE_TYPE_NONE = 0;
155+
BUILD_FILE_MACHINE_TYPE_AI = 1;
156+
BUILD_FILE_MACHINE_TYPE_SLM = 2;
157+
BUILD_FILE_MACHINE_TYPE_RENISHAW = 3;
158+
BUILD_FILE_MACHINE_TYPE_EOS = 4;
159+
BUILD_FILE_MACHINE_TYPE_TRUMPF = 5;
160+
BUILD_FILE_MACHINE_TYPE_HB3D = 6;
161+
BUILD_FILE_MACHINE_TYPE_SISMA = 7;
157162
}
158163

159-
message Geometry {
164+
message BuildFile {
165+
BuildFileMachineType type = 1;
166+
string name = 2;
167+
}
168+
169+
message StlFile {
160170
string name = 1;
161-
GeometryFileType type = 2;
162-
bytes content = 3;
163-
}
171+
}
172+
173+
message SingleBeadInput {
174+
double bead_length = 2;
175+
BeadType bead_type = 3;
176+
MachineSettings machine = 10;
177+
AdditiveMaterial material = 11;
178+
}
179+
180+
enum BeadType {
181+
BEAD_TYPE_UNSPECIFIED = 0;
182+
BEAD_TYPE_BEAD_ON_POWDER_LAYER = 1;
183+
BEAD_TYPE_BEAD_ON_BASE_PLATE = 2;
184+
}
185+
186+
message PorosityInput {
187+
double size_x = 2;
188+
double size_y = 3;
189+
double size_z = 4;
190+
MachineSettings machine = 10;
191+
AdditiveMaterial material = 11;
192+
}
193+
194+
message MicrostructureInput {
195+
double cube_min_x = 2;
196+
double cube_min_y = 3;
197+
double cube_min_z = 4;
198+
double cube_size_x = 5;
199+
double cube_size_y = 6;
200+
double cube_size_z = 7;
201+
double sensor_dimension = 8;
202+
// indicates that cooling_rate, thermal_gradient, melt_pool* have been provided by user
203+
bool use_provided_thermal_parameters = 9;
204+
MachineSettings machine = 15;
205+
AdditiveMaterial material = 16;
206+
double cooling_rate = 20; // K/s
207+
double thermal_gradient = 21; // K/m
208+
double melt_pool_width = 22;
209+
double melt_pool_depth = 23;
210+
// indicates that random_seed has been provided by the user
211+
bool use_random_seed = 24;
212+
uint32 random_seed = 25;
213+
}
214+
215+
message ThermalHistoryInput {
216+
oneof FileType {
217+
StlFile stl_file = 1;
218+
BuildFile build_file = 2;
219+
}
220+
CoaxialAverageSensorInputs coax_ave_sensor_inputs = 10;
221+
MachineSettings machine = 11;
222+
AdditiveMaterial material = 12;
223+
}

ansys/api/additive/v0/additive_simulation.proto

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import "ansys/api/additive/v0/additive_domain.proto";
1010
// Units are SI unless otherwise noted
1111

1212
service SimulationService {
13-
rpc SimulateSingleBead(SimulateSingleBeadRequest) returns (stream SimulationResponse);
14-
rpc SimulatePorosity(SimulatePorosityRequest) returns (stream SimulationResponse);
15-
rpc SimulateMicrostructure(SimulateMicrostructureRequest) returns (stream SimulationResponse);
16-
rpc SimulateThermalHistory(SimulateThermalHistoryRequest) returns (stream SimulationResponse);
13+
rpc Simulate(SimulationRequest) returns (stream SimulationResponse);
14+
rpc UploadFile(stream FileUploadRequest) returns (stream FileUploadResponse);
15+
rpc DownloadFile(FileDownloadRequest) returns (stream FileDownloadResponse);
1716
}
1817

1918
message SimulationResponse {
@@ -27,54 +26,49 @@ message SimulationResponse {
2726
}
2827
}
2928

30-
message SimulateSingleBeadRequest {
29+
message SimulationRequest {
3130
string id = 1;
32-
double bead_length = 2;
33-
BeadType bead_type = 3;
34-
MachineSettings machine = 10;
35-
AdditiveMaterial material = 11;
31+
oneof Input {
32+
SingleBeadInput single_bead_input = 10;
33+
PorosityInput porosity_input = 11;
34+
MicrostructureInput microstructure_input = 12;
35+
ThermalHistoryInput thermal_history_input = 13;
36+
}
3637
}
3738

38-
enum BeadType {
39-
BEAD_TYPE_UNSPECIFIED = 0;
40-
BEAD_TYPE_BEAD_ON_POWDER_LAYER = 1;
41-
BEAD_TYPE_BEAD_ON_BASE_PLATE = 2;
39+
// FileUploadRequst is used to transfer a file in chunks from
40+
// a client to the server. Each message should be less than
41+
// 4 MB unless the gRPC max message size has been changed.
42+
// Following the transfer of the file contents, a final message
43+
// must be sent which includes the md5 sum of the entire file.
44+
message FileUploadRequest {
45+
string name = 1;
46+
uint64 total_size = 2;
47+
oneof Data {
48+
bytes content = 3;
49+
string md5 = 4; // sent when transfer is complete
50+
}
4251
}
4352

44-
message SimulatePorosityRequest {
45-
string id = 1;
46-
double size_x = 2;
47-
double size_y = 3;
48-
double size_z = 4;
49-
MachineSettings machine = 10;
50-
AdditiveMaterial material = 11;
53+
message FileUploadResponse {
54+
string remote_file_name = 1;
55+
Progress progress = 2;
5156
}
5257

53-
message SimulateMicrostructureRequest {
54-
string id = 1;
55-
double cube_min_x = 3;
56-
double cube_min_y = 4;
57-
double cube_min_z = 5;
58-
double cube_size_x = 6;
59-
double cube_size_y = 7;
60-
double cube_size_z = 8;
61-
double sensor_dimension = 9;
62-
// indicates that cooling_rate, thermal_gradient, melt_pool* have been provided by user
63-
bool use_provided_thermal_parameters = 10;
64-
MachineSettings machine = 15;
65-
AdditiveMaterial material = 16;
66-
double cooling_rate = 20; // K/s
67-
double thermal_gradient = 21; // K/m
68-
double melt_pool_width = 22;
69-
double melt_pool_depth = 23;
70-
// indicates that random_seed has been provided by the user
71-
bool use_random_seed = 24;
72-
uint32 random_seed = 25;
58+
message FileDownloadRequest {
59+
string remote_file_name = 1;
7360
}
7461

75-
message SimulateThermalHistoryRequest {
76-
Geometry geometry = 1;
77-
CoaxialAverageSensorInputs coax_ave_sensor_inputs = 2;
78-
MachineSettings machine = 10;
79-
AdditiveMaterial material = 11;
62+
// FileDownloadRequst is used to transfer a file in chunks from
63+
// the server to a client. Each message should be less than
64+
// 4 MB unless the gRPC max message size has been changed.
65+
// Following the transfer of the file contents, a final message
66+
// must be sent which includes the md5 sum of the entire file.
67+
message FileDownloadResponse {
68+
string file_name = 1;
69+
uint64 total_size = 2;
70+
oneof Data {
71+
bytes content = 3;
72+
string md5 = 4; // sent when transfer is complete
73+
}
8074
}

0 commit comments

Comments
 (0)