<p>I am modelling a few cut templates to be used on an hexagonal grid (honeycomb) material using OpenSCAD.  Basically, from a reference cell, I need to select all cells that are within a given range and given angle.</p>

<p>I implemented this by creating an in memory grid that covers an area larger than what I need (extra range, 360 degrees), and then testing each cell for both the distance and angle requirements, extruding only those that test positive for both conditions.</p>

<p>Everything works as expected...</p>

<p><a href="https://i.stack.imgur.com/vzJD0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vzJD0.png" alt="Range = 15, Angle = 60°"></a></p>

<p>...but now I would also like to add the possibility to have the outer contour of the template without having each individual cell within it (so, a single thin line going around the whole "pizza slice" above).</p>

<p>I'm pretty new to OpenSCAD: what would be the best approach here?
(I'm happy even with a solution that requires to re-implement what done until now).</p>

[{'answer_id': 5036, 'author': 'Mick', 'author_id': 3953, 'author_profile': 'https://3dprinting.stackexchange.com/users/3953', 'pm_score': 0, 'selected': False, 'text': '<p>Unfortunately, OpenSCAD does not have a 2D hull() transformation, although it has been requested. You might be able to find a pre-written package that implements a 2D hull. However, if all you want is a hexagonal grid with a border of some arbitrary shape, could you not cheat, and get your slicer to generate the grid for you? All you would need to do is generate the envelope, and then slice with a hexagonal grid as in-fill, and request no top or bottom layers. Most slicers will do hexagonal in-fill.</p>\n\n<p>If you want to do it all in OpenSCAD, then I would go about it like this:</p>\n\n<ol>\n<li>Create a 2D grid, similar to what you have now.</li>\n<li>Create a 2D outline of the shape you want, undersized so that you can add a manifold (as a perimeter).</li>\n<li>Duplicate this shape.</li>\n<li>Add a manifold to the first copy.</li>\n<li>Create an intersection of the second copy and the grid.</li>\n<li>Create a union of the two copies.</li>\n<li>Extrude the union.</li>\n</ol>\n'}, {'answer_id': 5041, 'author': 'mac', 'author_id': 9134, 'author_profile': 'https://3dprinting.stackexchange.com/users/9134', 'pm_score': 3, 'selected': True, 'text': '<p>I ended up finding a reasonable solution myself:</p>\n\n<p><a href="https://i.stack.imgur.com/mp3ET.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mp3ET.png" alt="enter image description here"></a></p>\n\n<p>Basically, I diffed two identical, non-hollow geometries, in which the first one had the cells larger than they needed to be (so overlapping with others), and the second one had them exactly of the right dimension:</p>\n\n<pre><code>difference() {\n  base_geometry(range, angle, infill, extra_padding = 2);\n  base_geometry(range, angle, infill, extra_padding = 0);\n}\n</code></pre>\n\n<p>This way the only portion of the solid remaining was the <code>extra_padding</code> on the outer edges of the geometry.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/5035', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/9134/']