Altair's 2D Library for OpenSCAD is a library of useful functions, modules and constants for 2D drawing in OpenSCAD. Technical 3D models often have some basis in 2D and then they are extruded to 3D. This library can greatly simplify such code.
To use the library in your model, copy it alongside the SCAD file and include the following lines in your code:
include <A2D.scad>; // https://github.com/ridercz/A2D assert(a2d_required([1, 6, 0]), "Please upgrade A2D library to version 1.6.0 or higher.");
Although only the
include <A2D.scad>; part is really necessary, the code has two best practices:
- Include link to the project homepage, because your model could not be built without the library and the link will indicate where the library is supposed to be downloaded from.
Check for minimum required version, because someone might have older version of the library, which does not support the required features. The library version can be found in comment at the beginning of the
A2D.scadfile or on the releases page.
The library requires OpenSCAD version 2019.05, which is current version at time of writing. Should be compatible with further versions as well.
Functions and modules in this library do a decent amount of checking if the arguments have sane values. But it's up to users to maintain reasonable relation of sizes and corner radius etc.
- Constants useful for 2D drawing.
- Point Generators are functions spewing a list of useful points (coordinates).
- Shapes which are hollow, have rounded corners and other interesting properties.
- Text Modules for multi-line and rounded text.
- Functions for working with 2D points.
- Grill Masks for generating vent grills.
- Transformations for making things round.