Skip to content
Permalink
Browse files

Merge pull request #1 from wilbur-shi/gh-pages

Deliverables #1
  • Loading branch information...
jmkao committed Aug 6, 2016
2 parents b735d12 + 1bd122b commit fa5e8bf402be0798521c3c6283c9e3334f9a620d
Showing with 74 additions and 2 deletions.
  1. +1 −0 index.html
  2. +5 −2 js/main.js
  3. +68 −0 js/photonic3d.js
@@ -359,5 +359,6 @@ <h3 class="panel-title">Colors</h3>
<script src="vendor/FileSaver.min.js" type="text/javascript"></script>
<script src="vendor/jszip.min.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
<script src="js/photonic3d.js" type="text/javascript"></script>
</body>
</html>
@@ -695,7 +695,7 @@ function updateBuildVolumeSettings() {
});

viewer3d.setBuildVolume(settings.get('buildVolume'));
viewer3d.dropObject(slicer.mesh);
slicer.mesh && viewer3d.dropObject(slicer.mesh);
viewer3d.render();

size && updateMeshInfoUI();
@@ -1046,7 +1046,8 @@ var stl = 'stl/StressTest.stl';
//var stl = 'stl/SLAcer.stl';

// File url
var url = 'http://' + window.location.hostname + window.location.pathname + stl;
// var url = 'http://' + window.location.hostname + window.location.pathname + stl;
var url = window.location.href + stl;

// Create http request object
var xmlhttp = new XMLHttpRequest();
@@ -1065,3 +1066,5 @@ xmlhttp.onreadystatechange = function() {
}

xmlhttp.send();


@@ -0,0 +1,68 @@
// Photonic3D Modifications and Features to SLAcer

// Utils
function findPythagoreanC(a, b) {
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
}

function setPrinterCalibrationSettings(printer) {
var slicingProfile = printer.configuration.slicingProfile;
var monitorDriverConfig = printer.configuration.machineConfig.MonitorDriverConfig;
var dotsPermmX = slicingProfile.DotsPermmX;
var dotsPermmY = slicingProfile.DotsPermmY;
var dotsPermmXYAverage = (dotsPermmX + dotsPermmY) / 2;
// if (Math.abs(dotsPermmX - dotsPermmY) >= 0.1) {
// return true;
// }
var buildVolXmm = Math.round(monitorDriverConfig.DLP_X_Res / dotsPermmXYAverage);
var buildVolYmm = Math.round(monitorDriverConfig.DLP_Y_Res / dotsPermmXYAverage);
var diagonalMM = Math.round(findPythagoreanC(buildVolXmm, buildVolYmm));

/* This is part of updateBuildVolumeSettings() from main.js. I only copied
the necessary code that won't result in geometry error */
$buildVolumeX.val(buildVolXmm);
$buildVolumeY.val(buildVolYmm);
$buildVolumeZ.val(printer.configuration.machineConfig.PlatformZSize);
updateBuildVolumeSettings();


$('#screen-diagonal-unit-in').prop('checked', false);
$('#screen-diagonal-unit-mm').prop('checked', true);

// After manually checking the mm unit, set the values then update UI
$screenDiagonalSize.val(diagonalMM);
updateScreenSettings();

// No error occurred so return false
return false;
}

// Initialize values
function initializeValues() {
$slicerSpeedYes[0].checked = true;
$slicerSpeedNo[0].checked = false;
$slicerSpeedDelay.val(0);

// Update global javascript object with slicer settings
settings.set('slicer.speed', $slicerSpeedYes[0].checked);
settings.set('slicer.speedDelay', $slicerSpeedDelay.val());

settings.set('#slicer.panel.collapsed', true);
$slicerBody.collapse('hide');

var XYerr = false;
var printer = $.get( "/services/printers/getFirstAvailablePrinter", function( data ) {
if (data !== null && data !== undefined) {
XYerr = setPrinterCalibrationSettings(data);
}
});

if (XYerr) {
// Error handling
}

// loader.load(/*insert file here*/);
}

$(document).ready(initializeValues);

0 comments on commit fa5e8bf

Please sign in to comment.
You can’t perform that action at this time.