Commit 915d806d authored by amandaghassaei's avatar amandaghassaei

adjustable vertex merge tol

parent 46cd9fdc
......@@ -353,7 +353,7 @@ input.form-control.bigInput{
}
.actionButton{
width: 100px;
width: 110px;
}
#unitsDropdown{
......
......@@ -551,7 +551,7 @@
<span class="dropdown-arrow"></span>
<ul class="dropdown-menu">
<li><a class="loadFile" href="#">Import... (SVG / FOLD)</a></li>
<li><a id="importSettings" href="#">SVG Import Settings...</a></li>
<!--<li><a id="importSettings" href="#">SVG Import Settings...</a></li>-->
<li><a id="tips" href="#">File Import Tips</a></li>
<li class="divider"></li>
<li><a id="exportFOLD" href="#">Save Simulation as FOLD...</a></li>
......@@ -1311,10 +1311,14 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<p><b>FILE IMPORT SETTINGS</b><br/><br/>
<p><b>SVG IMPORT SETTINGS</b><br/><br/>
Vertex merge tolerance (px) : &nbsp;&nbsp;<input id="vertTol" value="" placeholder="" class="float form-control" type="text">
<div class="smallTxt">Vertices within this px tolerance in the SVG will be merged into one.</div>
</p>
</div>
<div class="modal-footer">
<button id="doSVGImport" type="button" class="actionButton btn btn-success" data-dismiss="modal">Import SVG</button>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
......
......@@ -182,6 +182,7 @@ function initControls(globals){
});
setLink("#importSettings", function(){
$("#vertTol").val(globals.vertTol);
$("#importSettingsModal").modal("show");
});
setInput("#vertTol", globals.vertTol, function(val){
......@@ -315,6 +316,7 @@ function initControls(globals){
setLink(".demo", function(e){
var url = $(e.target).data("url");
if (url) {
globals.vertTol = 3;
globals.importer.importDemoFile(url);
}
});
......
......@@ -96,6 +96,10 @@ function initGlobals(){
_globals.setCreasePercent = setCreasePercent;
function warn(msg){
if (($("#warningMessage").data('bs.modal') || {}).isShown){
$("#warningMessage").append("<br/><br/>" + msg);
return;
}
$("#warningMessage").html(msg);
$("#warningModal").modal("show");
}
......
......@@ -42,10 +42,15 @@ function initImporter(globals){
warnUnableToLoad();
return;
}
globals.filename = name;
globals.extension = extension;
// globals.setCreasePercent(0);
globals.pattern.loadSVG(reader.result);
$("#vertTol").val(globals.vertTol);
$("#importSettingsModal").modal("show");
$('#doSVGImport').click(function (e) {
e.preventDefault();
$('#doSVGImport').unbind("click");
globals.filename = name;
globals.extension = extension;
globals.pattern.loadSVG(reader.result);
});
}
}(file);
reader.readAsDataURL(file);
......
......@@ -184,15 +184,15 @@ function initModel(globals){
function buildModel(fold, creaseParams){
if (fold.vertices_coords.length == 0) {
console.warn("no vertices");
globals.warn("No geometry found.");
return;
}
if (fold.faces_vertices.length == 0) {
console.warn("no faces");
globals.warn("No faces found, try adjusting import vertex merge tolerance.");
return;
}
if (fold.edges_vertices.length == 0) {
console.warn("no edges");
globals.warn("No edges found.");
return;
}
......
Markdown is supported
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