Cleanups and some obscure mask madule renaming.

This commit is contained in:
Revar Desmera 2017-08-29 18:57:37 -07:00
parent e01e2f489e
commit 491e47dffa
4 changed files with 69 additions and 34 deletions

View file

@ -5,7 +5,24 @@ This library is a set of useful tools, shapes and manipulators that I developed
projects, including large ones like the Snappy-Reprap printed 3D printer.
# Overview
The library files are as follows:
- ```transforms.scad```: The most commonly used transformations, manipulations, and shortcuts are in this file.
- ```shapes.scad```: Common useful shapes and structured objects.
- ```masks.scad```: Shapes that are useful for masking with ```difference()``` and ```intersect()```.
- ```paths.scad```: Functions and modules to work with arbitrary 3D paths.
- ```bezier.scad```: Functions and modules to work with bezier curves.
- ```involute_gears.scad```: Modules and functions to make involute gears and racks.
- ```metric_screws.scad```: Functions and modules to make holes for metric screws and nuts.
- ```joiners.scad```: Modules to make joiner shapes for connecting separately printed objects.
- ```sliders.scad```: Modules for creating simple sliders and rails.
- ```acme_screws.scad```: Modules to make trapezoidal (ACME) threaded rods and nuts.
- ```nema_steppers.scad```: Modules to make mounting holes for NEMA motors.
- ```linear_bearings.scad```: Modules to make mounts for LMxUU style linear bearings.
- ```wiring.scad```: Modules to render routed bundles of wires.
- ```math.scad```: Useful helper functions and constants.
- ```quaternions.scad```: Functions to work with quaternion rotations.
## transforms.scad
The most commonly useful of the library files is ```transforms.scad```. It provides features such as:
- ```up()```, ```down()```, ```left()```, ```right()```, ```fwd()```, ```back()``` as more readable alternatives to ```translate()```.
- ```xrot()```, ```yrot()```, ```zrot()``` as single-axis alternatives to ```rotate```.
@ -15,6 +32,7 @@ The most commonly useful of the library files is ```transforms.scad```. It prov
- Easy mirroring with ```xflip()```, ```xflip_copy()```, etc.
- Slice items in half with ```top_half()```, ```left_half()```, ```back_half()```, etc.
## shapes.scad
The ```shapes.scad``` library file provides useful compound shapes, such as:
- ```upcube()``` a ridiculously useful version of ```cube()``` that is centered on top of the XY plane.
- Filleted (rounded) and Chamferred (bevelled) cubes and cylinders.
@ -27,3 +45,15 @@ The ```shapes.scad``` library file provides useful compound shapes, such as:
- ```thinning_triangle()``` makes a right triangle which thins in the middle, to reduce print volume.
- ```sparse_strut()``` makes a cross-braced open strut wall, optimized for support-less 3D printing.
- ```corrugated_wall()``` makes a corrugated wall to reduce print volume while keeping strength.
## masks.scad
The ```masks.scad``` library file provides mask shapes like:
- ```angle_pie_mask()``` to mask a pie-slice shape.
- ```chamfer_mask_x()```, ```chamfer_mask_y()```, and ```chamfer_mask_z()``` to chamfer (bevel) an axis aligned 90 degree edge.
- ```fillet_mask_x()```, ```fillet_mask_y()```, and ```fillet_mask_z()``` to fillet (round) an axis aligned 90 degree edge.
- ```fillet_corner_mask()``` to fillet a 90 degree corner.
- ```fillet_angled_edge_mask()``` to fillet an acute or obtuse vertical edge.
- ```fillet_angled_corner_mask()``` to fillet the corner of two acute or obtuse planes.
- ```fillet_cylinder_mask()``` to fillet the end of a cylinder.
- ```fillet_hole_mask()``` to fillet the edge of a cylindrical hole.

View file

