openscad-polyhedra

openscad-polyhedra

Description

This is an OpenSCAD library intended to be used as part of other projects. I printed a few of the polyhedra as wireframe shapes using MeshMixer to generate supports. The arrays and utility functions included here can be used to place modules coincident with the vertices, edges and faces of the Platonic and Archimedean solids. All polyhedra are centered at the origin and have an edge length of 1. Included polyhedra: - tetrahedron - octahedron - hexahedron - icosahedron - dodecahedron - cubeoctahedron - truncated_tetrahedron - snub_cube - rhombicuboctahedron - truncated_hexahedron - truncated_octahedron - icosidodecahedron - snub_dodecahedron - rhombicosidodecahedron - truncated_cuboctahedron - truncated_icosahedron - truncated_dodecahedron - truncated_icosidodecahedron Each shape includes an array of vertices, edges, adjacent_vertices, and faces. Archimedean solids also include separate arrays of faces that are of the same polygon shape. Example: - snub_dodecahedron_vertices - an array of 3-vectors - snub_dodecahedron_edges - an array of 2-tuples containing indexes into the vertices array, one tuple for each edge. - snub_dodecahedron_adjacent_vertices - an array of arrays, each containing indexes into the vertex array. For example, snub_dodecahedron_adjacent_vertices[3] is an array containing the indexes of vertices that are connected to snub_dodecahedron_vertices[3] by an edge - snub_dodecahedron_triangle_faces and snub_dodecahedron_pentagon_faces contain arrays with indices in the vertex array for each triangular and pentagonal face, respectively - snub_dodecahedron_faces contains all faces Usage: ``` // add polyhedra.scad to your project and include it include<polyhedra.scad>; // to arrange modules at vertices for(i=[0:len(snub_dodecahedron_vertices)-1]) orient_vertex( snub_dodecahedron_vertices[i], snub_dodecahedron_vertices[snub_dodecahedron_adjacent_vertices[i][0]] ) // your vertical module centered at the origin here. For example: sphere(r=0.2,$fn=64); // to arrange modules along the edges for(i=[0:len(snub_dodecahedron_edges)-1]) orient_edge( snub_dodecahedron_vertices[snub_dodecahedron_edges[i][0]], snub_dodecahedron_vertices[snub_dodecahedron_edges[i][1]] ) // your vertical module centered at the origin here. For example: cylinder(height=1,r=0.1,center=true,$fn=32); // to arrange modules on the faces for(i=[0:len(snub_dodecahedron_faces)-1]) orient_face( map_verts(snub_dodecahedron_vertices, snub_dodecahedron_faces[i]) ) // your module on the x-y plane here, centered at the origin. For example: rotate(180/len(snub_dodecahedron_faces[i])-90) cylinder(r=0.3,h=0.02,$fn=len(snub_dodecahedron_faces[i])); // to construct a solid polyhedron( points = snub_dodecahedron_vertices, faces = snub_dodecahedron_faces ); ``` Fork it on GitHub: https://github.com/benjamin-edward-morgan/openscad-polyhedra

Statistics

Likes

33

Downloads

0

Category

Parts