Skip to content

Commit

Permalink
Extending solution output
Browse files Browse the repository at this point in the history
  • Loading branch information
merschformann committed Oct 20, 2023
1 parent 4b64483 commit 278c86f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions SC.ObjectModel/COSolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,10 @@ public JsonSolution ToJsonSolution()
{
Containers = InstanceLinked.Containers.Select(c => new JsonSolutionContainer()
{
ID = c.ID,
Length = c.Mesh.Length,
Width = c.Mesh.Width,
Height = c.Mesh.Height,
Assignments = ContainerContent[c.VolatileID].Select(p => new JsonAssignment()
{
Piece = p.ID,
Expand All @@ -1483,6 +1487,15 @@ public JsonSolution ToJsonSolution()
B = RotationMatrices.GetRotationAngles(Orientations[p.VolatileID]).beta,
C = RotationMatrices.GetRotationAngles(Orientations[p.VolatileID]).gamma,
},
Cubes = p[Orientations[p.VolatileID]].Components.Select(com => new JsonCube()
{
X = com.RelPosition.X,
Y = com.RelPosition.Y,
Z = com.RelPosition.Z,
Length = com.Length,
Width = com.Width,
Height = com.Height,
}).ToList(),
}).ToList(),
}).ToList(),
Offload = OffloadPieces.Select(p => p.ID).ToList(),
Expand Down
2 changes: 2 additions & 0 deletions SC.ObjectModel/IO/Json/JsonAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public class JsonAssignment
public int Piece { get; set; }
[JsonPropertyName("position")]
public JsonPosition Position { get; set; }
[JsonPropertyName("cubes")]
public List<JsonCube> Cubes { get; set; }
}
}
8 changes: 8 additions & 0 deletions SC.ObjectModel/IO/Json/JsonSolutionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ namespace SC.ObjectModel.IO.Json
{
public class JsonSolutionContainer
{
[JsonPropertyName("id")]
public int ID { get; set; }
[JsonPropertyName("length")]
public double Length { get; set; }
[JsonPropertyName("width")]
public double Width { get; set; }
[JsonPropertyName("height")]
public double Height { get; set; }
[JsonPropertyName("assignments")]
public List<JsonAssignment> Assignments { get; set; }
}
Expand Down

0 comments on commit 278c86f

Please sign in to comment.