3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$ – Nir Dec 18 '17 at 8:52
2
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ – Jesse Williams Nov 8 '17 at 16:28
  • $\begingroup$ 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. $\endgroup$ – Athanasios Karagiannis Nov 8 '17 at 16:40
1
$\begingroup$

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/

$\endgroup$
1
$\begingroup$

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(){
var facets = readStl(@"C:\stls\teapot.stl");}

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 */


public static System.Collections.Generic.List<facet> readStl(string file)
{
    // check if binary or text fomat
    //Console.WriteLine("the middle");
    bool isText;
    System.Collections.Generic.List<facet> facets = new System.Collections.Generic.List<facet>();
    using (System.IO.BinaryReader reader = new System.IO.BinaryReader(System.IO.File.Open(file, System.IO.FileMode.Open)))
    {
        //Console.WriteLine("Checking if binary");
        string fileHeading;
        fileHeading = new string(reader.ReadChars(80));
        if (fileHeading.Contains(@"solid"))
        {
            isText = true;
            //Console.WriteLine("isText true");
        }
        else
        {
            isText = false;
            //Console.WriteLine("isText false");
        }
        if(!isText)
        {
            // process binary file
            Console.WriteLine("Is binary");
            uint numberOfTriangles = reader.ReadUInt32();
            //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();
                normals.X = reader.ReadSingle();
                normals.Y = reader.ReadSingle();
                normals.Z = reader.ReadSingle();
                vecA.X = reader.ReadSingle();
                vecA.Y = reader.ReadSingle();
                vecA.Z = reader.ReadSingle();
                vecB.X = reader.ReadSingle();
                vecB.Y = reader.ReadSingle();
                vecB.Z = reader.ReadSingle();
                vecC.X = reader.ReadSingle();
                vecC.Y = reader.ReadSingle();
                vecC.Z = reader.ReadSingle();
                byteCount = reader.ReadUInt16();
                facets.Add(new facet(vecA, vecB, vecC, normals));
            }
        }
    }
    if (isText)
    {
        // read text format file
        Console.WriteLine("Is text file");
        //Console.WriteLine("reading text file");
        using (System.IO.StreamReader reader = System.IO.File.OpenText(file))
        {
            string line = @"";
            string fileHeader = @"";
            line = reader.ReadLine();
            fileHeader = line.Substring(line.IndexOf("solid") + 5).Trim();
            line = "";
            System.Console.WriteLine(@"file header: " + fileHeader);
            bool endOfFile = true;
            while (endOfFile)
            {
                line = reader.ReadLine();
                if (!reader.EndOfStream)
                {
                    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 = "";
                    line = reader.ReadLine(); // outer loop
                    line = reader.ReadLine(); // vertex 
                    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 = "";
                    line = reader.ReadLine(); // vertex 
                    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 = "";
                    line = reader.ReadLine(); // vertex 
                    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 = "";
                    line = reader.ReadLine(); // endloop
                    line = reader.ReadLine(); // endfacet
                    facets.Add(new facet(vecA, vecB, vecC, normals));
                }
                else
                {
                    endOfFile = false;
                }
            }// while loop
            System.Console.WriteLine("finished reading file");
        }
    }
    return facets;
}/* readStl */
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.