I am currently working on software for layered manufacturing (3D printing), and have come to a point where I no longer know what to do. I am at the stage where I must take a bunch of lines, and order them to create a seamless contour of a model. I have some basic ideas on how I am going to do this, but since I am using .STL files there are excess lines in some of the layers.


In that image you can see that there is a simple square with a line connecting two corners to form two triangles. This is the base of a cube. Ideally the line connecting the two corners wouldn't be there, but because this was processed from a .STL file which uses triangles only it has to be there to turn the square into two triangles. My original thought was to print out that line too, but in a more complex model ( like a gear ) there would be too many and it would be impossible to create one seamless contour. My next thought was to just print it out as two triangles, but I cannot go over the same line twice, so that doesn't work especially in complex models. I have been thinking about this problem for quite a while, but I can never come up with a solution that would work for any model. I need to end up with series of lines that form contours of not just the outside, but possibly the inside as well if there are holes. For example a gear would have one set of lines that form the teeth all the way around, and another set of lines that form the hole in the middle. If anyone knows a solution to this, or has experience with this, I would greatly appreciate your input =)


I don't know about STL specifically, but i've seen some other languages with some rules to 'remove' parts.

  • Even-odd rule: Only draw lines that are present an odd number of times.

  • Non-zero sum: If there's a line form A to B, and then another from B to A, the second one 'substracts' from the first and the sum is zero, so ignore it. But if there's to A-B and one B-A, or one A-B and two B-A, then the sum is not zero, so you have to draw it.

Note that in both cases you have to determine if the second line is the same line or points, not "very close". That's easier if the format first defines the points and then the lines or polygons that use them. In STL you would have to choose if you consider 'same' points only if they're textually identical, or if you'll define a margin of similarity.

|improve this answer|||||

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.