<p>I want to print a object that looks like a flat board with a set of matchbox-like lumps on top of it.</p>

<p>I have written a script that outputs an STL file. To keep the script simple, it creates an object that includes non-manifold edges. To be precise, the board and the boxes are a single model, but each has 6 faces made from 2 triangles. The underside of each matchbox rests on the top of the larger flat board.</p>

<p>If I understand correctly, the top face of the board should be broken up into many smaller triangles to take into account the position of the matchboxes, but coding this by hand (although it might be an interesting Exercise For The Reader) would not be a good use of time. Well-written code that already does this is built into FOSS applications like Blender.</p>

<p>However, Blender cannot merge or fuse shapes that are part of the same object. My current understanding is that I will need to:</p>

<ol>
<li>Provide Blender with multiple objects</li>
<li>Select all the objects</li>
<li>Use Ctrl-J to merge them</li>
<li>Export the world in STL format</li>
</ol>

<p>Is this a valid approach?</p>

<p>If so, my key question is: how do I format the STL file so that Blender will recognize that it contains multiple separate objects?</p>

<p>(I have found references to STL files containing multiple objects, but I have seen nothing in any of the STL files that I have examined that tells me: here is the end of one object and the beginning of another.)</p>

<p>Or should I just be clunky and export two STL files — one for the board and one for all the matchboxes — and then import both into Blender?</p>

<hr>

<p>NOTE: I know that there are free services like <a href="https://service.netfabb.com/login.php" rel="noreferrer">Netfabb</a> that will correct my simple files for me, but I would prefer not to include that in my workflow if possible.</p>

[{'answer_id': 6858, 'author': 'Firedrake', 'author_id': 12877, 'author_profile': 'https://3dprinting.stackexchange.com/users/12877', 'pm_score': 0, 'selected': False, 'text': '<p>I think there\'s an easier way to do this - <em>if</em> you\'re not committed to using Blender, and it sounds as if you\'re not.</p>\n\n<p>Take a look at <a href="http://www.openscad.org/" rel="nofollow noreferrer">http://www.openscad.org/</a> (which should run anywhere that Blender does). It\'s very easy to write code to produce your desired shape (in this case it would be a union of cuboids) in OpenSCAD\'s description language, and then you can use OpenSCAD itself to render that to STL. (It\'s even possible to automate this from the command line.)</p>\n'}, {'answer_id': 6903, 'author': 'Michael', 'author_id': 12914, 'author_profile': 'https://3dprinting.stackexchange.com/users/12914', 'pm_score': 2, 'selected': False, 'text': '<p>Blender imports all STL files as if they are a single object. If you have multiple meshes in the object that you want to be separated, you can press tab to enter edit mode, select the parts that need to be separated, then hit P and separate by selected.</p>\n\n<p>If you want to print those pieces as one part you have to get rid of any internal faces. The easiest way to do that is to select an object and then use the boolean modifier in union mode. Once you have the object that you want to fuse selected and in place, apply the modifier, that should leave you with an object without internal faces.</p>\n'}, {'answer_id': 6907, 'author': 'Trish', 'author_id': 8884, 'author_profile': 'https://3dprinting.stackexchange.com/users/8884', 'pm_score': 0, 'selected': False, 'text': '<p>Let\'s look at it...</p>\n\n<p>It\'s something like this: a closed box with protrusions that have no inner surface. like this cobbled together thing.</p>\n\n<p><a href="https://i.stack.imgur.com/PDnW4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PDnW4.png" alt="Box with pseudobox"></a></p>\n\n<p>Let\'s just for fun export it as a .stl. yes, a single .stl file. And now open it in MeshMixer:</p>\n\n<p><a href="https://i.stack.imgur.com/QcYO4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QcYO4.png" alt="MeshMixer view of the same model"></a></p>\n\n<p>Looks not half bad, right? But a red box? What shall that mean? look at the blender model again: Oh right, the normals on those surfaces are backwards! <code>W</code> <code>F</code> in blender flips the normals, reexport the .stl, reload into MeshMixer!</p>\n\n<p><a href="https://i.stack.imgur.com/7GQeP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7GQeP.png" alt="After flipping the normals in the top &quot;cube&quot;"></a></p>\n\n<p>Now we are talking! Let\'s look how we can fix this... <code>Edit &gt; Make Solid</code> with a high <code>Solid Accuracy</code> with both a high <code>Solid Accuracy</code> and <code>Mesh Density</code> results in reasonable sharp corners and... DANG! One solid body, all neatly closed.</p>\n\n<p><a href="https://i.stack.imgur.com/gWh6P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gWh6P.png" alt="After solidifying"></a>\nNow, test: Export (<code>ctrl+E</code>) and import into blender.</p>\n\n<p><a href="https://i.stack.imgur.com/ttjmx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ttjmx.png" alt="Solidified in blender"></a></p>\n\n<p>Yet, we got a problem: this thing that had been 11 faces and 16 vertices became almost 1.2 million vertices and 2.4 million faces. This surely can be condensed some, but we just achieved a well printable merge of the objects.</p>\n\n<p><a href="https://i.stack.imgur.com/jzxam.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jzxam.png" alt="New mesh of the corner geometry"></a></p>\n'}]
['https://3dprinting.stackexchange.com/questions/4945', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/9005/']