Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 2025.04.30 - slight lift on the body, maybe a brim
- include <BOSL2/std.scad>
- include <BOSL2/screws.scad>
- include <BOSL2/rounding.scad>
- $fa=10; // minimum angle for fragment. default 12
- $fs=0.5; // minimum size of a fragment. default 2
- $fn=70; // number of fragments, if not 0, overrides the above
- $slop=0.0;
- /* [Hidden] */
- // DEFINES
- plateOuterLength = 42.5; // 2025.04.29 42.0 is slightly too small with the latest design. 42.5 fits, but just barely. maybe 4.6.
- plateOuterWidth = 26.7;
- plateHeight = 4;
- // TWEAKABLES
- wall = 3;
- lengthWall = wall;
- widthWall = wall;
- topSize = 3.5;
- nutTrapDepth = 2.5;
- nutSpecDef = "m3";
- screwHoleSpec = "m3";
- bodyRounding = 3.5;
- // CALCULATED - do not set directly
- bodyLength = plateOuterLength + lengthWall; //44.5;
- bodyWidth = plateOuterWidth + widthWall; //28.5;
- bodyHeight = plateHeight + topSize; //5.0;
- screwHoleLength = bodyHeight-nutTrapDepth;
- module Body()
- {
- // back_half() //left_half()
- diff()
- cuboid([bodyLength, bodyWidth, bodyHeight], anchor = BOT, orient=TOP, rounding=bodyRounding, teardrop=false) //, edges=[TOP, "Z"])
- {
- // the screw shapes
- //color_overlaps()
- tag("remove")
- position(TOP) translate([0,0,0.001])
- nut_trap_inline(nutTrapDepth, nutSpecDef, $slop=0.1, anchor=TOP)
- position(BOT) translate([0,0,0.001])
- screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.1, head="flat", anchor=BOT, orient=BOT);
- // interior cavity
- //color_overlaps()
- tag("remove")
- position(BOT) translate([0,0,-0.001])
- cuboid([plateOuterLength, plateOuterWidth, plateHeight], anchor = BOT, rounding=2, edges=[LEFT+FRONT, RIGHT+FRONT, LEFT+BACK, RIGHT+BACK]);
- }
- }
- TopOfBodyHeight = 4;
- TopOfBodyRadius = 6;
- module TopOfBody()
- {
- base = round_corners(square([bodyLength - (bodyRounding * 2), bodyWidth - (bodyRounding * 2)],center=true), radius=0.5);
- translate([0,0,5.5])
- diff()
- skin([
- //path3d(base,0),
- path3d(base, 2),
- path3d(circle(r=TopOfBodyRadius), TopOfBodyHeight),
- ], slices=0)
- {
- // the screw shapes
- //color_overlaps()
- tag("remove")
- position(TOP) translate([0,0,0.001])
- nut_trap_inline(nutTrapDepth, nutSpecDef, $slop=0.1, anchor=TOP)
- position(BOT) translate([0,0,0.001])
- screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.1, head="flat", anchor=BOT, orient=BOT);
- }
- }
- module Plate()
- {
- magnetPosY = 5;
- magnetPosX = 5;
- plateThickness = 1;
- MagnetDiameter = 3.25;
- module MagnetHole(TranslateX, TranslateY, TranslateZ)
- {
- //color_overlaps()
- tag("remove")
- position(TOP)
- translate([TranslateX, TranslateY, -TranslateZ + 0.01])
- cyl(l=plateHeight - plateThickness, r=MagnetDiameter, anchor = TOP, rounding1=0, rounding2=-1, chamfang=3, $fa=1, $fs=1);
- }
- color_overlaps()
- diff()
- cuboid([plateOuterLength - 0.1, plateOuterWidth - 0.1, plateHeight], anchor = BOT, rounding=5, edges=[LEFT+FRONT, RIGHT+FRONT, LEFT+BACK, RIGHT+BACK])
- {
- MagnetHole(magnetPosX, magnetPosY, 0);
- MagnetHole(magnetPosX*3, magnetPosY, 0);
- MagnetHole(magnetPosX, -magnetPosY, 0);
- MagnetHole(magnetPosX*3, -magnetPosY, 0);
- MagnetHole(-magnetPosX, magnetPosY, 0);
- MagnetHole(-magnetPosX*3, magnetPosY, 0);
- MagnetHole(-magnetPosX, -magnetPosY, 0);
- MagnetHole(-magnetPosX*3, -magnetPosY, 0);
- //color_overlaps()
- position(BOT) translate([0,0,0.001])
- screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.0, head="flat", anchor=TOP, orient=BOT);
- }
- }
- Body();
- TopOfBody();
- Plate();
- ///
- /// Testing
- ///
- // hexregion = circle(r=50.01,$fn=6);
- // grid_copies(spacing=10, stagger=true, inside=hexregion)
- // union() { // Needed for OpenSCAD 2021.01 as noted above
- // ref_v = (unit([0,0,50]-point3d($pos)) + UP)/2;
- // half_of(v=-ref_v, cp=[0,0,5])
- // zrot(180/6)
- // cylinder(h=20, d=10/cos(180/6)+0.01, $fn=6);
- // }
- use <dotSCAD/src/bezier_curve.scad>
- use <dotSCAD/src/surface/sf_splines.scad>
- use <dotSCAD/src/surface/sf_thicken.scad>
- ctrl_pts = [
- [[0, 0, 20], [60, 0, -35], [90, 0, 60], [200, 0, 5]],
- [[0, 50, 30], [100, 60, -25], [120, 50, 120], [200, 50, 5]],
- [[0, 100, 0], [60, 120, 35], [90, 100, 60], [200, 100, 45]],
- [[0, 150, 0], [60, 150, -35], [90, 180, 60], [200, 150, 45]]
- ];
- thickness = 2;
- t_step = 0.05;
- bezier = function(points) bezier_curve(t_step, points);
- sf_thicken(sf_splines(ctrl_pts, bezier), thickness);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement