<p>I ended up finding a reasonable solution myself:</p>

<p><a href="https://i.sstatic.net/mp3ET.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mp3ET.png" alt="enter image description here"></a></p>

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

<pre><code>difference() {
  base_geometry(range, angle, infill, extra_padding = 2);
  base_geometry(range, angle, infill, extra_padding = 0);
}
</code></pre>

<p>This way the only portion of the solid remaining was the <code>extra_padding</code> on the outer edges of the geometry.</p>

CC BY-SA 3.0
2017-11-29T17:49:06.753Z
Now I understand what you were after. I was going to ask you to provide a drawing, but you've done a lot better than that.
Mick
CC BY-SA 3.0
2017-11-28T01:07:01.657Z
2017-11-28T01:07:01.657Z
mac
<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>

<p>If you want to do it all in OpenSCAD, then I would go about it like this:</p>

<ol>
<li>Create a 2D grid, similar to what you have now.</li>
<li>Create a 2D outline of the shape you want, undersized so that you can add a manifold (as a perimeter).</li>
<li>Duplicate this shape.</li>
<li>Add a manifold to the first copy.</li>
<li>Create an intersection of the second copy and the grid.</li>
<li>Create a union of the two copies.</li>
<li>Extrude the union.</li>
</ol>

CC BY-SA 3.0
2017-11-27T21:32:55.373Z
I believe I failed at being clear enough on what I want to achieve (sorry, I lack the proper terminology from CAD and/or mathematics): I don't want the internal grid at all.  I want only the perimeter of the shape I generated, as in: the external, non-adjacent-to-another-hex, sides of the hexagons at the edge of my surface... There is something interesting about your proposal though, maybe part of the solution I am looking for... and that is: adding manifolds.  How can I do that, having an existing geometry?
mac
CC BY-SA 3.0
2017-11-27T14:26:53.853Z
2017-11-27T14:39:16.203Z
2017-11-27T14:39:16.203Z
Mick
<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.sstatic.net/vzJD0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/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>

CC BY-SA 3.0
2017-11-27T14:44:10.240Z
Are you looking to generate a convex hull, or do you just want to remove all the internal edges?
Mick
CC BY-SA 3.0
2017-11-27T19:29:08.103Z
If you are unable to find a solution here, consider to join the openSCAD mailing list/forum as there are some quite skilled and talented brains who are really on top of things.
fred_dot_u
CC BY-SA 3.0
2017-11-27T21:35:55.230Z
@Mick - I'm not sure I am knowledgeable enough to understand your question (I lack the terminology), but I already tried the `hull()` function (if that is what you were going for), and it does not do what I want, as it doesn't contour my shape, it "wraps" it by making a straight line between the most protruding points of each side of it...
mac
<3d-design><openscad>
How to remove internal part of a hex grid
mac
# How to remove internal part of a hex grid

(Asked by: username_0 on 2017-11-27)

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.

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.

Everything works as expected...

[![Range = 15, Angle = 60°](https://i.sstatic.net/vzJD0.png)](https://i.sstatic.net/vzJD0.png)

...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).

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).

**Tags:** 3d-design, openscad

> **Comments:**
> **username_1**: Are you looking to generate a convex hull, or do you just want to remove all the internal edges?  
> **username_2**: If you are unable to find a solution here, consider to join the openSCAD mailing list/forum as there are some quite skilled and talented brains who are really on top of things.  
> **username_0**: @username_1 - I'm not sure I am knowledgeable enough to understand your question (I lack the terminology), but I already tried the `hull()` function (if that is what you were going for), and it does not do what I want, as it doesn't contour my shape, it "wraps" it by making a straight line between the most protruding points of each side of it...  

---

## 2 answers

### Answer by username_0 on 2017-11-28. Score: 3 | Accepted answer

I ended up finding a reasonable solution myself:

[![enter image description here](https://i.sstatic.net/mp3ET.png)](https://i.sstatic.net/mp3ET.png)

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:

```
difference() {
  base_geometry(range, angle, infill, extra_padding = 2);
  base_geometry(range, angle, infill, extra_padding = 0);
}

```

This way the only portion of the solid remaining was the `extra_padding` on the outer edges of the geometry.

> **Comments:**
> **username_1**: Now I understand what you were after. I was going to ask you to provide a drawing, but you've done a lot better than that.  

---

### Answer by username_1 on 2017-11-27. Score: 0

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.

If you want to do it all in OpenSCAD, then I would go about it like this:

1. Create a 2D grid, similar to what you have now.
2. Create a 2D outline of the shape you want, undersized so that you can add a manifold (as a perimeter).
3. Duplicate this shape.
4. Add a manifold to the first copy.
5. Create an intersection of the second copy and the grid.
6. Create a union of the two copies.
7. Extrude the union.

> **Comments:**
> **username_0**: I believe I failed at being clear enough on what I want to achieve (sorry, I lack the proper terminology from CAD and/or mathematics): I don't want the internal grid at all.  I want only the perimeter of the shape I generated, as in: the external, non-adjacent-to-another-hex, sides of the hexagons at the edge of my surface... There is something interesting about your proposal though, maybe part of the solution I am looking for... and that is: adding manifolds.  How can I do that, having an existing geometry?  

---

