![]() |
omdl
v1.0
OpenSCAD Mechanical Design Library
|
Sizable polyhedra generated from shape database. More...
Collaboration diagram for Polyhedrons db:Files | |
| file | polyhedron_db.scad |
| Sizable polyhedra generated from shape database. | |
Functions and/or Modules | |
| function | ph_db_get_size (tr=ph_db_dtr) |
| Get the number of shape identifiers in data table. More... | |
| function | ph_db_get_id (n, tr=ph_db_dtr) |
| Get data table identifier name (or names). More... | |
| module | ph_db_polyhedron (id, size, align, tr=ph_db_dtr, tc=ph_db_dtc) |
| Construct a named polyhedron. More... | |
Variables | |
| ph_db_dtc = dtc_polyhedra_polyhedra_all | |
| <map> The default polyhedra data table columns. | |
| ph_db_dtr = dtr_polyhedra_polyhedra_all | |
| <table> The default polyhedra data table rows. | |
Sizable polyhedra generated from shape database.
| Requires: |
|---|
| include <omdl-base.scad>; |
| include <database/geometry/polyhedra/polyhedra_all.scad>; |
| include <shapes/polyhedron_db.scad>; |
To work with a smaller polyhedra data set, include the specific table of interest rather than polyhedra_all.scad, as shown in the following example. For a list of those available, see the polyhedra database section.
Here is an example that uses a limited set.
Cupolas example script
| top | bottom | diag |
|---|---|---|
![]() | ![]() | ![]() |
| function ph_db_get_size | ( | tr | = ph_db_dtr | ) |
Get the number of shape identifiers in data table.
| tr | <table> The polyhedra data table rows. |
Here is the caller graph for this function:| function ph_db_get_id | ( | n | , |
| tr | = ph_db_dtr |
||
| ) |
Get data table identifier name (or names).
| n | <integer> An index number. |
| tr | <table> The polyhedra data table rows. |
n or the list of all identifier names for n = 0.Identifiers numbering start from 1 and end at ph_db_get_size().
Here is the caller graph for this function:Construct a named polyhedron.
| id | <string> The polyhedron identifier name. |
| size | <decimal-list-3 | decimal> A list [x, y, z] of decimals or a single decimal for (x=y=z). |
| align | <decimal-list-3 | decimal> A list [x, y, z] of decimals or a single decimal for (x=y=z). |
| tr | <table> The polyhedra data table rows. |
| tc | <map> The polyhedra data table columns. |
The polyhedron is constructed at the origin and can be repositioned using align. Each axis is aligned independently, with 0 indicating the center, +1 the positive bounds, and -1 the negative bounds. Fractional alignments and alignment values with magnitudes greater than 1 are also supported.
| align | value description |
|---|---|
| 0 | align at bounding box center |
| -1 | align axis at lower shape bounds |
| +1 | align axis at upper shape bounds |
Using this module, polyhedron can be incorporated into designs as shown in this simple example.
Design example script
| front | diag |
|---|---|
![]() | ![]() |
Definition at line 554 of file polyhedron_db.scad.
Here is the call graph for this function:
Here is the caller graph for this function: