![]() |
omdl
v1.0
OpenSCAD Mechanical Design Library
|
Selection and configuration for common 3D shapes. More...
Collaboration diagram for Select Common 3d:Files | |
| file | select_common_3d.scad |
| A standard selection and configuration scheme for common 3D shape construction. | |
Functions and/or Modules | |
| module | select_common_3d_shape (type=0, argv, center=false, verb=0) |
| Select configure and construct one of the available 3d shapes. More... | |
Selection and configuration for common 3D shapes.
| Requires: |
|---|
| include <omdl-base.scad>; |
| include <shapes/select_common_3d.scad>; |
| module select_common_3d_shape | ( | type | = 0, |
| argv | , | ||
| center | = false, |
||
| verb | = 0 |
||
| ) |
Select configure and construct one of the available 3d shapes.
| type | <integer> Shape type index. |
| argv | <decimal-list | decimal> Shape dependent argument vector. |
| center | <boolean> Center about origin. |
| verb | <integer> Output verbosity (0-2). |
This module provides a standard scheme for selecting and configuring the arguments of most 3D shapes available in the library, offering a consistent and flexible way to include, configure, and modify 3D shapes.
Each shape is configured using the parameter argv. The four elements of this parameter are as follows:
| e | data type | default value | parameter description |
|---|---|---|---|
| 0 | decimal-list-n | decimal | 1 | size : shape size |
| 1 | decimal-list-n | decimal | undef | vr (sr) : shape rounding |
| 2 | integer-list-n | integer | 0 | vrm : shape rounding mode |
| 3 | integer | 5 | fn : shape rounding facets |
| 4 | integer | 0 | shape modifier |
| v | modifier description |
|---|---|
| 0 | none |
Dimensioning is shape dependent. The required dimensioning arguments for each supported shape are shown in the following table. All supported shapes and their associated arguments are summarized in the following table:
| t | shapes | parameters | shape reference |
|---|---|---|---|
| 1 | cylinder | h, r1, r2 | cylinder() |
| 2 | cone | size | cone() |
| 3 | cuboid | size | cuboid() |
| 4 | ellipsoid | size | ellipsoid() |
| 5 | ellipsoid section | size, a1, a2 | ellipsoid_s() |
| 6 | quadratic pyramid | size | pyramid_t() |
| 7 | triangular pyramid | size | pyramid_q() |
| 8 | star 3d | size, n, half | star3d() |
| 100+ | Polyhedrons database | size | (see below) |
Selection example script
| top | front | diag |
|---|---|---|
![]() | ![]() | ![]() |
| t | shapes | parameters | function invocation name |
|---|---|---|---|
| 50 | custom shape 1 | size | select_common_3d_shape_50() |
| 51 | custom shape 2 | size | select_common_3d_shape_51() |
| 52 | custom shape 3 | size | select_common_3d_shape_52() |
| 53 | custom shape 4 | size | select_common_3d_shape_53() |
| 54 | custom shape 5 | size | select_common_3d_shape_54() |
User-defined custom shape functions can be selected by defining a shape function using one of the reserved custom shape function names, and then referencing the corresponding shape type listed in the table above. The custom function prototype and an example is provided below.
Prototype:
Custom shape example script
| top | front | diag |
|---|---|---|
![]() | ![]() | ![]() |
| Requires: |
|---|
| include <omdl-base.scad>; |
| include <database/geometry/polyhedra/polyhedra_all.scad>; |
| include <shapes/polyhedron_db.scad>; |
| include <shapes/select_common_3d.scad>; |
Polyhedra available through ph_db_polyhedron() may also be included in the 3d shape selection options. These shapes are accessible when the ph_db_polyhedron() module is included as shown under ‘Requires:’ above. As described in its documentation, a polyhedron database must also be included. In this example below, the polyhedra_all database is used; however, a smaller database may be configured instead, as described in the ph_db_polyhedron() documentation.
Polyhedrons database selection example script
| top | front | diag |
|---|---|---|
![]() | ![]() | ![]() |
Definition at line 809 of file select_common_3d.scad.
Here is the call graph for this function:
Here is the caller graph for this function: