zOlive

Example of multimaterial printing in OpenSCAD

Feb 15th, 2021 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. // See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Customizer
  2.  
  3. material = 0; // [0:all,1:mat1,2:mat2]
  4.  
  5. module assembly1()
  6. cube(1, center=true);
  7.  
  8. module assembly2()
  9. sphere(d=1.5, $fn=6);
  10.  
  11. module mat1()
  12. color("blue")
  13. difference() {
  14. assembly1();
  15. assembly2();
  16. }
  17.  
  18. module mat2()
  19. color("red")
  20. assembly2();
  21.  
  22. if (material == 0 || material == 1) mat1();
  23. if (material == 0 || material == 2) mat2();
  24.  
Add Comment
Please, Sign In to add comment