# How to implement wall thickness Analysis for my .net project

I have .stl for the 3d printing. And I want to analysis wall thickness of this model before printing. I have no idea about any tools. Can I create any console or wpf app for calculating wall thickness and cost of the printing. Please help me.

• Hello, yes you can create an app to do wall thickness analysis but how to do it is a programming question not a 3d printing question
– Nir
Dec 18 '17 at 8:52

If your talking about a hollow object, such as a cube with a hollow center. The wall thickness is determined by the model.

If your talking about a solid object, the wall thickness is determined by your nozzle diameter multiplied by your # of walls. This is all adjusted by your splicing software. If you have a nozzle of 0.5mm and you print at 3 perimeters, your wall should be 1.5mm. If you want the wall to be 2mm, then you will adjust your perimeters to 4. Everything within those walls will be whatever you choose for infill.

I work with ASP.NET, Windows Forms, and Console Apps myself. I'm sure you can find libraries capable of taking 3D models but I don't think it would matter because the printed thickness is determined by your splicing settings.

Also for cost of printing, I recommend just using Cura which you just have to plug in some cost information about the filament and it will tell you estimated cost, mm of filament usage, and time.

• That's not wholly true. Most slicers allow for over- and under-extrusion for walls to allow walls that aren't bound specifically by the diameter of the nozzle you're using. slic3r, Simplify3D and Cura, at least, all have these options. I would imagine that you'd want to read the g-code to get specific details since how you slice a model varies, and the model itself is not always a good indicator. Nov 8 '17 at 16:28
• I use slic3r myself. For my case every wall printed is consistent. I've never noticed a thicker or thinner single wall. They tend to be slightly larger than my 0.4mm nozzle but that is because they get squished alittle. But at 3 perimeters I should get 1.2mm walls but I get about 1.3mm when I measure it. Nov 8 '17 at 16:40

If your concern is that the stl file may have walls that are too thin to print on your printer, MeshMixer is a great tool from Autodesk to help check and fix mesh issues (including wall thickness). It is free to Makers and Educators.

There are lots of helpful tutorials Here is one https://all3dp.com/meshmixer-tutorial/

I'm not completely sure what you want to do but I will add some information that I think will help and then hopefully you can figure out what you need to know or ask another question.

When you are asking about wall thickness there are two different things you could be referring to. A wall in the model, so you could be talking about trying to print a thin wall coming out of the model. For analysis thin wall setting some slicers will change the extrusion amount to print thicker or thinner lines, and to find those settings you would need to look at the g-code. Or you could be talking about the shell of the model, the outside surface, and for this you could also analysis in the slicer settings by looking at the number of perimeters the slicer will try and print.

For calculating the cost of the print you will want the amount of material used, this will also be in the g-code file. You can eather calculate this by going through each G1 command and finding out how much filament was extruded for each move the printer made. (Not some slicers reset this to zero after each layer and this gets tricky when the printer starts retracting the filament while traveling). Or most slicers have a commented out line of g-code at the beginning or end of the file listing how much filament will be used.

If you do analysis the .stl file you also might find that you need to repair the model file as well, Because alot of .stl files are made for 3D graphics and not for printing and so they can have intersecting triangles and not be water tight.

Not all .stl files are the same they can be text or binary files, this is some c# code that will read both formats into a list of the triangles in the file for you.

using System.Numerics.Vectors;
void Main(){

public class facet
{
public Vector3 norm = new Vector3();
public Vector3 vecA = new Vector3();
public Vector3 vecB = new Vector3();
public Vector3 vecC = new Vector3();
public facet(Vector3 A, Vector3 B, Vector3 C, Vector3 N)
{
norm = N;
vecA = A;
vecB = B;
vecC = C;
}
}/* facet */

{
// check if binary or text fomat
//Console.WriteLine("the middle");
bool isText;
System.Collections.Generic.List<facet> facets = new System.Collections.Generic.List<facet>();
{
//Console.WriteLine("Checking if binary");
{
isText = true;
//Console.WriteLine("isText true");
}
else
{
isText = false;
//Console.WriteLine("isText false");
}
if(!isText)
{
// process binary file
Console.WriteLine("Is binary");
//Debug.Log("Number of Triangles: " + numberOfTriangles.ToString());
System.Console.WriteLine("Number of Triangles: " + numberOfTriangles.ToString());
for(int i = 0; i < numberOfTriangles - 1; i++)
{
Vector3 normals = new Vector3();
Vector3 vecA = new Vector3();
Vector3 vecB = new Vector3();
Vector3 vecC = new Vector3();
System.UInt16 byteCount = new System.UInt16();
}
}
}
if (isText)
{
Console.WriteLine("Is text file");
{
string line = @"";
line = "";
bool endOfFile = true;
while (endOfFile)
{
{
Vector3 normals = new Vector3();
Vector3 vecA = new Vector3();
Vector3 vecB = new Vector3();
Vector3 vecC = new Vector3();
string[] nums = line.Replace("facet", "").Replace("normal", "").Trim().Split(' ');
normals.X = (float)System.Double.Parse(nums[0], System.Globalization.NumberStyles.Float);
normals.Y = (float)System.Double.Parse(nums[1], System.Globalization.NumberStyles.Float);
normals.Z = (float)System.Double.Parse(nums[2], System.Globalization.NumberStyles.Float);
line = "";
string[] vecsA = line.Replace("vertex", "").Trim().Split(' ');
vecA.X = (float)System.Double.Parse(vecsA[0], System.Globalization.NumberStyles.Float);
vecA.Y = (float)System.Double.Parse(vecsA[1], System.Globalization.NumberStyles.Float);
vecA.Z = (float)System.Double.Parse(vecsA[2], System.Globalization.NumberStyles.Float);
line = "";
string[] vecsB = line.Replace("vertex", "").Trim().Split(' ');
vecB.X = (float)System.Double.Parse(vecsB[0], System.Globalization.NumberStyles.Float);
vecB.Y = (float)System.Double.Parse(vecsB[1], System.Globalization.NumberStyles.Float);
vecB.Z = (float)System.Double.Parse(vecsB[2], System.Globalization.NumberStyles.Float);
line = "";
string[] vecsC = line.Replace("vertex", "").Trim().Split(' ');
vecC.X = (float)System.Double.Parse(vecsC[0], System.Globalization.NumberStyles.Float);
vecC.Y = (float)System.Double.Parse(vecsC[1], System.Globalization.NumberStyles.Float);
vecC.Z = (float)System.Double.Parse(vecsC[2], System.Globalization.NumberStyles.Float);
line = "";