Answer the question
In order to leave comments, you need to log in
How to build stl with c#?
Hello, how to build an stl model from an array of points?
There is an array of points in three-dimensional space, they can be combined into triangles (if necessary). It seems that the layout of the document speaks of a simple stl structure, but I am a beginner and therefore most likely I will not be able to figure it out. Is there a ready-made library, but rather a guide on how to do it.
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
There are several libraries:
Free: https://www.nuget.org/packages/QuantumConcepts.For...
Paid: https://products.aspose.com/cad/net
There is an array of points in three-dimensional space, they can be combined into triangles (if necessary).
It seems that the layout of the document speaks of a simple stl structure, but I am a beginner and therefore most likely I will not be able to figure it out.
If needed, there is a library.
Download directly from NuGet.
using System.IO;
using IxMilia.Stl;
StlFile stlFile = new StlFile();
stlFile.SolidName = "my-solid";
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 0), new StlVertex(0, 100, 0), new StlVertex(100, 0, 0)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(100, 0, 0), new StlVertex(0, 100, 0), new StlVertex(100, 100, 0)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 100), new StlVertex(100, 0, 100), new StlVertex(0, 100, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(100, 0, 100), new StlVertex(0, 100, 100), new StlVertex(100, 100, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 0), new StlVertex(100, 0, 0), new StlVertex(0, 0, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 100), new StlVertex(100, 0, 0), new StlVertex(100, 0, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 100, 0), new StlVertex(100, 100, 0), new StlVertex(0, 100, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 100, 100), new StlVertex(100, 100, 0), new StlVertex(100, 100, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 0), new StlVertex(0, 100, 0), new StlVertex(0, 0, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(0, 0, 100), new StlVertex(0, 100, 0), new StlVertex(0, 100, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(100, 0, 0), new StlVertex(100, 100, 0), new StlVertex(100, 0, 100)));
stlFile.Triangles.Add(new StlTriangle(new StlNormal(1, 0, 0), new StlVertex(100, 0, 100), new StlVertex(100, 100, 0), new StlVertex(100, 100, 100)));
using (FileStream fs = new FileStream(@"C:\Users\...\1.stl", FileMode.Open))
{
stlFile.Save(fs);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question