| ο»ΏFastPrint/ | |
| β | |
| βββ Geometry/ | |
| β βββ BsplineMitchellNetravali.cs | |
| β | |
| βββ Slicing/ | |
| β βββ SliceAccelerator.cs | |
| β | |
| βββ Printer/ | |
| β βββ MarlinConnector.cs | |
| β | |
| βββ Model/ | |
| β βββ STLModel.cs | |
| β | |
| βββ UI/ | |
| β βββ MainWindow.xaml | |
| β βββ MainWindow.xaml.cs | |
| β | |
| βββ README.md | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Globalization; | |
| namespace FastPrint.Model | |
| { | |
| public class STLModel | |
| { | |
| public List<float[]> Triangles { get; } = new List<float[]>(); | |
| public void LoadAscii(string path) | |
| { | |
| using var reader = new StreamReader(path); | |
| string line; | |
| var currentTriangle = new List<float>(); | |
| while ((line = reader.ReadLine()) != null) | |
| { | |
| if (line.Trim().StartsWith("vertex")) | |
| { | |
| var parts = line.Trim().Split(' '); | |
| for (int i = 1; i < 4; i++) | |
| currentTriangle.Add(float.Parse(parts[i], CultureInfo.InvariantCulture)); | |
| } | |
| if (currentTriangle.Count == 9) | |
| { | |
| Triangles.Add(currentTriangle.ToArray()); | |
| currentTriangle.Clear(); | |
| } | |
| } | |
| } | |
| } | |
| } |