Skip to content

Commit

Permalink
Merge pull request #270 from WesGilster/master
Browse files Browse the repository at this point in the history
Fixed slicer X/Y aspect ratio bugs related to X/Y pixel density
  • Loading branch information
WesGilster authored Oct 16, 2016
2 parents 0b03dfb + 77eaa45 commit 2e2833d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions host/resourcesnew/cwh/js/printables.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
zscale: 1,
nextSlice: 0,
nextStep: "PerformHeader",
imageManipulationCalculator: null,
affineTransformSettings: {
yflip: false,
xflip: false,
Expand All @@ -71,7 +72,8 @@
xtranslate: 0,
ytranslate: 0,
xshear: 0,
yshear: 0
yshear: 0,
affineTransformScriptCalculator: null
}
};
} else {
Expand Down Expand Up @@ -172,7 +174,8 @@
controller.currentCustomizer.zscale = 1.0;
controller.currentCustomizer.nextSlice = 0;
controller.currentCustomizer.nextStep = "PerformHeader";

controller.currentCustomizer.imageManipulationCalculator = null;

var affineTransformSettings = controller.currentCustomizer.affineTransformSettings;
affineTransformSettings.xtranslate = 0;
affineTransformSettings.ytranslate = 0;
Expand All @@ -183,6 +186,7 @@
affineTransformSettings.xflip = false;
affineTransformSettings.yflip = false;
affineTransformSettings.rotation = 0;
affineTransformSettings.affineTransformScriptCalculator = null;
this.saveCustomizer();
}

Expand Down
4 changes: 2 additions & 2 deletions host/resourcesnew/printables.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ <h4>Duplication grid</h4>

</div>
<div class="list-group-item">
<i class="fa fa-2x fa-th-large pull-left"></i>
<i class="fa fa-2x fa-paint-brush pull-left"></i>
<h4>Image Manipulation Calculator</h4>

</div>
<div class="list-group-item">
<i class="fa fa-2x fa-th-large pull-left"></i>
<i class="fa fa-2x fa-map-o pull-left"></i>
<h4>AffineTransform Calculator</h4>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ PrinterConfiguration createTemplatePrinter(String printername, String displayId,

TwoDimensionalSettings settings = new TwoDimensionalSettings();
settings.setFont(DEFAULT_FONT);
settings.setPlatformCalculator("platformGraphics.fillRoundRect(centerX - (extrusionX / 2), centerY - (extrusionY / 2), extrusionX, extrusionY, 50, 50);");
settings.setPlatformCalculator("var extrusionX = printImage.getWidth();\nvar extrusionY = printImage.getHeight();\nplatformGraphics.fillRoundRect(centerX - (extrusionX / 2), centerY - (extrusionY / 2), extrusionX, extrusionY, 50, 50);");
settings.setExtrusionHeightMM(1.5);
settings.setPlatformHeightMM(1.5);
settings.setEdgeDetectionDisabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ public void debugPaintSlice(Graphics2D g) {
g.setColor(Color.magenta);
Point3d point = (Point3d)shape;
g.drawLine((int)(point.x / (precisionScaler) * pixelsPerMMX + imageOffsetX),
(int)(point.y / (precisionScaler) * pixelsPerMMY + imageOffsetX),
(int)(point.y / (precisionScaler) * pixelsPerMMY + imageOffsetY),
(int)(point.x / (precisionScaler) * pixelsPerMMX + imageOffsetX),
(int)(point.y / (precisionScaler) * pixelsPerMMY + imageOffsetX));
(int)(point.y / (precisionScaler) * pixelsPerMMY + imageOffsetY));
} else {
logger.debug("No intersection. WRONG!!!");
}
Expand Down Expand Up @@ -992,7 +992,7 @@ public double getWidthPixels() {
}

public double getHeightPixels() {
return stlFile.getHeight() * pixelsPerMMX;
return stlFile.getHeight() * pixelsPerMMY;
}

public int getZMinIndex() {
Expand Down

0 comments on commit 2e2833d

Please sign in to comment.