/* v1 Submission to OpenSCAD mailing list as a sample of multi color prints */ /* to use it, export two separate modules - one black, one white - and feed them to your slicer. Select different "materials" for each model, e.g. spool 1 PLA white, spool 2 PLA black */ enable_black=true; enable_white=false; dimensions=[30,7]; baselayer_height=0.28; layer_height=0.2; module white(){ if( enable_white) { color([1,1,1]) children(); } } module black(){ if( enable_black) { color([0,0,0]) children(); } } module my_linear_extrude(height){ if( height > 0) { linear_extrude(height) children(); } if( height < 0) { translate([0,0,height]) linear_extrude(-height) children(); } } module baseplate(){ square(dimensions, center=true); } module inscription(){ resize(dimensions) text("Hello Mailinglist!", halign="center", valign="center"); } black() my_linear_extrude(baselayer_height) inscription(); white() difference(){ my_linear_extrude(baselayer_height) baseplate(); my_linear_extrude(baselayer_height) inscription(); } white() my_linear_extrude(-layer_height) baseplate();