Newer
Older
JobPart p = job.getParts().get(0);
double xMin = Util.px2mm(p.getMinX(),p.getDPI());
double xMax = Util.px2mm(p.getMaxX(),p.getDPI());
double yMin = Util.px2mm(p.getMinY(),p.getDPI());
double yMax = Util.px2mm(p.getMaxY(),p.getDPI());
double maxDPI = p.getDPI();
for (JobPart jp : job.getParts())
{
xMin = Math.min(xMin, Util.px2mm(jp.getMinX(),jp.getDPI()));
xMax = Math.max(xMax, Util.px2mm(jp.getMaxX(),jp.getDPI()));
yMin = Math.min(yMin, Util.px2mm(jp.getMinY(),jp.getDPI()));
yMax = Math.max(yMax, Util.px2mm(jp.getMaxY(),jp.getDPI()));
maxDPI = Math.max(maxDPI, jp.getDPI());
}
out.printf("201 %d\n", px2steps(Util.mm2px(isFlipXaxis() ? bedWidth - xMax : xMin,maxDPI), maxDPI));
out.printf("202 %d\n", px2steps(Util.mm2px(isFlipXaxis() ? bedWidth - xMin : xMax,maxDPI), maxDPI));
out.printf("203 %d\n", px2steps(Util.mm2px(isFlipYaxis() ? bedWidth - yMax : yMin,maxDPI), maxDPI));
out.printf("204 %d\n", px2steps(Util.mm2px(isFlipYaxis() ? bedWidth - xMin : yMax,maxDPI), maxDPI));
}
return result.toByteArray();
}