Skip to content

Instantly share code, notes, and snippets.

@beardicus
Last active March 6, 2024 22:23
Show Gist options
  • Select an option

  • Save beardicus/d668c0f6b96be53d16dc to your computer and use it in GitHub Desktop.

Select an option

Save beardicus/d668c0f6b96be53d16dc to your computer and use it in GitHub Desktop.

Revisions

  1. beardicus revised this gist Jun 10, 2022. No changes.
  2. beardicus revised this gist Jun 10, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@
    // https://www.printables.com/model/156721-sharpie-fine-point-plotter-adapter
    //
    // This is designed to be loaded into OpenJSCAD by visiting the following URL:
    // http://openjscad.xyz/#https://gist.github.com/beardicus/d668c0f6b96be53d16dc/raw/plotter-pen-adapter.jscad
    // https://openjscad.xyz/#https://gist.github.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,
  3. beardicus revised this gist Jun 10, 2022. 1 changed file with 58 additions and 40 deletions.
    98 changes: 58 additions & 40 deletions plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    // title : Plotter Pen Adapter
    // author : Brian Boucheron <[email protected]>
    // license : MIT License
    // revision : 0.002
    // date : February 9, 2016
    // 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.thingiverse.com/thing:229982
    // https://www.printables.com/model/156721-sharpie-fine-point-plotter-adapter
    //
    // This is designed to be loaded into OpenJSCAD by visiting the following URL:
    // http://openjscad.org/#https://gist.github.com/beardicus/d668c0f6b96be53d16dc/raw/plotter-pen-adapter.jscad
    // http://openjscad.xyz/#https://gist.github.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,
    @@ -28,62 +28,80 @@

    // import giblets
    const { cylinder, polygon } = require('@jscad/modeling').primitives
    const { difference, union } = require('@jscad/modeling').booleans
    const { rotateExtrude } = require('@jscad/modeling').extrusions
    const { rotate } = require('@jscad/modeling').transforms
    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
    ring_thickness = 2; // thickest point of the ring
    ring_edge_thickness = 0.6; // thickness at the very edge of the ring
    ring_diameter = 16.5; // diameter of the ring
    ring_edge_diameter = 15; // diameter where ring starts to bevel
    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

    profile = [
    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_diameter / 2,
    ring_thickness - (ring_thickness - ring_edge_thickness) / 2,
    ],
    [ring_edge_diameter / 2, ring_thickness],
    [1, ring_thickness],
    ];

    ]

    // get parameters
    const getParameterDefinitions = () => {
    return [{
    const getParameterDefinitions = () => [
    {
    name: 'penDiameter',
    type: 'float',
    type: 'number',
    initial: 10.8,
    caption: "Inner Diamter"
    }, {
    caption: 'Inner Diamter',
    },
    {
    name: 'adapterDiamter',
    type: 'float',
    type: 'number',
    initial: 11.6,
    caption: "Outer Diameter"
    }, {
    caption: 'Outer Diameter',
    },
    {
    name: 'barrelLength',
    type: 'float',
    type: 'number',
    initial: 20.7,
    caption: "Barrel Length"
    }, {
    caption: 'Barrel Length',
    },
    {
    name: 'ringHeight',
    type: 'float',
    type: 'number',
    initial: 11,
    caption: "Ring Height"
    }];
    }

    caption: 'Ring Height',
    },
    ]

    // FIRE THE SPATIAL GEOMETRON
    const main = (params) => {
    return difference(
    union(
    rotate_extrude({fn: 50}, polygon({points: profile})).translate([0, 0, params.ringHeight]),
    cylinder({r: params.adapterDiamter / 2, h: params.barrelLength, fn: 50})
    ),
    cylinder({r: params.penDiameter / 2, h: 50, fn: 50})
    );
    }
    // 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,
    })

    module.exports = { main }
    // 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 }
  4. beardicus revised this gist Jun 7, 2022. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -84,3 +84,6 @@ const main = (params) => {
    cylinder({r: params.penDiameter / 2, h: 50, fn: 50})
    );
    }

    module.exports = { main }

  5. beardicus revised this gist Jun 7, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@

    // import giblets
    const { cylinder, polygon } = require('@jscad/modeling').primitives
    const { difference, union } = require('@jscad/modeling').operations
    const { difference, union } = require('@jscad/modeling').booleans
    const { rotateExtrude } = require('@jscad/modeling').extrusions
    const { rotate } = require('@jscad/modeling').transforms

  6. beardicus revised this gist Jun 7, 2022. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -26,9 +26,13 @@
    //
    // Ring Height: height to bottom of the retaining ring (NOT midline)

    // import giblets
    const { cylinder, polygon } = require('@jscad/modeling').primitives
    const { difference, union } = require('@jscad/modeling').operations
    const { rotateExtrude } = require('@jscad/modeling').extrusions
    const { rotate } = require('@jscad/modeling').transforms

    // build a profile for the retaining ring

    ring_thickness = 2; // thickest point of the ring
    ring_edge_thickness = 0.6; // thickness at the very edge of the ring
    ring_diameter = 16.5; // diameter of the ring
    @@ -45,8 +49,7 @@ profile = [


    // get parameters

    function getParameterDefinitions() {
    const getParameterDefinitions = () => {
    return [{
    name: 'penDiameter',
    type: 'float',
    @@ -72,8 +75,7 @@ function getParameterDefinitions() {


    // FIRE THE SPATIAL GEOMETRON

    function main(params) {
    const main = (params) => {
    return difference(
    union(
    rotate_extrude({fn: 50}, polygon({points: profile})).translate([0, 0, params.ringHeight]),
  7. beardicus revised this gist Feb 9, 2016. 1 changed file with 36 additions and 28 deletions.
    64 changes: 36 additions & 28 deletions plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,39 @@
    // title : Plotter Pen Adapter
    // author : Brian Boucheron <[email protected]>
    // license : MIT License
    // revision : 0.001
    // tags : plotter, pen, adapter
    // revision : 0.002
    // date : February 9, 2016
    // file : plotter-pen-adapter.jscad
    // gist : https://gist.github.com/beardicus/d668c0f6b96be53d16dc

    // A parametric version of the plotter pen adapter found here:
    // https://www.thingiverse.com/thing:229982
    //
    // This is designed to be loaded into OpenJSCAD by visiting the following URL:
    // http://openjscad.org/#https://gist.github.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)

    // retaining ring measurements

    ring_thickness = 2; // thickest point of the band
    ring_edge_thickness = 0.6; // thickness at the very edge of the band
    ring_diameter = 16.5; // diameter of the band
    ring_edge_diameter = 15; // diameter where band starts to bevel

    // build a profile for the retaining ring

    ring_thickness = 2; // thickest point of the ring
    ring_edge_thickness = 0.6; // thickness at the very edge of the ring
    ring_diameter = 16.5; // diameter of the ring
    ring_edge_diameter = 15; // diameter where ring starts to bevel

    profile = [
    [1, 0],
    [ring_edge_diameter / 2, 0],
    @@ -24,10 +43,8 @@ profile = [
    [1, ring_thickness],
    ];

    // sharpie outer diameter measured at 10.64mm
    // plotter pen outer diameter measured at 11.50mm
    body_outer_diameter = 11.6; // outer diameter of the main body
    body_inner_diameter = 10.8; // inner diameter of the main body

    // get parameters

    function getParameterDefinitions() {
    return [{
    @@ -53,24 +70,15 @@ function getParameterDefinitions() {
    }];
    }


    // FIRE THE SPATIAL GEOMETRON

    function main(params) {
    return difference(
    union(
    rotate_extrude({
    fn: 50
    }, polygon({
    points: profile
    })).translate([0, 0, params.ringHeight]),
    cylinder({
    r: params.adapterDiamter / 2,
    h: params.barrelLength,
    fn: 50
    })
    rotate_extrude({fn: 50}, polygon({points: profile})).translate([0, 0, params.ringHeight]),
    cylinder({r: params.adapterDiamter / 2, h: params.barrelLength, fn: 50})
    ),
    cylinder({
    r: params.penDiameter / 2,
    h: 50,
    fn: 50
    })
    cylinder({r: params.penDiameter / 2, h: 50, fn: 50})
    );
    }
    }
  8. beardicus revised this gist Feb 9, 2016. No changes.
  9. beardicus created this gist Feb 9, 2016.
    76 changes: 76 additions & 0 deletions plotter-pen-adapter.jscad
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    // title : Plotter Pen Adapter
    // author : Brian Boucheron <[email protected]>
    // license : MIT License
    // revision : 0.001
    // tags : plotter, pen, adapter
    // file : plotter-pen-adapter.jscad


    // retaining ring measurements

    ring_thickness = 2; // thickest point of the band
    ring_edge_thickness = 0.6; // thickness at the very edge of the band
    ring_diameter = 16.5; // diameter of the band
    ring_edge_diameter = 15; // diameter where band starts to bevel

    // build a profile for the retaining ring

    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],
    ];

    // sharpie outer diameter measured at 10.64mm
    // plotter pen outer diameter measured at 11.50mm
    body_outer_diameter = 11.6; // outer diameter of the main body
    body_inner_diameter = 10.8; // inner diameter of the main body

    function getParameterDefinitions() {
    return [{
    name: 'penDiameter',
    type: 'float',
    initial: 10.8,
    caption: "Inner Diamter"
    }, {
    name: 'adapterDiamter',
    type: 'float',
    initial: 11.6,
    caption: "Outer Diameter"
    }, {
    name: 'barrelLength',
    type: 'float',
    initial: 20.7,
    caption: "Barrel Length"
    }, {
    name: 'ringHeight',
    type: 'float',
    initial: 11,
    caption: "Ring Height"
    }];
    }

    function main(params) {
    return difference(
    union(
    rotate_extrude({
    fn: 50
    }, polygon({
    points: profile
    })).translate([0, 0, params.ringHeight]),
    cylinder({
    r: params.adapterDiamter / 2,
    h: params.barrelLength,
    fn: 50
    })
    ),
    cylinder({
    r: params.penDiameter / 2,
    h: 50,
    fn: 50
    })
    );
    }