Last active
March 6, 2024 22:23
-
-
Save beardicus/d668c0f6b96be53d16dc to your computer and use it in GitHub Desktop.
Plotter Pen Adapter for use with OpenJSCAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// title : Plotter Pen Adapter | |
// author : Brian Boucheron <[email protected]> | |
// license : MIT License | |
// revision : 0.003 | |
// date : June 9 2022 | |
// file : plotter-pen-adapter.jscad | |
// gist : https://gist.github.com/beardicus/d668c0f6b96be53d16dc | |
// A parametric version of the plotter pen adapter found here: | |
// https://www.printables.com/model/156721-sharpie-fine-point-plotter-adapter | |
// | |
// This is designed to be loaded into OpenJSCAD by visiting the following URL: | |
// https://openjscad.xyz/#https://gist.githubusercontent.com/beardicus/d668c0f6b96be53d16dc/raw/plotter-pen-adapter.jscad | |
// | |
// The default parameters (in mm) are based on the Sharpie Fine Point pen, | |
// but can be tweaked for your particular pen, and are explained below. Enjoy, | |
// and get in touch with @bertmb and #plottertwitter | |
// | |
// Inner Diameter: this should be your pen's diameter, plus a little wiggle. | |
// You'll have to experiment for a good friction fit | |
// | |
// Outer Diameter: measured diameter of a real plotter pen is actually 11.5mm | |
// I bumped it for a thicker printable wall. There's probably some wiggle room. | |
// | |
// Barrel Length: how long of a barrel or "sleeve" do you want? | |
// | |
// Ring Height: height to bottom of the retaining ring (NOT midline) | |
// import giblets | |
const { cylinder, polygon } = require('@jscad/modeling').primitives | |
const { union, subtract } = require('@jscad/modeling').booleans | |
const { extrudeRotate } = require('@jscad/modeling').extrusions | |
const { translateZ } = require('@jscad/modeling').transforms | |
// build a profile for the retaining ring | |
const ring_thickness = 2.0 // thickest point of the ring | |
const ring_edge_thickness = 0.6 // thickness at the very edge of the ring | |
const ring_diameter = 16.5 // diameter of the ring | |
const ring_edge_diameter = 15.0 // diameter where ring starts to bevel | |
const profile = [ | |
[1, 0], | |
[ring_edge_diameter / 2, 0], | |
[ring_diameter / 2, (ring_thickness - ring_edge_thickness) / 2], | |
[ | |
ring_diameter / 2, | |
ring_thickness - (ring_thickness - ring_edge_thickness) / 2, | |
], | |
[ring_edge_diameter / 2, ring_thickness], | |
[1, ring_thickness], | |
] | |
// get parameters | |
const getParameterDefinitions = () => [ | |
{ | |
name: 'penDiameter', | |
type: 'number', | |
initial: 10.8, | |
caption: 'Inner Diamter', | |
}, | |
{ | |
name: 'adapterDiamter', | |
type: 'number', | |
initial: 11.6, | |
caption: 'Outer Diameter', | |
}, | |
{ | |
name: 'barrelLength', | |
type: 'number', | |
initial: 20.7, | |
caption: 'Barrel Length', | |
}, | |
{ | |
name: 'ringHeight', | |
type: 'number', | |
initial: 11, | |
caption: 'Ring Height', | |
}, | |
] | |
// FIRE THE SPATIAL GEOMETRON | |
const main = (params) => { | |
// make the ring and main body shapes | |
const ring = extrudeRotate({ segments: 50 }, polygon({ points: profile })) | |
const body = cylinder({ | |
radius: params.adapterDiamter / 2, | |
height: params.barrelLength, | |
center: [0, 0, params.barrelLength / 2], | |
segments: 50, | |
}) | |
// combine the ring and body at the appropriate ringHeight | |
const unibody = union(body, translateZ(params.ringHeight, ring)) | |
// make the hole shape | |
const hole = cylinder({ | |
radius: params.penDiameter / 2, | |
height: 50, | |
segments: 50, | |
center: [0, 0, 24], | |
}) | |
// return the holed body | |
return subtract(unibody, hole) | |
} | |
module.exports = { main, getParameterDefinitions } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment