How to use the @jscad/modeling.cylinder function in @jscad/modeling

To help you get started, we’ve selected a few @jscad/modeling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jscad / OpenJSCAD.org / packages / web / testV2.js View on Github external
const main = () => {
  return [
    //rotate([0, 0, 0], cylinder({ radius: 0.1 })),
    cylinder({ radius: 0.5 }),
    translate([0, 5, 0], cylinder({size: 2.5})),
    circle({ diameter: 10, segments: 64 }),
    circle({ radius: 10, segments: 64 }),
    cuboid(),
    sphere(),
    translate([10, 5, 0], [jscad.primitives.cylinder({ radius: 0.5, segments: 64 })]),
    rotate([0, 10, 2], cylinder({ radius: 0.1 })),
    jscad.primitives.arc(),
    jscad.primitives.ellipse(),
    rotate([0, 10, 2], star())
  ]
}
github jscad / OpenJSCAD.org / packages / web / testV2.js View on Github external
const main = () => {
  return [
    //rotate([0, 0, 0], cylinder({ radius: 0.1 })),
    cylinder({ radius: 0.5 }),
    translate([0, 5, 0], cylinder({size: 2.5})),
    circle({ diameter: 10, segments: 64 }),
    circle({ radius: 10, segments: 64 }),
    cuboid(),
    sphere(),
    translate([10, 5, 0], [jscad.primitives.cylinder({ radius: 0.5, segments: 64 })]),
    rotate([0, 10, 2], cylinder({ radius: 0.1 })),
    jscad.primitives.arc(),
    jscad.primitives.ellipse(),
    rotate([0, 10, 2], star())
  ]
}
github jscad / OpenJSCAD.org / packages / examples / parameters / stepper-motor.js View on Github external
radius: parameters.motorRing_radius,
      resolution: 100
    })
  )

  const shaft = color([0.9, 0.91, 0.91],
    cylinder({
      start: [length + parameters.motorRing_height, 0, 0],
      end: [length + parameters.motorRing_height + parameters.shaft_len, 0, 0],
      radius: parameters.shaft_radius,
      resolution: 50
    })
  )

  const mountinghole = color([0.2, 0.2, 0.2],
    cylinder({
      start: [-depth, 0, 0],
      end: [0, 0, 0],
      radius: parameters.mountingholes_radius,
      resolution: 20
    })
  )

  let motor = union([cube, cube2, cube3, ring, shaft])
  motor = motor.subtract(
    translate([length, offset, offset], mountinghole),
    translate([length, offset, -offset], mountinghole),
    translate([length, -offset, offset], mountinghole),
    translate([length, -offset, -offset], mountinghole)
  )

  return translate([0, 0, width], motor)