EarPod hooks #47
Replies: 1 comment
-
Yesterday I revisited my model for the earpod hooks as I wanted to fit the hooks to my airpod wireless headphones. Furthermore I wanted to adjust the hooks as these were a bit too wide (although I have used them on my runs for years now). I struggled with setting the parameters for the cubicBezierCurveTo, so started to investigate the option to use smoothSplineTo function. In the original code I prepared the sketch on the XY plane, offset with 1 mm so that adding thickness with 1 mm up and 1 mm down would bring the hooks flat on the XY plane. When I did the same with the smoothSplineTo version, the curve jumped into the z-direction (see red version in the image below). I was able to solve this by sketching on the xy-plane, then perform a sweep along this curve to add thickness and finally translating the complete shape 1 mm in the z-direction. The blue hooks are the result. Still I would be interested to know what I did wrong by sketching on an offset plane. const defaultParams = { // setting the value of the parameters
earbudStemWidth: 6.3, // the stem of the earbud is modelled as an ellipse on XZ, with two parameters
earbudStemThickness: 6, // Width is the x-dimension of the ellipse, Thickness the z-dimension
earbudStemHeight: 20.0 // The height of the stem, in the y direction is not relevant
// can be the length of the holder or grip around the stem plus some mm
}
// next lines allow intellisense help in VS Code
/** @typedef { typeof import("replicad") } replicadLib */
/** @type {function(replicadLib, typeof defaultParams): any} */
function main(
{ draw, Sketcher, sketchRectangle,sketchEllipse }, // functions used within the main program
{ earbudStemWidth,earbudStemThickness,earbudStemHeight} ) // parameters to adjust the model
{
// points smoothSpline
// throughPoints are tp1 .. tp4
// splineConfigs are cf1 .. cf4
let tp1 = [15,25]
let cf1 = {startTangent: 45, endTangent: 80}
let tp2 = [5,42]
let cf2 = {startFactor: 1.5, endTangent: 180, endFactor: 2}
let tp3 = [-20,15]
let cf3 = {startFactor: 1.5, endTangent: 180, endFactor: 1.5}
let tp4 = [-24,15]
let cf4 = {endTangent: 180}
let hookCurveSpline = new Sketcher("XY",0)
.movePointerTo([0,0])
.smoothSplineTo(tp1,cf1)
.smoothSplineTo(tp2,cf2)
.smoothSplineTo(tp3,cf3)
.smoothSplineTo(tp4,cf4)
.done()
let hookWidth = 3;
let hookHeight = 2
let loftedHook = hookCurveSpline.sweepSketch((plane, origin) =>
sketchRectangle(hookWidth, hookHeight, { plane, origin }) );
// test section to draw the spline at a plane with height 1
let hookCurveSpline1 = new Sketcher("XY",1)
.movePointerTo([0,0])
.smoothSplineTo(tp1,cf1)
.smoothSplineTo(tp2,cf2)
.smoothSplineTo(tp3,cf3)
.smoothSplineTo(tp4,cf4)
.done()
let loftedHook1 = hookCurveSpline1.sweepSketch((plane, origin) =>
sketchRectangle(hookWidth, hookHeight, { plane, origin }) );
loftedHook1 = loftedHook1.translateX(50)
// end of test section
loftedHook = loftedHook.fillet(1,(e) => e.inDirection("Z"))
loftedHook = loftedHook.fillet(0.75,(e) => e.inPlane("XY",-1))
loftedHook = loftedHook.fillet(0.75,(e) => e.inPlane("XY",1))
loftedHook = loftedHook.translateZ(1)
let tolerance = 0.5
earbudStemThickness = earbudStemThickness + tolerance
earbudStemWidth = earbudStemWidth + tolerance
let holderThickness = 1.5;
let holderWidth = earbudStemWidth + (2* holderThickness)
let holderLength = 8;
let holderHeight = earbudStemThickness + holderThickness + hookHeight;
let earPodHolder = sketchRectangle(holderWidth,holderLength).extrude(holderHeight)
earPodHolder = earPodHolder.translate([0,-((holderLength/2)-(hookWidth/2)),0])
let earPodStem = sketchEllipse(earbudStemWidth/2,earbudStemThickness/2,{plane:"XZ"}).extrude(earbudStemHeight).translate([0,earbudStemHeight/8, earbudStemThickness/2+hookHeight])
let slit = sketchRectangle(2,40,{plane:"XY"}).extrude(holderHeight).translate([0,0,holderHeight/2])
earPodHolder = earPodHolder.fuse(loftedHook.clone())
earPodHolder = earPodHolder.cut(earPodStem.clone())
earPodHolder = earPodHolder.cut(slit)
earPodHolder = earPodHolder.fillet(0.75,(e)=>e.inDirection("Y").inPlane("XY",holderHeight))
let earPodHolderR = earPodHolder.clone().mirror("YZ",[-30,0])
let shapeArray = [
{shape: loftedHook1, name:"loftedHook1", color:"red" },
{shape: earPodHolder, name:"holderL"},
{shape: earPodHolderR, name:"holderR"},
// {shape: earPodStem,name:"earPodStem"}
]
return shapeArray
} |
Beta Was this translation helpful? Give feedback.
-
This is a Replicad version of some hooks for Apple EarPods. These hooks, published on Thingiverse by Tom Lombardi (see https://www.thingiverse.com/thing:153374), are very practical to keep them fixed to your ears while running. The model allows to adjust the dimensions of the stem of the EarPods or any other earplug. It might also be possible to adjust them to AirPods (wireless headphones), but I have not tested this.
The code is shown below:
Note: I did not manage to make the
sweepSketch
work using adrawing
that is placed on a plane as the path for the sweep. Therefore I had to resort to using aSketcher
to create this shape.Beta Was this translation helpful? Give feedback.
All reactions