Skip to content

Instantly share code, notes, and snippets.

@Nesciosquid Nesciosquid/threeAxisAligner.scad Secret
Last active Feb 29, 2016

Embed
What would you like to do?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$fn = 30;
// Colors, for the alignment assembly render
red = [244/255, 67/255, 54/255, 1];
indigo = [63/255, 81/255, 181/255, 1];
amber = [255/255, 193/255, 7/255, 1];
green = [76/255, 175/255, 80/255, 1];
LASER_DIODE_DIAMETER = 10.5;
LASER_DIODE_LENGTH = 30;
laserHoleDepth = 10;
laserHoleDiameter = LASER_DIODE_DIAMETER + .5;
LENS_TUBE_DIAMETER = 18.1;
LENS_TUBE_LENGTH = 8;
ADAPTER_WALL_THICKNESS = 2;
FRAME_PLATE_BUFFER = 4;
FRAME_PLATE_THICKNESS = 5;
FRAME_SCREW_DIAMETER = 4;
FRAME_NUT_DIAMETER = 9.4;
FRAME_NUT_DEPTH = 2.5;
FRAME_PLATE_RANGE = 20;
FRAME_SPACER_DEPTH = 3;
SUPPORT_LINE_WIDTH = .41;
MOUNTING_HOLE_SPACING_Y = 20;
MOUNTING_HOLE_COUNT_Y = 6;
frameCenterObjectWidth = LENS_TUBE_DIAMETER + ADAPTER_WALL_THICKNESS*2 + 1;
frontPlateWidth = frameCenterObjectWidth + FRAME_PLATE_BUFFER*4 + FRAME_SCREW_DIAMETER*2;
frontPlateHeight = FRAME_PLATE_RANGE + FRAME_PLATE_BUFFER*2;
frontPlateSlideOffsetX = frameCenterObjectWidth/2 + FRAME_PLATE_BUFFER + FRAME_SCREW_DIAMETER/2;
//middlePlateWidth = frameCenterObjectWidth + FRAME_PLATE_BUFFER*2;
middlePlateWidth = frameCenterObjectWidth + FRAME_PLATE_BUFFER*2;
middlePlateCenterHoleHeight = frameCenterObjectWidth + FRAME_PLATE_RANGE;
middlePlateCenterHoleWidth = frameCenterObjectWidth;
middlePlateHeight = middlePlateCenterHoleHeight + FRAME_PLATE_BUFFER*4 + FRAME_SCREW_DIAMETER*2;
backPlateSliderOffsetY = middlePlateCenterHoleHeight/2 + FRAME_PLATE_BUFFER + FRAME_SCREW_DIAMETER/2;
backPlateCenterHoleHeight = middlePlateCenterHoleHeight;
backPlateCenterHoleWidth = backPlateCenterHoleHeight;
backPlateWidth = backPlateCenterHoleWidth + FRAME_PLATE_BUFFER*2;
backPlateHeight = backPlateCenterHoleHeight + FRAME_PLATE_BUFFER*4 + FRAME_SCREW_DIAMETER*2;
zSlideHeight = FRAME_PLATE_THICKNESS;
zSlideWidth = FRAME_PLATE_BUFFER*2 + FRAME_SCREW_DIAMETER;
zSlideLength = FRAME_PLATE_BUFFER*2 + FRAME_PLATE_RANGE + FRAME_PLATE_THICKNESS;
zSlideOffsetX = backPlateWidth/2 + zSlideWidth/2;
zSlideOffsetY = backPlateHeight/2 - FRAME_PLATE_THICKNESS/2;
zSlideOffsetZ = zSlideLength/2 - FRAME_PLATE_THICKNESS/2;
screwHoleBlockWidth = FRAME_SCREW_DIAMETER + FRAME_PLATE_BUFFER*2;
mountingPlateWidth = backPlateWidth + zSlideWidth*2;
mountingPlateHeight = MOUNTING_HOLE_SPACING_Y*(MOUNTING_HOLE_COUNT_Y-1)+ FRAME_PLATE_BUFFER*2 + FRAME_SCREW_DIAMETER;
mountingPlateThickness = FRAME_PLATE_THICKNESS + FRAME_SPACER_DEPTH;
mountingPlateHoleOffsetY = mountingPlateHeight /2 - FRAME_PLATE_BUFFER - FRAME_SCREW_DIAMETER/2;
mountingPlateHoleOffsetX = mountingPlateWidth /2 - FRAME_PLATE_BUFFER - FRAME_SCREW_DIAMETER/2;
//nutTest(FRAME_PLATE_THICKNESS);
rotate([90,0,180]){
alignmentAssembly(FRAME_PLATE_THICKNESS*1.5);
}
//centeredSpacerHole();
//frontPlateWithAdapter();
//middlePlate();
//backPlate();
//laserTubeAdapter();
//printableAssembly();
//mountingPlate();
//hexGrid(10,10, 5, 10, 1);
//sizedHexGrid(40, 60, 16, 14, 2);
module sizedHexGrid(width, height, radius, thickness, buffer){
hexDistance = cos(30) * radius;
offsetDistance = hexDistance + buffer;
xOffset = sin(60) * offsetDistance;
yOffset = cos(60) * offsetDistance;
maxXCount = floor(width / xOffset);
maxYCount = floor(height / offsetDistance);
gridWidth = radius + (xOffset*(maxXCount-1));
gridHeight = radius + (offsetDistance * (maxYCount-1));
gridOffsetX = (width - gridWidth)/2 + radius/2;
gridOffsetY = (height - gridHeight)/2 + radius/2;
translate([-width/2, -height/2,-thickness/2]){
intersection(){
cube([width, height, thickness]);
translate([gridOffsetX, gridOffsetY,0]){
hexGrid(maxXCount, maxYCount, radius, thickness, buffer);
}
}
}
}
module hexGrid(xCount, yCount, radius, thickness, buffer){
for (i=[0:xCount-1]){
hexDistance = cos(30) * radius;
offsetDistance = hexDistance + buffer;
xOffset = sin(60) * offsetDistance;
yOffset = cos(60) * offsetDistance;
if (i % 2 == 0){
translate([xOffset*i, 0, 0]){
hexLine(yCount, radius, thickness, buffer);
}
}
else {
translate([xOffset*i, yOffset, 0]){
hexLine(yCount-1, radius, thickness, buffer);
}
}
}
}
module hexLine(count, radius, thickness, buffer){
for (i=[0:count-1]){
hexDistance = cos(30) * radius;
yOffset = i * (hexDistance + buffer);
translate([0,yOffset, 0]){
hex(radius, thickness);
}
}
}
module mountingPlate(){
difference(){
cube([mountingPlateWidth, mountingPlateHeight, mountingPlateThickness], true);
translate([-mountingPlateHoleOffsetX,-mountingPlateHoleOffsetY,-FRAME_SPACER_DEPTH/2]){
mountingHoles();
}
translate([mountingPlateHoleOffsetX,-mountingPlateHoleOffsetY,-FRAME_SPACER_DEPTH/2]){
mountingHoles();
}
sizedHexGrid(backPlateWidth, mountingPlateHeight - FRAME_PLATE_BUFFER*2, backPlateWidth/3, mountingPlateThickness+1, 2, true);
}
}
module mountingHoles(){
for (i = [0:MOUNTING_HOLE_COUNT_Y-1]){
translate([0,i*MOUNTING_HOLE_SPACING_Y,0]){
centeredSpacerHole();
}
}
}
module frontPlate(){
difference(){
cube([frontPlateWidth, frontPlateHeight, FRAME_PLATE_THICKNESS], true);
translate([-frontPlateSlideOffsetX, 0,0]){
centeredHole(FRAME_SCREW_DIAMETER, FRAME_PLATE_RANGE);
}
translate([frontPlateSlideOffsetX, 0,0]){
centeredHole(FRAME_SCREW_DIAMETER, FRAME_PLATE_RANGE);
}
}
}
module centeredHole(width, height){
translate([0,0,0]){
cube([width, height, FRAME_PLATE_THICKNESS+1],true);
}
}
module screwHoleSupport() {
height = FRAME_PLATE_THICKNESS - FRAME_NUT_DEPTH;
translate([0,0,-FRAME_PLATE_THICKNESS + FRAME_NUT_DEPTH]){
difference(){
cylinder(height, d = (FRAME_SCREW_DIAMETER + SUPPORT_LINE_WIDTH*2));
cylinder(height, d=FRAME_SCREW_DIAMETER);
}
}
}
module spacerHoleSupport() {
height = FRAME_PLATE_THICKNESS + FRAME_SPACER_DEPTH;
translate([0,0,-FRAME_PLATE_THICKNESS/2]){
difference(){
cylinder(height, d = (FRAME_SCREW_DIAMETER + SUPPORT_LINE_WIDTH*2));
cylinder(height, d=FRAME_SCREW_DIAMETER);
}
}
}
module zSlider(){
difference() {
cube([zSlideWidth, zSlideHeight, zSlideLength], true);
translate([0,0,FRAME_PLATE_THICKNESS/2]){
cube([FRAME_SCREW_DIAMETER, zSlideHeight+.03, FRAME_PLATE_RANGE], true);
}
}
}
module middlePlate(){
difference(){
union(){
cube([middlePlateWidth, middlePlateHeight, FRAME_PLATE_THICKNESS],true);
translate([-frontPlateSlideOffsetX, 0,FRAME_SPACER_DEPTH/2]){
screwHoleBlock();
}
translate([frontPlateSlideOffsetX, 0,FRAME_SPACER_DEPTH/2]){
screwHoleBlock();
}
}
centeredHole(middlePlateCenterHoleWidth, middlePlateCenterHoleHeight);
translate([0,-backPlateSliderOffsetY,0]){
centeredHole(FRAME_PLATE_RANGE, FRAME_SCREW_DIAMETER);
}
translate([0,backPlateSliderOffsetY,0]){
centeredHole(FRAME_PLATE_RANGE, FRAME_SCREW_DIAMETER);
}
translate([-frontPlateSlideOffsetX, 0,0]){
centeredSpacerHole();
}
translate([frontPlateSlideOffsetX, 0,0]){
centeredSpacerHole();
}
}
}
module backPlate(){
difference(){
union(){
cube([backPlateWidth, backPlateHeight, FRAME_PLATE_THICKNESS],true);
translate([0,backPlateSliderOffsetY, FRAME_SPACER_DEPTH/2]){
screwHoleBlock();
}
translate([0,-backPlateSliderOffsetY, FRAME_SPACER_DEPTH/2]){
screwHoleBlock();
}
}
centeredHole(backPlateCenterHoleWidth, backPlateCenterHoleHeight);
translate([0,backPlateSliderOffsetY, 0]){
centeredSpacerHole(true);
}
translate([0,-backPlateSliderOffsetY, 0]){
centeredSpacerHole(true);
}
}
translate([0,backPlateSliderOffsetY,0]){
spacerHoleSupport();
}
translate([0,-backPlateSliderOffsetY,0]){
spacerHoleSupport();
}
translate([-zSlideOffsetX,-zSlideOffsetY,zSlideOffsetZ]){
zSlider();
}
translate([zSlideOffsetX,-zSlideOffsetY,zSlideOffsetZ]){
zSlider();
}
}
module screwHoleBlock(){
difference(){
cube([screwHoleBlockWidth, screwHoleBlockWidth, FRAME_PLATE_THICKNESS + FRAME_SPACER_DEPTH],true);
}
}
module centeredSpacerHole(flip){
if (flip){
rotate([180,0,0]){
translate([0,0,-FRAME_PLATE_THICKNESS/2 - FRAME_SPACER_DEPTH ]){
spacerNutHole();
}
}
}
else {
translate([0,0,-FRAME_PLATE_THICKNESS/2]){
spacerNutHole();
}
}
}
module centeredNutHole(flip=false, rotate=false){
if (flip){
rotate([180,0,0]){
translate([0,0,-FRAME_PLATE_THICKNESS/2]){
standardNutHole();
}
}
}
else {
translate([0,0,-FRAME_PLATE_THICKNESS/2]){
standardNutHole();
}
}
}
module spacerNutHole() {
frameNutHole(FRAME_NUT_DIAMETER, FRAME_NUT_DEPTH + FRAME_SPACER_DEPTH, FRAME_SCREW_DIAMETER, FRAME_PLATE_THICKNESS + FRAME_SPACER_DEPTH);
}
module standardNutHole(){
frameNutHole(FRAME_NUT_DIAMETER, FRAME_NUT_DEPTH, FRAME_SCREW_DIAMETER, FRAME_PLATE_THICKNESS);
}
module frontPlateWithAdapter(){
difference(){
union(){
frontPlate();
translate([0,0,-FRAME_PLATE_THICKNESS/2]){
laserTubeAdapter();
}
}
translate([0,0,-laserHoleDepth/2]){
laserHole();
}
}
}
module alignmentAssembly(spacing = FRAME_PLATE_THICKNESS){
rotate([180,0,0]){
color(indigo){
frontPlateWithAdapter();
}
}
color(amber){
rotate([180,0,0]){
translate([0,0,spacing ]){
middlePlate();
}
}
}
color(red){
translate([0,0,-spacing*2 - FRAME_SPACER_DEPTH]){
backPlate();
}
}
}
module printableAssembly(){
rotate([0,0,90]){
frontPlateWithAdapter();
//frontPlate();
}
translate([-backPlateWidth/2 - frontPlateHeight/2 - FRAME_PLATE_BUFFER,0,0]){
backPlate();
}
translate([frontPlateHeight/2 + middlePlateWidth/2 + FRAME_PLATE_BUFFER*2+ FRAME_SCREW_DIAMETER ,0,0]){
middlePlate();
}
}
module spacer(thickness){
width = FRAME_PLATE_BUFFER*2 + FRAME_SCREW_DIAMETER;
difference(){
cylinder(thickness, d=width);
translate([0, 0, -.5]){
cylinder(thickness+1, d=FRAME_SCREW_DIAMETER);
}
}
}
module nutTest(thickness){
width = FRAME_PLATE_BUFFER*2 + FRAME_SCREW_DIAMETER;
difference(){
cube([width, width, thickness]);
translate([width/2, width/2, 0]){
frameNutHole(FRAME_NUT_DIAMETER, FRAME_NUT_DEPTH, FRAME_SCREW_DIAMETER, FRAME_PLATE_THICKNESS);
}
}
}
module hex(width, height){
cylinder(height, width/2, width/2, $fn=6);
}
module frameNutHole(nutWidth, nutDepth, screwDiameter, screwThickness){
color("red"){
holeDepth = screwThickness+.04;
nutHoleDepth = nutDepth+.04;
translate([0,0,-.02]){
cylinder(holeDepth, d=screwDiameter);
}
translate([0,0,screwThickness - nutDepth]){
rotate([0,0,30]){
hex(nutWidth, nutHoleDepth);
}
}
}
}
module frameAssemblyNew(range, screwDiameter, nutDiameter, nutDepth, width, buffer, thickness){
firstFrameHeight = width;
firstFrameWidth = range;
secondFrameHeight = firstFrameWidth + buffer*2 + screwDiameter*2;
secondFrameWidth = secondFrameHeight;
translate([firstFrameHeight + buffer*2 + screwDiameter*2,-buffer*2 - range/2,-thickness*2]){
rotate([0,0,90]){
framePlateNew(firstFrameHeight, firstFrameWidth, screwDiameter, nutDiameter, nutDepth, buffer, thickness);
}
}
translate([-screwDiameter*2 - buffer*3,-screwDiameter*2 - buffer*3,-thickness*4]){
framePlateNew(secondFrameHeight, secondFrameWidth, screwDiameter, nutDiameter, nutDepth, buffer, thickness);
}
}
module frameAssembly(range, screwDiameter, nutDiameter, nutDepth, width, buffer, thickness){
firstFrameHeight = width;
firstFrameWidth = width + range;
secondFrameHeight = firstFrameWidth + buffer*2 + screwDiameter*2;
secondFrameWidth = secondFrameHeight;
translate([firstFrameHeight + buffer*2 + screwDiameter*2,-buffer*2 - range/2,-thickness*2]){
rotate([0,0,90]){
framePlate(screwDiameter, nutDiameter, nutDepth, firstFrameHeight, firstFrameWidth, buffer, thickness);
}
}
translate([-screwDiameter*2 - buffer*3,-screwDiameter*2 - buffer*3,-thickness*4]){
//translate([-secondFrameWidth/2 + buffer*2 + screwDiameter + range,-secondFrameWidth - buffer*2 - range,thickness*2]){
framePlate(screwDiameter, nutDiameter, nutDepth, secondFrameHeight, secondFrameWidth, buffer, thickness);
//}
}
}
module laserTubeAdapter() {
difference(){
adapterCasing();
laserHole();
translate([0,0,laserHoleDepth]) {
lensTubeHole();
}
}
}
module lensTubeHole(){
cylinder(LENS_TUBE_LENGTH+.02, d=LENS_TUBE_DIAMETER, false);
}
module adapterCasing() {
dia = LENS_TUBE_DIAMETER + ADAPTER_WALL_THICKNESS*2;
depth = LENS_TUBE_LENGTH + laserHoleDepth;
cylinder(depth, d=dia, false);
}
module laserHole(){
cylinder(laserHoleDepth+.02, d=laserHoleDiameter, false);
}
// resistor leads: 1.2 mm
// fiber connector snap: 2.2 mm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.