How to use the @jscad/modeling.intersect 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 / examples / parameters / stepper-motor.js View on Github external
var cube2 = CSG.roundedCube({
    center: [length - (parameters.motorCap_len / 2.0), 0, 0],
    radius: [(parameters.motorCap_len / 2.0), width, width],
    roundradius: 0.2,
    resolution: 16
  })
  cube2 = cube2.setColor(fooColor)
  var cube3 = cube2.translate([-(parameters.motorBody_len - parameters.motorCap_len), 0, 0])
  xcube = cube({
    center: [0, 0, 0],
    radius: [length, ch2, ch2]
  })
  xcube = color(fooColor, xcube)
  xcube = rotateX(degToRad(45), xcube)
  cube2 = intersect(cube2, xcube)
  cube3 = intersect(cube3, xcube)

  /* pipe(
    cube({
      center: [0, 0, 0],
      radius: [length, ch2, ch2]
    }),
    color(fooColor),
    rotateX(45)
  ) */

  const ring = color([0.81176470588235294117647058823529, 0.84313725490196078431372549019608, 0.85098039215686274509803921568627],
    cylinder({
      start: [length, 0, 0],
      end: [length + parameters.motorRing_height, 0, 0],
      radius: parameters.motorRing_radius,
      resolution: 100
github jscad / OpenJSCAD.org / packages / examples / parameters / stepper-motor.js View on Github external
var cube2 = CSG.roundedCube({
    center: [length - (parameters.motorCap_len / 2.0), 0, 0],
    radius: [(parameters.motorCap_len / 2.0), width, width],
    roundradius: 0.2,
    resolution: 16
  })
  cube2 = cube2.setColor(fooColor)
  var cube3 = cube2.translate([-(parameters.motorBody_len - parameters.motorCap_len), 0, 0])
  xcube = cube({
    center: [0, 0, 0],
    radius: [length, ch2, ch2]
  })
  xcube = color(fooColor, xcube)
  xcube = rotateX(degToRad(45), xcube)
  cube2 = intersect(cube2, xcube)
  cube3 = intersect(cube3, xcube)

  /* pipe(
    cube({
      center: [0, 0, 0],
      radius: [length, ch2, ch2]
    }),
    color(fooColor),
    rotateX(45)
  ) */

  const ring = color([0.81176470588235294117647058823529, 0.84313725490196078431372549019608, 0.85098039215686274509803921568627],
    cylinder({
      start: [length, 0, 0],
      end: [length + parameters.motorRing_height, 0, 0],
      radius: parameters.motorRing_radius,
github jscad / OpenJSCAD.org / packages / examples / parameters / stepper-motor.js View on Github external
const cubeColor = [0.67843137254901960784313725490196, 0.70588235294117647058823529411765, 0.70588235294117647058823529411765]
  const fooColor = [0.87058823529411764705882352941176, 0.89803921568627450980392156862745, 0.90588235294117647058823529411765]
  let body = CSG.roundedCube({
    center: [0, 0, 0],
    radius: [length - parameters.motorCap_len, width - parameters.motorCap_thickness, width - parameters.motorCap_thickness],
    roundradius: 0.2,
    resolution: 16
  })
  body = color(cubeColor, body)
  let xcube = cube({
    center: [0, 0, 0],
    radius: [length, ch, ch]
  })
  xcube = color(cubeColor, xcube)
  body = intersect(body, rotateX(degToRad(45), xcube))

  var cube2 = CSG.roundedCube({
    center: [length - (parameters.motorCap_len / 2.0), 0, 0],
    radius: [(parameters.motorCap_len / 2.0), width, width],
    roundradius: 0.2,
    resolution: 16
  })
  cube2 = cube2.setColor(fooColor)
  var cube3 = cube2.translate([-(parameters.motorBody_len - parameters.motorCap_len), 0, 0])
  xcube = cube({
    center: [0, 0, 0],
    radius: [length, ch2, ch2]
  })
  xcube = color(fooColor, xcube)
  xcube = rotateX(degToRad(45), xcube)
  cube2 = intersect(cube2, xcube)