separated solidGrid() and segmentGrid()

This commit is contained in:
2026-04-27 13:55:46 -04:00
parent dfdcde918d
commit 0e58efccc2

View File

@@ -18,12 +18,13 @@ lw = 2*nW; // line width
lh = LH; // layer height lh = LH; // layer height
// these MUST be the cavity size // these MUST be the cavity size
gridX=4.8; gridX=3.2;
gridY=9.6; gridY=3.2;
// these ARE the number of cavities // these ARE the number of cavities
xCount=3; xCount=4;
yCount=4; yCount=7;
hc = 4; //height count = height of stack
// these MUST be the calculated dimensions // these MUST be the calculated dimensions
//xw = ((2*gridX)*xCount)+((2*lw)*xCount); // X width //xw = ((2*gridX)*xCount)+((2*lw)*xCount); // X width
@@ -32,38 +33,76 @@ xw = ((gridX)*xCount)+((lw)*xCount)+lw; // X width
yw = ((gridY)*yCount)+((lw)*yCount)+lw; // Y width yw = ((gridY)*yCount)+((lw)*yCount)+lw; // Y width
yj = (2*gridY)+(0.5*lw); // jump by this amount yj = (2*gridY)+(0.5*lw); // jump by this amount
hc = 3; //height count = height of stack
*base_shape(nozzleStart = 0);
*base_shape(nozzleStart = 10);
module base_shape(nozzleStart) { module base_shape(nozzleStart) {
cuboid([xw, yw, lh]); cuboid([xw, yw, lh]);
if(nozzleStart) {
translate([(0.5*xw)+(0.5*nozzleStart)-VOID, -((0.5*yw)-(0.5*lw)), 0]) translate([(0.5*xw)+(0.5*nozzleStart)-VOID, -((0.5*yw)-(0.5*lw)), 0])
cuboid([nozzleStart, lw, lh]); cuboid([nozzleStart, lw, lh]);
}
} }
*layerOne(); *layerXY(layerX=0, layerY=1, leadIn=10);
module layerOne() { module layerXY(layerX, layerY, leadIn) {
jumpX = ((0.5*xw)-(0.5*gridX))-lw;
jumpY = ((0.5*yw)-(0.5*gridY))-lw; jumpY = ((0.5*yw)-(0.5*gridY))-lw;
if(layerX) {
difference() { difference() {
color("Gray") base_shape(nozzleStart = 10); color("Gainsboro") base_shape(nozzleStart = leadIn);
union() { union() {
for (i = [0:(yCount-1)]) { for (i = [0:(0.5*(xCount-1))]) {
translate([-(jumpX-(i*((2*lw)+(2*gridX)))), lw, 0])
color("Gainsboro") cuboid([gridX, yw, lh+VOID]); }
for (i = [0:(0.5*(xCount-1))]) {
translate([-((jumpX-(lw+gridX))-(i*((2*lw)+(2*gridX)))), -lw, 0])
color("White") cuboid([gridX, yw, lh+VOID]); }
}}}
if(layerY) {
difference() {
color("Gray") base_shape(nozzleStart = leadIn);
union() {
for (i = [0:(0.5*(yCount-1))]) {
translate([lw, -(jumpY-(i*((2*lw)+(2*gridY)))), 0]) translate([lw, -(jumpY-(i*((2*lw)+(2*gridY)))), 0])
color("Gainsboro") cuboid([xw, gridY, lh+VOID]); } color("Gainsboro") cuboid([xw, gridY, lh+VOID]); }
for (i = [0:(yCount-1)]) { for (i = [0:(0.5*(yCount-1))]) {
translate([-lw, -((jumpY-(lw+gridY))-(i*((2*lw)+(2*gridY)))), 0]) translate([-lw, -((jumpY-(lw+gridY))-(i*((2*lw)+(2*gridY)))), 0])
color("White") cuboid([xw, gridY, lh+VOID]); } color("White") cuboid([xw, gridY, lh+VOID]); }
}} }}}
} }
buildGrid(); /*
module buildGrid() { Continious lines, fastest print best quality
However, the patters on each side will change based on even or odd layers.
------------------------------------------------------------------------------- */
*solidGrid();
module solidGrid() {
layerXY(layerX=0, layerY=1, leadIn=10);
layerOne(); for (c = [1:(hc-1)]) {
translate([0, 0, (c*(2*lh))]) layerXY(layerX=0, layerY=1, leadIn=0); }
for (c = [1:(hc-1)]) {
translate([0, 0, ((c*(2*lh))-lh)]) layerXY(layerX=1, layerY=0, leadIn=0); }
}
/*
Segmented lines for each layers, slower print lower quality
Uniform patters on each side regardless of even or odd layers
------------------------------------------------------------------------------- */
*segmentGrid();
module segmentGrid() {
layerXY(layerX=0, layerY=1, leadIn=10);
for (c = [0:(hc-1)]) { for (c = [0:(hc-1)]) {
translate([(0.5*xw)-(0.5*lw), 0, (c*((2*lh)-VOID))]) union() { translate([(0.5*xw)-(0.5*lw), 0, (c*((2*lh)-VOID))]) union() {