diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index dce6d981ad72915d712edc73ab9cf687bc76b1bd..95086fa3b66a7c8597034b43ed4d3e27c5f74757 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -478,21 +478,17 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' //parse DMACell.prototype.addToDenseArray = function(cellsArray, min){ var index = this.getAbsoluteIndex().sub(min); - if (cellsArray[index.x][index.y][index.z]) return [this, cellsArray[index.x][index.y][index.z]]; + if (cellsArray[index.x][index.y][index.z]) { + console.warn("cell overlap, something bad happened"); + return; + } cellsArray[index.x][index.y][index.z] = this; - return null; - }; - - DMACell.prototype.removeFromDenseArray = function(cellsArray, min){ - var index = this.getAbsoluteIndex().sub(min); - cellsArray[index.x][index.y][index.z] = null; }; - //destroy DMACell.prototype.destroy = function(){//todo remove reference from lattice.cells diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 5cd169325067b18f5599bfb2cc46b517f242e374..ec2f48106a600d5d2236f67f1a724187d10e89ae 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -170,32 +170,21 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat } } - var overlap = false; this._loopCells(function(cell, x, y, z){ - var overlappingCells = null; - if (recursive){ - overlappingCells = cell.addToDenseArray(cells, bounds.min); - } else { - overlappingCells = DMACell.prototype.addToDenseArray.call(cell, cells, bounds.min); - } - if (overlappingCells) overlap = true; + if (recursive) cell.addToDenseArray(cells, bounds.min); + else DMACell.prototype.addToDenseArray.call(cell, cells, bounds.min); }); - if (overlap) { - console.warn("overlap detected"); - return [[[null]]]; - } return cells; }; DMASuperCell.prototype.addToDenseArray = function(cellsArray, min, forCAM){ - if (forCAM && this._isBottomLayer()) return DMACell.prototype.addToDenseArray.call(this, cellsArray, min);//this gives back the bottom layer cell for assembly, not necessarily the lattice pitch - var overlap = []; + if (forCAM && this._isBottomLayer()) { + DMACell.prototype.addToDenseArray.call(this, cellsArray, min); + return; + }//this gives back the bottom layer cell for assembly, not necessarily the lattice pitch this._loopCells(function(cell){ - var overlappingCells = cell.addToDenseArray(cellsArray, min, forCAM); - if (overlappingCells) overlap = overlap.concat(overlappingCells); + cell.addToDenseArray(cellsArray, min, forCAM); }); - if (overlap.length>0) return overlap; - return null; }; diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 8a2bd5ea65b6013b88549a6db25020a77c92e3cc..b646dd6208e90ccd6f68f398d28ed4a82c50a80a 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -20,8 +20,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis aspectRatio: null, - overlappingCells: [], - nodes: [] }), diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 056485466e8a4c5d56f3d1350529f3a0f2deeee1..11e29d965d4ecd5dfd0a86d63c1ae596f5aff6c9 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -530,56 +530,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre return {x:xScale, y:yScale, z:zScale}; }, -// _parseSparseCell: function(){ -// -// this.cells = [[[null]]]; -// -// console.log("parse cells"); -// -// if (this.get("numCells") == 0) { -// console.warn("no cells in assembly"); -// this.cells = [[[null]]]; -// return; -// } -// -// var bounds = this.calculateBoundingBox(); -// this.set("cellsMin", bounds.min.clone().add(this.get("cellsMin"))); -// var size = bounds.max.sub(bounds.min); -// -// //create array of nulls -// var cells = []; -// for (var x=0;x<size.x;x++){ -// cells.push([]); -// for (var y=0;y<size.y;y++){ -// cells[x].push([]); -// for (var z=0;z<size.z;z++){ -// cells[x][y].push(null); -// } -// } -// } -// -// var min = this.get("cellsMin").sub(bounds.min); -// var overlap = []; -// var forCAM = appState.get("currentNav") == "navAssemble"; -// this._loopCells(this.sparseCells, function(cell){ -// var overlappingCells = cell.addToDenseArray(cells, min, forCAM); -// if (overlappingCells) overlap = overlap.concat(overlappingCells); -// }); -// this.set("overlappingCells", overlap); -// -// this.cells = cells; -// }, - - highlightOverlappingCells: function(){ - this._loopCells(this.sparseCells, function(cell){ - cell.setTransparent(true); - }); - _.each(this.get("overlappingCells"), function(cell){ - cell.show(); - }); - three.render(); - }, - showCellAtIndex: function(index){ index = (new THREE.Vector3()).subVectors(index, this.get("cellsMin"));//index is probably a json object from gcode comment var cell = this.cells[index.x][index.y][index.z]; diff --git a/js/materials/DMAMaterials.js b/js/materials/DMAMaterials.js index eef1edf4433c1cd0077df0079efc7b6b00f8dee4..8684df593bebe79fc7780a6661b54a9db1f53716 100644 --- a/js/materials/DMAMaterials.js +++ b/js/materials/DMAMaterials.js @@ -97,7 +97,7 @@ define(['underscore', 'backbone', 'three', 'appState', 'lattice', 'materialsPlis options = options || {}; json = data || {}; - var id = json.id || getNextMaterialID(); + var id = json.id || getNextCompositeID(); var material = new DMAMaterial(json, id); if (options.noAdd) return material;//in the new material menu, you may init a material before saving changes diff --git a/js/menus/ESetupMenuView.js b/js/menus/ESetupMenuView.js index 7abeafa5d99e1768cb87ed476371cc8d87df790b..484a66fc7b93d4d4731f4f8e8b93b13a0fccee55 100644 --- a/js/menus/ESetupMenuView.js +++ b/js/menus/ESetupMenuView.js @@ -10,7 +10,6 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'materialsPlist', 'text!m events: { "click #calcElectricalConnectivity": "_calcElectricalConnectivity", "click #calcStructuralConnectivity": "_calcStructuralConnectivity", - "click #showOverlappingCells": "_showOverlappingCells" }, _initialize: function(){ @@ -38,11 +37,6 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'materialsPlist', 'text!m lattice.calculateStructuralConnectivity(); }, - _showOverlappingCells: function(e){ - e.preventDefault(); - lattice.highlightOverlappingCells(); - }, - _makeTemplateJSON: function(){ return _.extend(this.model.toJSON(), eSim.toJSON(), plist, materialsPlist, lattice.toJSON()); }, diff --git a/js/menus/templates/CompositeMenuView.html b/js/menus/templates/CompositeMenuView.html index eecf3cc08d31591787ebc70dd3f3c30641bbac72..ec81e190a770114e9af6e09a1b5329240358921f 100644 --- a/js/menus/templates/CompositeMenuView.html +++ b/js/menus/templates/CompositeMenuView.html @@ -17,7 +17,6 @@ Available Materials:<br/> </label> <% }); %> <% _.each(materials, function(material, key){ - if (key.substr(0,5) == "super") return; if (material.noDelete) return; %> <label class="radio colorSwatches"> <input type="radio" <%if (key == materialType){ %>checked<%}%> name="materialType" value="<%= key %>" data-toggle="radio" class="custom-radio appState"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html index 8dc6bdb73e20a161d34fe296c5adc35fbb230c63..fbc40cfb91273444d79bbf6e864054633b590da1 100644 --- a/js/menus/templates/ESetupMenuView.html +++ b/js/menus/templates/ESetupMenuView.html @@ -1,8 +1,3 @@ -<% if (overlappingCells.length>0) { %> - <div class="inlineWarning">Overlapping cells detected, check that hierarchical cells are not placed on top of one another. Simulation results may be inaccurate.<br/><br/> - <a href="#" id="showOverlappingCells" class="btn btn-block btn-lg btn-danger">Show Problem</a> - </div> -<% } %> Simulation Type: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button> diff --git a/js/menus/templates/EditComponentMenuView.html b/js/menus/templates/EditComponentMenuView.html index 54669e7ec8930b4f5ce3e503f22064d01a677f7e..5624b29181037370cb5bacf3845bb9b5d7f9ca94 100644 --- a/js/menus/templates/EditComponentMenuView.html +++ b/js/menus/templates/EditComponentMenuView.html @@ -72,7 +72,6 @@ Parent: </a></li> <% }); %> <% _.each(materials, function(material, key){ - if (key.substr(0,5) == "super") return; if (material.noDelete) return; %> <li><a class="stockMaterial dropdownSelector" data-id="<%= key %>" href="#"> <div class="materialColorSwatch"> diff --git a/js/menus/templates/ViewMenuView.html b/js/menus/templates/ViewMenuView.html index 7c5c3af364337e4b8cc482d787209415baf63ed5..03d60d3ace2c0d3f9631cb81aea4e33b0f911111 100644 --- a/js/menus/templates/ViewMenuView.html +++ b/js/menus/templates/ViewMenuView.html @@ -5,7 +5,6 @@ Set Material Visibility: <span class="materialListTitle"><%= materials[key].name %></span></div> <% }); %> <% _.each(materials, function(material, key){ - if (key.substr(0,5) == "super") return; if (material.noDelete) return; %> <div class="materialColorSwatch"> <div style="background-color:<% if(realisticColorScheme){ %><%= material.color %><% }else{ %><%= material.altColor %><% } %>"></div>