if(modelPath == null) {
throw new EngineException(context, this, "no model loaded");
}
String previewPath = modelPath.substring(0, modelPath.lastIndexOf(".nlogo")) + ".png";
String escaped = org.nlogo.api.StringUtils.escapeString(previewPath);
Procedure procedure =
workspace.compileForRun
("random-seed 0 " + workspace.previewCommands() +
"\nexport-view \"" + escaped + "\"" +
"\nprint \"GENERATED: " + escaped + "\"",
context, false);