Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------
- // Heavy Haulers For Autonauts
- // Keith Olson
- // CC 2020
- // OpenSCAD
- //--------------------------------
- // Make GIF.
- // magick frame*.png -crop 900x900+510+3 +repage -resize 300x300 +repage haulbot.gif
- // 36 FPS / 72 Steps
- // magick frame*.png -crop 900x900+510+3 +repage -resize 300x300 +repage haulbot.gif
- // 36 FPS / 72 Steps
- // Thingiverse Customizer Docs: http://customizer.makerbot.com/docs
- // OpenSCAD uses millimeters (mm) for units.
- // Distance functions are both for conversion and to state plainly that a number is a
- // measurement, not just a value.
- // Fractions are interpreted as formulas: '1 3/4' = '1+3/4' = 1.75
- function mm(x = 1) = x * 1.00000;
- function cm(x = 1) = x * 10.00000;
- function m(x = 1) = x * 1000.00000;
- function inches(x = 1) = x * 25.40000;
- function feet(x = 1) = x * 25.40000 * 12;
- function yards(x = 1) = x * 25.40000 * 12 * 3;
- function twice(x = 1) = x * 2.00000;
- function half(x = 1) = x * 0.50000;
- // OpenSCAD uses degrees (deg) for units.
- // Angle functions are both for conversion and to state plainly that a number is a
- // measurement, not just a value.
- _pi = 3.14159265359;
- _ease = 1.0155; // Multiply holes by this to counteract shrinkage in 3d printed parts.
- function deg(x = 1) = x;
- function rad(x = 1) = x * (180 / _pi);
- function true_hole_radius (radius, num_facets) = radius / cos(360/(num_facets*2));
- function poly_offset (radius, num_facets) = radius * cos(360/(num_facets*2));
- quality = 24*5; // [12:6:360]
- smoothness=$preview ? 24*4 : quality; // (Circles are divided in $fn line segments.)
- //echo($preview,smoothness);
- $fn = smoothness;
- //--------------------------------------------------------------------------------------------
- //--------------------------------------------------------------------------------------------
- // Bot Base
- //--------------------------------------------------------------------------------------------
- WheelDia = cm( 45.0000);
- WheelDepth = cm( 20.0000);
- AxleDia = cm( 10.0000);
- WallThickness = cm( 5.0000);
- BotBaseWidth = m( 1.0000);
- BotBaseLength = m( 2.0000);
- BotBaseHeight = cm( 50.0000);
- BotBaseInset = cm( 20.0000);
- NumWheels = 6;
- WheelInset = BotBaseLength / NumWheels;
- WheelSpacing = [0,1.5,4];
- KeyShaftDia = cm( 5.0000);
- KeyHeadDia = cm( 10.0000);
- //--------------------------------------------------------------------------------------------
- // Bot Torso
- //--------------------------------------------------------------------------------------------
- BotTorsoWidth = m( 1.0000);
- BotTorsoLength = m( 2.0000);
- BotTorsoHeight = cm( 50.0000);
- BotTorsoBedHt = 0.90; // percentage of total height
- BotTorsoBedWd = 0.90; // percentage of total height
- BotBedLength = BotTorsoLength * 0.75;
- BedWallHeight = [cm( 10.0000), cm( 50.0000)];
- BotArmDia = cm( 20.0000);
- BotArmSecLen = cm(125.0000);
- BotArmJointWd = BotArmDia * 1.5;
- ExcavMult = 1.25;
- BotArmAngle = 60;
- BotHandDia = cm( 35.0000);
- BotHandDepth = cm( 20.0000);
- BotHandThick = cm( 7.5000);
- AntennaWd = cm( 7.5000);
- AntennaHt = cm( 75.0000);
- AntennaBallWd = cm( 7.5000);
- HeadlightWd = (BotTorsoWidth/2 - (BotArmJointWd/2) * 1.5)/2;
- GrillUnit = 5;
- //WallThickness = (BotTorsoWidth-(BotTorsoWidth*BotTorsoBedWd))/2;
- BotExcavWd = WallThickness * 2.5 * 3;
- BotExcavLip = BotExcavWd * 0.25;
- //--------------------------------------------------------------------------------------------
- // Bot Head
- //--------------------------------------------------------------------------------------------
- BotHeadWidth = BotTorsoWidth/2;
- BotSensorDia = cm( 20.0000);
- BotSensorHeight = cm( 25.0000);
- BedColor = ["Peru", "#444444ff", "Linen"];
- BodyColor = ["ForestGreen", "Gold", "DarkTurquoise"];
- ManipColor = ["Gold", "Silver", BedColor[2]];
- WheelColor = "Black";
- AxleColor = "Gainsboro";
- HeadColor = "WhiteSmoke";
- HeadlightColor = "LightYellow";
- GrillColor = "Silver";
- KeyColor = "Silver";
- SensorColor = "LightBlue";
- AntennaColor2 = "GreenYellow";
- BotTypeText = ["Hauler", "Dumper", "Tanker"];
- BotType = 2;
- BotViewAngle = [[0,0],[60,0],[75,0],[90,0]];
- BotView = 1;
- //--------------------------------------------------------------------------------------------
- // Draw All
- //--------------------------------------------------------------------------------------------
- //translate([0, -BotBaseWidth/2, 0]) cube([BotBaseLength, BotBaseWidth,BotBaseHeight]);
- $vpr = [BotViewAngle[BotView][0],BotViewAngle[BotView][1],$t * 360];
- //echo("VPR :",[BotViewAngle[0],$t * 360]);
- $vpt = [0, 0, 0];
- //echo("VPT :",$vpt);
- $vpd = 20000;
- //echo($vpt);
- translate([-BotBaseLength*.75, -BotBaseWidth*0, WheelDia * 0.50])
- {
- DrawBase();
- DrawTorso();
- DrawHead();
- //DrawBed(0);
- //DrawBucket();
- //DrawHand();
- //DrawArm();
- //DrawKey();
- }
- rotate([BotViewAngle[BotView][0]*2-90,0,$t * 360])
- translate([0,-BotBaseLength*1,0])//BotTorsoHeight])
- text(text = BotTypeText[BotType], font =
- "Calibri:style=Bold"
- , size = 500, halign = "center", $fn=72);
- //echo("---",BotTorsoWidth,(BotTorsoWidth-BotTorsoWidth*BotTorsoBedWd/2));
- //--------------------------------------------------------------------------------------------
- // Modules
- //--------------------------------------------------------------------------------------------
- module DrawWalls(BoxX,BoxY,BoxZ,WallT)
- {
- difference()
- {
- translate([0,-BoxY/2,0])
- cube([BoxX,BoxY,BoxZ]);
- translate([0+WallT,-BoxY/2+WallT,-1])
- cube([BoxX-WallT*2,BoxY-WallT*2,BoxZ+2]);
- }
- }
- module DrawBed(BedType = BotType)
- {
- if (BedType == 0) // Hauler
- {
- translate([-WallThickness, -(BotTorsoWidth/2), -(WheelDia * 0.50) + BotBaseHeight])
- cube([BotBedLength, BotTorsoWidth, WallThickness*2]);
- translate([-WallThickness, 0, -(WheelDia * 0.50) + BotBaseHeight + WallThickness * 2])
- DrawWalls(BotBedLength, BotTorsoWidth, BedWallHeight[BotType], WallThickness);
- } else if (BedType == 1) // Dumper
- {
- translate([-WallThickness, -(BotTorsoWidth/2), -(WheelDia * 0.50) + BotBaseHeight])
- cube([BotBedLength, BotTorsoWidth, WallThickness*2]);
- translate([-WallThickness, 0, -(WheelDia * 0.50) + BotBaseHeight + WallThickness * 2])
- DrawWalls(BotBedLength, BotTorsoWidth, BedWallHeight[BotType], WallThickness);
- } else if (BedType == 2) // Tanker
- {
- translate([-WallThickness, 0, -(WheelDia * 0.50) + BotBaseHeight + 0.5*poly_offset(BotTorsoWidth,6)])
- rotate([0,90,0])
- rotate([0,0,30])
- cylinder(d = BotTorsoWidth, h = BotBedLength);
- translate([BotBedLength*0.75,0,-(WheelDia * 0.50) + BotBaseHeight + poly_offset(BotTorsoWidth,6)])
- cylinder(d=BotTorsoWidth/4, h=BotTorsoWidth/8);
- translate([BotBedLength*0.75,0,-(WheelDia * 0.50) + BotBaseHeight + poly_offset(BotTorsoWidth,6)+BotTorsoWidth/16])
- cylinder(d=BotTorsoWidth/3, h=BotTorsoWidth/8);
- }
- }
- module DrawTorso()
- {
- color(BodyColor[BotType])
- {
- %difference()
- {
- translate([BotTorsoLength * 0.75, -(BotTorsoWidth/2), -(WheelDia * 0.50) + BotBaseHeight])
- cube([BotTorsoLength - BotBedLength, BotTorsoWidth, BotTorsoHeight]);
- translate([BotTorsoLength - BotTorsoWidth/2-100, -BotTorsoWidth/2 - 1, BotBaseHeight - WheelDia * 0.50 + BotTorsoHeight/2 - 1])
- cube([BotTorsoWidth/2+200,BotTorsoWidth/2+1,BotTorsoHeight+2]);
- }
- }
- translate([BotTorsoLength - (BotArmJointWd/2)*1.5, -BotTorsoWidth/2 + (BotArmJointWd/2) * 1.5, BotBaseHeight - WheelDia * 0.50 + (BotTorsoWidth-(BotTorsoWidth*BotTorsoBedWd))/2])
- DrawArm();
- color(HeadlightColor)
- {
- translate([BotTorsoLength - (BotArmJointWd/2)*0, -BotTorsoWidth/2 + (BotArmJointWd/2) * 1.5, BotBaseHeight + BotTorsoHeight/4 - WheelDia * 0.50]) scale([0.125,1,.5]) sphere(HeadlightWd);
- translate([BotTorsoLength - (BotArmJointWd/2)*0, BotTorsoWidth/2 - (BotArmJointWd/2) * 1.5, BotBaseHeight + BotTorsoHeight/4 - WheelDia * 0.50]) scale([0.125,1,.5]) sphere(HeadlightWd);
- }
- color(BedColor[BotType]) DrawBed(BotType);
- }
- module DrawBucket()
- {
- difference()
- {
- translate([0,-BotExcavWd/2,-BotExcavWd/3])
- cube(BotExcavWd);
- translate([WallThickness,-BotExcavWd/2+WallThickness,-BotExcavWd/3-1])
- cube((BotExcavWd-WallThickness*2+1));
- }
- difference()
- {
- translate([BotExcavWd-WallThickness,-BotExcavWd/2,-BotExcavLip-BotExcavWd/3])
- cube([WallThickness,BotExcavWd,BotExcavLip]);
- translate([BotExcavWd-WallThickness/2,-BotExcavWd/2+BotExcavWd*2/10,-BotExcavLip-BotExcavWd/3])
- cube([WallThickness*3,BotExcavWd/10,BotExcavLip*1.25],center = true);
- translate([BotExcavWd-WallThickness/2,-BotExcavWd/2+BotExcavWd*5/10,-BotExcavLip-BotExcavWd/3])
- cube([WallThickness*3,BotExcavWd/10,BotExcavLip*1.25],center = true);
- translate([BotExcavWd-WallThickness/2,-BotExcavWd/2+BotExcavWd*8/10,-BotExcavLip-BotExcavWd/3])
- cube([WallThickness*3,BotExcavWd/10,BotExcavLip*1.25],center = true);
- }
- }
- module DrawHand()
- {
- translate([BotHandDia/2-BotHandThick/2,0,0])
- difference()
- {
- cylinder(d=BotHandDia,h=BotHandDepth,center=true);
- cylinder(d=BotHandDia-BotHandThick*2,h=BotHandDepth+2,center=true);
- translate([BotHandDia/2,0,0]) cylinder(d=BotHandDia,h=BotHandDepth+2,center=true,$fn=4);
- }
- }
- module DrawHead()
- {
- translate([BotTorsoLength - BotTorsoWidth/4, BotTorsoWidth/4, BotBaseHeight + BotTorsoHeight - WheelDia * 0.50])
- {
- translate([-BotHeadWidth/2,-BotHeadWidth/2,0])
- color(HeadColor) cube([BotHeadWidth,BotHeadWidth,WallThickness]);
- translate([-BotHeadWidth/4,BotHeadWidth/4,WallThickness])
- DrawAntenna();
- translate([BotHeadWidth/4,-BotHeadWidth/4,WallThickness])
- DrawSensor();
- }
- }
- module DrawHose()
- {
- translate([-BotArmJointWd/2,0,-BotArmJointWd/2])
- difference()
- {
- union(){
- cylinder(d=BotHandDia*.5,h=BotHandDepth*2,center=true);
- cylinder(d=BotHandDia*.375,h=BotHandDepth*3,center=true);
- }
- cylinder(d=BotHandDia*.25,h=BotHandDepth*6+2,center=true);
- //translate([BotHandDia/2,0,0]) cylinder(d=BotHandDia,h=BotHandDepth+2,center=true,$fn=4);
- }
- }
- module DrawSensor()
- {
- color(SensorColor) difference()
- {
- union()
- {
- rotate([0,0,360/12]) cylinder(d=BotSensorDia, h=BotSensorHeight);
- rotate([0,0,360/12]) translate([0,0,BotSensorHeight]) sphere(BotSensorDia/2);
- }
- translate([0,-BotSensorDia*2,BotSensorHeight/2])
- cube([BotSensorDia*4,BotSensorDia*4,BotSensorHeight*4]);
- }
- }
- module DrawAntenna()
- {
- color(HeadColor) rotate([0,0,360/12]) cylinder(d=AntennaWd * 2, h=AntennaHt * 0.2);
- color(HeadColor) rotate([0,0,360/12]) cylinder(d=AntennaWd, h=AntennaHt);
- translate([0,0,AntennaHt]) color(AntennaColor2) cube(AntennaBallWd*1.5,center=true);
- }
- module DrawKey()
- {
- translate([0,0,BotBaseHeight/2])
- {
- rotate([0,-90,180])
- rotate([0,0,360/12]) cylinder(d=KeyShaftDia, h = BotBaseLength/2);
- rotate([30,0,0]) hull()
- {
- translate([0,-KeyHeadDia/2,-KeyShaftDia/2]) cylinder(d=KeyHeadDia,h=KeyShaftDia);
- translate([0,KeyHeadDia/2,-KeyShaftDia/2]) cylinder(d=KeyHeadDia,h=KeyShaftDia);
- }
- }
- }
- module DrawGrill()
- {
- scale([GrillUnit * 0.5,GrillUnit * 1,GrillUnit * 1]) hull()
- {
- translate([0,-30,20])
- sphere(10);
- translate([0,30,20])
- sphere(10);
- translate([0,-30,0])
- sphere(10);
- translate([0,30,0])
- sphere(10);
- }
- }
- module DrawArm(ArmType=BotType)
- {
- if (ArmType == 0) // Hauler
- {
- color(BodyColor[BotType]) cylinder(d=BotArmDia,h=BotArmJointWd/2+BotTorsoHeight);
- translate([0,0,+BotTorsoHeight + BotArmJointWd/2])
- {
- rotate([0,90-BotArmAngle,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia, h=BotArmSecLen);
- color(BodyColor[BotType]) sphere(d=BotArmJointWd);
- translate([BotArmSecLen*cos(BotArmAngle), 0, BotArmSecLen*sin(BotArmAngle)])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd);
- rotate([0,180,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia, h=BotArmSecLen);
- translate([0,0,-BotArmSecLen])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd);
- translate([BotArmJointWd/2-BotHandThick/2,0,0])
- color(ManipColor[BotType]) DrawHand();
- }
- }
- }
- } else if (ArmType == 1) // Dumper
- {
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult,h=BotArmJointWd * ExcavMult/2+BotTorsoHeight);
- translate([0,0,+BotTorsoHeight + BotArmJointWd * ExcavMult/2])
- {
- rotate([0,90-BotArmAngle,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult, h=BotArmSecLen);
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- translate([BotArmSecLen*cos(BotArmAngle), 0, BotArmSecLen*sin(BotArmAngle)])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- rotate([0,180,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult, h=BotArmSecLen);
- translate([0,0,-BotArmSecLen])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- translate([BotArmJointWd * ExcavMult/2-BotHandThick/2,0,0])
- color(ManipColor[BotType]) DrawBucket();
- }
- }
- }
- } else if (ArmType == 2) // Tanker
- {
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult,h=BotArmJointWd * ExcavMult/2+BotTorsoHeight);
- translate([0,0,+BotTorsoHeight + BotArmJointWd * ExcavMult/2])
- {
- rotate([0,90-BotArmAngle,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult, h=BotArmSecLen);
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- translate([BotArmSecLen*cos(BotArmAngle), 0, BotArmSecLen*sin(BotArmAngle)])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- rotate([0,180,0])
- color(BodyColor[BotType]) cylinder(d=BotArmDia * ExcavMult, h=BotArmSecLen);
- translate([0,0,-BotArmSecLen])
- {
- color(BodyColor[BotType]) sphere(d=BotArmJointWd * ExcavMult);
- translate([BotArmJointWd * ExcavMult/2-BotHandThick/2,0,0])
- color(ManipColor[BotType]) DrawHose();
- }
- }
- }
- }
- }
- module DrawBase()
- {
- color(BodyColor[BotType]) translate([BotBaseInset, -(BotBaseWidth/2-WheelDepth), -(WheelDia * 0.50) + BotBaseHeight * 0.25])
- cube([BotBaseLength-BotBaseInset, BotBaseWidth - WheelDepth * 2, BotBaseHeight * 0.75]);
- translate([WheelInset, 0, 0])
- for (ii=[0:(NumWheels/2-1)])
- {
- //echo(WheelSpacing[ii]);
- translate([WheelSpacing[ii] * WheelInset, 0, 0])
- DrawWheels();
- }
- translate([0,0,-BotBaseHeight/2 + WheelDia * 0.250])
- color(KeyColor) DrawKey();
- translate([BotTorsoLength, 0, BotBaseHeight * 0.50 - WheelDia * 0.50])
- color(GrillColor) DrawGrill();
- }
- module DrawWheels()
- {
- rotate([90,0,0])
- color(AxleColor) cylinder(d=AxleDia, h=BotBaseWidth, center=true);
- color(WheelColor)
- {
- translate([0, BotBaseWidth * 0.4750, 0])
- DrawWheel();
- translate([0, -BotBaseWidth * 0.4750, 0])
- rotate([0,0,180])
- DrawWheel();
- }
- }
- module DrawWheel()
- {
- translate([0,WheelDepth/2,0])
- rotate([90,0,0])
- difference()
- {
- cylinder(d=WheelDia, h=WheelDepth);
- translate([0,0,-10])
- cylinder(d=WheelDia * 0.60, h=WheelDepth * 0.50);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment