I'm trying to get or calcualte the volume of a gcode (3D printing) file in my C# project. To read the gcode I'm using this third-party library: https://github.com/gradientspace/gsGCode
Sadly the author haven't responded yet.
For now, this is how I read the file in:
public gs.GCodeFile Load(string path)
{
try
{
GenericGCodeParser parse = new GenericGCodeParser();
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
return parse.Parse(sr);
}
catch(Exception)
{
return null;
}
}
This gets me a a list of all gcode lines.
Now I need to calculate the volume out of this information. This is the gcode file I used for the read: https://andreas-reitberger.de/wp-content/uploads/2015/12/4x_rod_0.1mm_PET_MK3.zip
P.S. I know that the volume is written in the comments of the gcode file, however this is not a must and not reliable. Thank you,