@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////////////////
// Square-threaded (ACME) Screw Rods and Nuts
// Trapezoidal-threaded (ACME) Screw Rods and Nuts
//////////////////////////////////////////////////////////////////////
/*

View file

@ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include <transforms.scad>
include <math.scad>
module angle_half_pie_mask(
@ -202,6 +203,9 @@ module fillet_mask(h=1.0, r=1.0, center=true)
);
}
}
module fillet_mask_z(l=1.0, r=1.0) fillet_mask(h=l, r=r, center=true);
module fillet_mask_y(l=1.0, r=1.0) xrot(90) fillet_mask(h=l, r=r, center=true);
module fillet_mask_x(l=1.0, r=1.0) yrot(90) fillet_mask(h=l, r=r, center=true);
// Creates a vertical mask that can be used to fillet the edge where two
@ -213,8 +217,9 @@ module fillet_mask(h=1.0, r=1.0, center=true)
// ang = angle that the planes meet at.
// center = If true, vertically center mask.
// Example:
// fillet_planes_joint_mask(h=50.0, r=10.0, ang=120, $fn=32);
module fillet_planes_joint_mask(h=1.0, r=1.0, ang=90, center=true)
// fillet_angled_edge_mask(h=50.0, r=10.0, ang=120, $fn=32);
// fillet_angled_edge_mask(h=50.0, r=10.0, ang=30, $fn=32);
module fillet_angled_edge_mask(h=1.0, r=1.0, ang=90, center=true)
{
sweep = 180-ang;
n = ceil(segs(r)*sweep/360);
@ -240,8 +245,8 @@ module fillet_planes_joint_mask(h=1.0, r=1.0, ang=90, center=true)
// fillet = radius of the fillet.
// ang = angle between planes that you need to fillet the corner of.
// Example:
// fillet_edge_joint_mask(fillet=100, ang=90);
module fillet_edge_joint_mask(fillet=1.0, ang=90)
// fillet_angled_corner_mask(fillet=100, ang=90);
module fillet_angled_corner_mask(fillet=1.0, ang=90)
{
dy = fillet * tan(ang/2);
th = max(dy, fillet*2);
@ -280,9 +285,9 @@ module fillet_edge_joint_mask(fillet=1.0, ang=90)
// translate([0, 5, 8]) yrot(90) fillet_mask(h=7, r=3);
// translate([3, 0, 8]) xrot(90) fillet_mask(h=11, r=3);
// translate([3, 5, 0]) fillet_mask(h=17, r=3);
// translate([3, 5, 8]) corner_fillet_mask(r=3);
// translate([3, 5, 8]) fillet_corner_mask(r=3);
// }
module corner_fillet_mask(r=1.0)
module fillet_corner_mask(r=1.0)
{
difference() {
cube(size=r*2, center=true);
@ -291,7 +296,7 @@ module corner_fillet_mask(r=1.0)
}
}
}
//!corner_fillet_mask(r=10.0);
//!fillet_corner_mask(r=10.0);
// Create a mask that can be used to round the end of a cylinder.

View file

@ -351,6 +351,32 @@ module trapezoid(size1=[1,1], size2=[1,1], h=1, center=false)
}
// Makes a teardrop shape in the XZ plane. Useful for 3D printable holes.
// r = radius of circular part of teardrop. (Default: 1)
// h = thickness of teardrop. (Default: 1)
// Example:
// teardrop(r=3, h=2, ang=30);
module teardrop(r=1, h=1, ang=45, $fn=undef)
{
$fn = ($fn==undef)?max(12,floor(180/asin(1/r)/2)*2):$fn;
xrot(90) union() {
translate([0, r*sin(ang), 0]) {
scale([1, 1/tan(ang), 1]) {
difference() {
zrot(45) {
cube(size=[2*r*cos(ang)/sqrt(2), 2*r*cos(ang)/sqrt(2), h], center=true);
}
translate([0, -r/2, 0]) {
cube(size=[2*r, r, h+1], center=true);
}
}
}
}
cylinder(h=h, r=r, center=true);
}
}
// Created a sphere with a conical hat, to make a 3D teardrop.
// r = radius of spherical portion of the bottom. (Default: 1)
// d = diameter of spherical portion of bottom. (Use instead of r)
@ -495,32 +521,6 @@ module arced_slot(
}
// Makes a teardrop shape in the XZ plane. Useful for 3D printable holes.
// r = radius of circular part of teardrop. (Default: 1)
// h = thickness of teardrop. (Default: 1)
// Example:
// teardrop(r=3, h=2, ang=30);
module teardrop(r=1, h=1, ang=45, $fn=undef)
{
$fn = ($fn==undef)?max(12,floor(180/asin(1/r)/2)*2):$fn;
xrot(90) union() {
translate([0, r*sin(ang), 0]) {
scale([1, 1/tan(ang), 1]) {
difference() {
zrot(45) {
cube(size=[2*r*cos(ang)/sqrt(2), 2*r*cos(ang)/sqrt(2), h], center=true);
}
translate([0, -r/2, 0]) {
cube(size=[2*r, r, h+1], center=true);
}
}
}
}
cylinder(h=h, r=r, center=true);
}
}
// Makes a rectangular strut with the top side narrowing in a triangle.
// The shape created may be likened to an extruded home plate from baseball.
// This is useful for constructing parts that minimize the need to support