# [OpenSCAD] Polyhedron tube with irregular sides -- is it possible ?

don bright hmbright at fastmail.fm
Mon Sep 14 18:49:48 EDT 2015

```polyhedron() cannot do "faces with holes" currently as far as i know.

However there is a work-around. It is called the Keyhole Polygon...

Basically you take any polygon with a single hole... and pretend you
slice a knife down from the outside of the polygon, straight down, until
you cut into the hole. What you end up with is a single polygon without
any holes. Here is a picture

https://sozvyezdami.files.wordpress.com/2013/04/11.png?w=640

The caveat that the new edges you create by cutting will be coincident
with each other.... and the 'points' or 'nodes' of those new edges will
also be coincident, which can be a problem for some polygon processing
algorithms. However it appears to work on your basic example in
OpenSCAD. Here is your code rewritten to have two 'keyhole' polygons on
top and bottom.

pts =  [[0, 0, 0], [6, 0, 0], [6, 5, 0], [0, 5, 0], [2, 1, 0], [5, 2,
0],
[3, 4, 0], [0, 0, 3], [6, 0, 3], [6, 5, 3], [0, 5, 3], [2, 1, 3], [5, 2,
3], [3, 4, 3]];

faces1= [[0, 7, 8, 1], [1, 8, 9, 2], [2, 9, 10, 3], [3, 10, 7, 0],
[4, 5,12, 11], [5, 6, 13, 12], [6, 4, 11, 13],
[0, 1, 2, 3, 4, 6, 5, 4, 3],
[10, 9, 8, 7, 11, 12, 13, 11, 7]];
polyhedron( points = pts, faces = faces1  );

Also i had to re-order some of the vertices, as viewable in
'View/ThrownTogether' mode within OpenSCAD to make sure there were no
naughty purples. Hope this helps!

-don bright
hmbright at fastmail.fm

```