Commit 65741047 authored by amandaghassaei's avatar amandaghassaei
Browse files

small changes

parent 2ee6307b
......@@ -53,10 +53,9 @@ function initControls(globals){
}
setCheckbox("#doublesidedSTL", globals.doublesidedSTL, function(val){
globals.doublesidedSTL = val;
//todo sync stuff
});
setCheckbox("#doublesidedOBJ", globals.doublesidedSTL, function(val){
globals.doublesidedSTL = val;
setCheckbox("#doublesidedOBJ", globals.doublesidedOBJ, function(val){
globals.doublesidedOBJ = val;
});
setLink(".units", function(e){
var units = $(e.target).data("id");
......
......@@ -57,6 +57,7 @@ function initGlobals(){
filename: null,
extension: null,
doublesidedSTL: false,
doublesidedOBJ: false,
exportScale: 1,
//save fold settings
......
......@@ -2,7 +2,7 @@
* Created by amandaghassaei on 5/2/17.
*/
function makeSaveGEO(){
function makeSaveGEO(doublesided){
var geo = new THREE.Geometry().fromBufferGeometry( globals.model.getGeometry() );
if (geo.vertices.length == 0 || geo.faces.length == 0) {
......@@ -16,7 +16,7 @@ function makeSaveGEO(){
}
}
if (globals.doublesidedSTL){
if (doublesided){
var numFaces = geo.faces.length;
for (var i=0;i<numFaces;i++){
var face = geo.faces[i];
......@@ -29,7 +29,7 @@ function makeSaveGEO(){
function saveSTL(){
var data = [];
data.push({geo: makeSaveGEO(), offset:new THREE.Vector3(0,0,0), orientation:new THREE.Quaternion(0,0,0,1)});
data.push({geo: makeSaveGEO(globals.doublesidedSTL), offset:new THREE.Vector3(0,0,0), orientation:new THREE.Quaternion(0,0,0,1)});
var stlBin = geometryToSTLBin(data);
if (!stlBin) return;
var blob = new Blob([stlBin], {type: 'application/octet-binary'});
......@@ -40,7 +40,7 @@ function saveSTL(){
function saveOBJ(){
var exporter = new THREE.OBJExporter();
var result = exporter.parse (new THREE.Mesh(makeSaveGEO()));
var result = exporter.parse (new THREE.Mesh(makeSaveGEO(globals.doublesidedOBJ)));
if (!result) return;
var blob = new Blob([result], {type: 'application/octet-binary'});
var filename = $("#objFilename").val();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment