Skip to content

Commit

Permalink
Made buid button smarter about unchanged models. Unchaged models with…
Browse files Browse the repository at this point in the history
… existing gcode just build, and don't re-slice
  • Loading branch information
farmakerbot committed Jun 11, 2012
1 parent c18c5dd commit 0abd4ee
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/replicatorg/app/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
import replicatorg.plugin.toolpath.ToolpathGenerator;
import replicatorg.plugin.toolpath.ToolpathGenerator.GeneratorEvent;
import replicatorg.plugin.toolpath.ToolpathGeneratorFactory;
import replicatorg.plugin.toolpath.ToolpathGenerator.GeneratorListener.Completion;
import replicatorg.plugin.toolpath.ToolpathGeneratorFactory.ToolpathGeneratorDescriptor;
import replicatorg.plugin.toolpath.ToolpathGeneratorThread;
import replicatorg.plugin.toolpath.skeinforge.SkeinforgeGenerator;
Expand Down Expand Up @@ -582,7 +583,15 @@ public void handleEditProfiles() {
}
}

/**
* Builds and runs a toolpath generator to slice the model,
* sets up callbacks so this will be notified when a build is finished.
*
* @param skipConfig true if we want to skip skeinforge config, and simply
* slice the model with the existing settings
*/
public void runToolpathGenerator(boolean skipConfig) {

// Check if the model is on the platform
if (!getPreviewPanel().getModel().isOnPlatform()) {
String message = "The bottom of the model doesn't appear to be touching the build surface, and attempting to print it could damage your machine. Ok to move it to the build platform?";
Expand All @@ -595,6 +604,7 @@ public void runToolpathGenerator(boolean skipConfig) {
}

}
Base.logger.severe("pre regenerate");

// Check for modified STL
if (build.getModel().isModified()) {
Expand Down Expand Up @@ -2062,9 +2072,16 @@ public BuildFlag detectBuildIntention()
{
flag = BuildFlag.JUST_BUILD;
}

else if(elementInView.getType() == BuildElement.Type.MODEL)
{
if(Base.preferences.getBoolean("build.autoGenerateGcode", true))
// if our gcode exist and model was not changed, no re-gen needed
if(build.getCode() != null &&
build.getModel().isModified() == false)
{
flag = BuildFlag.JUST_BUILD;
}
else if(Base.preferences.getBoolean("build.autoGenerateGcode", true))
flag = BuildFlag.GEN_AND_BUILD;
}

Expand Down Expand Up @@ -2097,6 +2114,8 @@ public void handleBuild() {
buildOnComplete = true;
doPreheat(Base.preferences.getBoolean("build.doPreheat", false));
runToolpathGenerator(Base.preferences.getBoolean("build.autoGenerateGcode", true));
//TRICKY: runToolpathGenerator will fire a 'slice done'
// which MainWindows listens for, and fires doBuild from
}
if(buildFlag == BuildFlag.JUST_BUILD) {
//'use existing' clicked
Expand Down

0 comments on commit 0abd4ee

Please sign in to comment.