4

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°

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

mac
  • 4,557
  • 1
  • 12
  • 35
  • Are you looking to generate a convex hull, or do you just want to remove all the internal edges? – Mick Nov 27 '17 at 14:44
  • 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 Nov 27 '17 at 19:29
  • @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 Nov 27 '17 at 21:35

2 Answers2

3

I ended up finding a reasonable solution myself:

enter image description here

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.

mac
  • 4,557
  • 1
  • 12
  • 35
  • 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. – Mick Nov 29 '17 at 17:49
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.
Mick
  • 3,002
  • 1
  • 9
  • 20
  • 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 Nov 27 '17 at 21:32