example006.jscad 8.1 KB

123456789101112131415161718192021222324252627282930
  1. function main(){
  2. return CSG.cube({center: [0,0,0],radius: [50,50,50], resolution: 16}).subtract([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  3. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  4. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0)).translate([50,50,0]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  5. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  6. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 90)).translate([-50,50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  7. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  8. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 180)).translate([-50,-50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  9. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  10. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 270)).translate([50,-50,0])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 90)).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  11. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  12. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0)).translate([50,50,0]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  13. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  14. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 90)).translate([-50,50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  15. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  16. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 180)).translate([-50,-50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  17. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  18. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 270)).translate([50,-50,0])]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 90))]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  19. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  20. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0)).translate([50,50,0]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  21. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  22. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 90)).translate([-50,50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  23. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  24. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 180)).translate([-50,-50,0])]).union([CSG.cube({center: [0,0,0],radius: [10,10,75], resolution: 16}).subtract([CSG.cylinder({start: [0,0,-40], end: [0,0,40],radiusStart: 10, radiusEnd: 10, resolution: 30}).translate([-10,-10,0]),
  25. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,40]),
  26. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-10,-10,-40])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 270)).translate([50,-50,0])]).transform(CSG.Matrix4x4.rotation([0,0,0], [0,1,0], 90))]),
  27. CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([0,0,0]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 0)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0)).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-20,0,-20]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([20,0,20])]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 0)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 90))]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-20,0,-25]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-20,0,0])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-20,0,25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([20,0,-25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([20,0,0])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([20,0,25])]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 0)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 180))]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([0,0,0]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-25,0,-25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([25,0,-25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-25,0,25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([25,0,25])]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 0)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 270))]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-25,0,-25]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([0,0,0])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([25,0,25])]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], 90)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0))]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-25,0,-25]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([25,0,-25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([-25,0,25])]).union([CSG.sphere({center: [0,0,0], radius: 10, resolution: 30}).translate([25,0,25])]).translate([0,-50,0]).transform(CSG.Matrix4x4.rotation([0,0,0], [1,0,0], -90)).transform(CSG.Matrix4x4.rotation([0,0,0], [0,0,1], 0))])]);
  28. };