Comparar commits

..

10 Commits

Autor SHA1 Mensagem Data
daid aca2c17eba Allow the engine to use dynamic acceleration settings to get better time estimates. 2016-03-22 16:29:32 +01:00
daid 22b0d0fe6a Add nozzle diameter parameter for UltiGCode in preperation for some things. 2015-10-08 11:44:54 +02:00
daid 7b2b9630c7 Merge pull request #161 from mosh1/infill_perimeter_ordering
Add option to change print order of infill vs perimeters. Default prints...
2015-03-03 11:37:04 +01:00
Moshen Chan 4621d77a17 Add option to change print order of infill vs perimeters. Default prints infill first as was changed in v15, but this can lead to surface quality issues where infill would show on surface. This adds the option to change the order. 2015-02-27 00:50:50 -08:00
daid 5a6ebd4156 Merge branch 'master' of github.com:Ultimaker/CuraEngine 2015-01-16 12:17:31 +01:00
daid 0fdec5246b CNC GCode needs P instead of S parameters. 2015-01-16 12:17:22 +01:00
daid bbed68e588 Merge pull request #153 from presslab-us/fixskintravel
Use retract on skins
2015-01-14 14:32:03 +01:00
Ryan Press 49d5a81d02 Add option to disable combing on skin surfaces
The existing enableCombing options 0, 1 work as before.  A new
option 2 disables combing on the skin surfaces.  This forces a
retract to reduce the unsightly scarring on flat surfaces.
2015-01-09 14:20:52 -08:00
Ryan Press 3e980a84fd slab-us presslab-us authored 5 days ago evert "Use retract on skins"
This reverts commit af14f82a7f.
Because this option should be configurable, change the implementation.
2015-01-09 10:06:39 -08:00
Ryan Press af14f82a7f Use retract on skins
Using combing on skins causes unsightly scarring on flat surfaces.
By forcing a retract between travel moves we can lift the head
above the surface to avoid this.
2015-01-04 14:19:50 -08:00
7 arquivos alterados com 152 adições e 66 exclusões
+84 -55
Ver Arquivo
@@ -108,6 +108,7 @@ private:
gcode.setSwitchExtruderCode(config.preSwitchExtruderCode, config.postSwitchExtruderCode);
gcode.setFlavor(config.gcodeFlavor);
gcode.setRetractionSettings(config.retractionAmount, config.retractionSpeed, config.retractionAmountExtruderSwitch, config.minimalExtrusionBeforeRetraction, config.retractionZHop, config.retractionAmountPrime);
gcode.applyAccelerationSettings(config);
}
bool prepareModel(SliceDataStorage& storage, const std::vector<std::string> &files)
@@ -344,6 +345,8 @@ private:
gcode.writeComment("TIME:<__TIME__>");
gcode.writeComment("MATERIAL:<FILAMENT>");
gcode.writeComment("MATERIAL2:<FILAMEN2>");
gcode.writeComment("NOZZLE_DIAMETER:%f", float(config.nozzleSize) / 1000);
gcode.writeComment("NOZZLE_DIAMETER2:%f", float(config.nozzleSize) / 1000);
}
gcode.writeCode(config.startCode.c_str());
if (gcode.getFlavor() == GCODE_FLAVOR_BFB)
@@ -540,7 +543,7 @@ private:
gcodeLayer.setAlwaysRetract(true);
gcodeLayer.addPolygonsByOptimizer(storage.oozeShield[layerNr], &skirtConfig);
sendPolygonsToGui("oozeshield", layerNr, layer->printZ, storage.oozeShield[layerNr]);
gcodeLayer.setAlwaysRetract(!config.enableCombing);
gcodeLayer.setAlwaysRetract(config.enableCombing == COMBING_OFF);
}
if (config.simpleMode)
@@ -595,70 +598,31 @@ private:
{
SliceLayerPart* part = &layer->parts[partOrderOptimizer.polyOrder[partCounter]];
if (config.enableCombing)
gcodeLayer.setCombBoundary(&part->combBoundery);
else
if (config.enableCombing == COMBING_OFF)
{
gcodeLayer.setAlwaysRetract(true);
}else
{
gcodeLayer.setCombBoundary(&part->combBoundery);
gcodeLayer.setAlwaysRetract(false);
}
Polygons infillPolygons;
int fillAngle = 45;
if (layerNr & 1)
fillAngle += 90;
int extrusionWidth = config.extrusionWidth;
if (layerNr == 0)
extrusionWidth = config.layer0extrusionWidth;
if (config.sparseInfillLineDistance > 0)
// Add either infill or perimeter first depending on option
if (!config.perimeterBeforeInfill)
{
switch (config.infillPattern)
{
case INFILL_AUTOMATIC:
generateAutomaticInfill(
part->sparseOutline, infillPolygons, extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_GRID:
generateGridInfill(part->sparseOutline, infillPolygons,
extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_LINES:
generateLineInfill(part->sparseOutline, infillPolygons,
extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_CONCENTRIC:
generateConcentricInfill(
part->sparseOutline, infillPolygons,
config.sparseInfillLineDistance);
break;
}
}
gcodeLayer.addPolygonsByOptimizer(infillPolygons, &infillConfig);
//sendPolygonsToGui("infill", layerNr, layer->z, fillPolygons);
if (config.insetCount > 0)
addInfillToGCode(part, gcodeLayer, layerNr, extrusionWidth, fillAngle);
addInsetToGCode(part, gcodeLayer, layerNr);
}else
{
if (config.spiralizeMode)
{
if (static_cast<int>(layerNr) >= config.downSkinCount)
inset0Config.spiralize = true;
if (static_cast<int>(layerNr) == config.downSkinCount && part->insets.size() > 0)
gcodeLayer.addPolygonsByOptimizer(part->insets[0], &insetXConfig);
}
for(int insetNr=part->insets.size()-1; insetNr>-1; insetNr--)
{
if (insetNr == 0)
gcodeLayer.addPolygonsByOptimizer(part->insets[insetNr], &inset0Config);
else
gcodeLayer.addPolygonsByOptimizer(part->insets[insetNr], &insetXConfig);
}
addInsetToGCode(part, gcodeLayer, layerNr);
addInfillToGCode(part, gcodeLayer, layerNr, extrusionWidth, fillAngle);
}
Polygons skinPolygons;
@@ -669,6 +633,11 @@ private:
bridge = bridgeAngle(outline, &storage.volumes[volumeIdx].layers[layerNr-1]);
generateLineInfill(outline, skinPolygons, extrusionWidth, extrusionWidth, config.infillOverlap, (bridge > -1) ? bridge : fillAngle);
}
if (config.enableCombing == COMBING_NOSKIN)
{
gcodeLayer.setCombBoundary(nullptr);
gcodeLayer.setAlwaysRetract(true);
}
gcodeLayer.addPolygonsByOptimizer(skinPolygons, &skinConfig);
@@ -679,6 +648,66 @@ private:
gcodeLayer.setCombBoundary(nullptr);
}
void addInfillToGCode(SliceLayerPart* part, GCodePlanner& gcodeLayer, int layerNr, int extrusionWidth, int fillAngle)
{
Polygons infillPolygons;
if (config.sparseInfillLineDistance > 0)
{
switch (config.infillPattern)
{
case INFILL_AUTOMATIC:
generateAutomaticInfill(
part->sparseOutline, infillPolygons, extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_GRID:
generateGridInfill(part->sparseOutline, infillPolygons,
extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_LINES:
generateLineInfill(part->sparseOutline, infillPolygons,
extrusionWidth,
config.sparseInfillLineDistance,
config.infillOverlap, fillAngle);
break;
case INFILL_CONCENTRIC:
generateConcentricInfill(
part->sparseOutline, infillPolygons,
config.sparseInfillLineDistance);
break;
}
}
gcodeLayer.addPolygonsByOptimizer(infillPolygons, &infillConfig);
}
void addInsetToGCode(SliceLayerPart* part, GCodePlanner& gcodeLayer, int layerNr)
{
if (config.insetCount > 0)
{
if (config.spiralizeMode)
{
if (static_cast<int>(layerNr) >= config.downSkinCount)
inset0Config.spiralize = true;
if (static_cast<int>(layerNr) == config.downSkinCount && part->insets.size() > 0)
gcodeLayer.addPolygonsByOptimizer(part->insets[0], &insetXConfig);
}
for(int insetNr=part->insets.size()-1; insetNr>-1; insetNr--)
{
if (insetNr == 0)
gcodeLayer.addPolygonsByOptimizer(part->insets[insetNr], &inset0Config);
else
gcodeLayer.addPolygonsByOptimizer(part->insets[insetNr], &insetXConfig);
}
}
}
void addSupportToGCode(SliceDataStorage& storage, GCodePlanner& gcodeLayer, int layerNr)
{
if (!storage.support.generated)
+10
Ver Arquivo
@@ -85,6 +85,7 @@ void GCodeExport::setFlavor(int flavor)
for(int n=0; n<MAX_EXTRUDERS; n++)
extruderCharacter[n] = 'E';
}
int GCodeExport::getFlavor()
{
return this->flavor;
@@ -119,6 +120,11 @@ void GCodeExport::setRetractionSettings(int retractionAmount, int retractionSpee
this->retractionZHop = zHop;
}
void GCodeExport::applyAccelerationSettings(ConfigSettings& config)
{
estimateCalculator.applyAccelerationSettings(config);
}
void GCodeExport::setZ(int z)
{
this->zPos = z;
@@ -372,6 +378,8 @@ void GCodeExport::writeFanCommand(int speed)
{
if (flavor == GCODE_FLAVOR_MAKERBOT)
fprintf(f, "M126 T0 ; value = %d\n", speed * 255 / 100);
else if (flavor == GCODE_FLAVOR_MACH3)
fprintf(f, "M106 P%d\n", speed * 255 / 100);
else
fprintf(f, "M106 S%d\n", speed * 255 / 100);
}
@@ -379,6 +387,8 @@ void GCodeExport::writeFanCommand(int speed)
{
if (flavor == GCODE_FLAVOR_MAKERBOT)
fprintf(f, "M127 T0\n");
else if (flavor == GCODE_FLAVOR_MACH3)
fprintf(f, "M106 P%d\n", 0);
else
fprintf(f, "M107\n");
}
+2
Ver Arquivo
@@ -64,6 +64,8 @@ public:
void setRetractionSettings(int retractionAmount, int retractionSpeed, int extruderSwitchRetraction, int minimalExtrusionBeforeRetraction, int zHop, int retractionAmountPrime);
void applyAccelerationSettings(ConfigSettings& config);
void setZ(int z);
Point getPositionXY();
+17 -4
Ver Arquivo
@@ -18,6 +18,7 @@ ConfigSettings *ConfigSettings::config = NULL;
ConfigSettings::ConfigSettings()
{
config = this;
SETTING(nozzleSize, 400);
SETTING(layerThickness, 100);
SETTING(initialLayerThickness, 300);
SETTING(filamentDiameter, 2890);
@@ -44,6 +45,7 @@ ConfigSettings::ConfigSettings()
SETTING(infillSpeed, 50);
SETTING(infillPattern, INFILL_AUTOMATIC);
SETTING(skinSpeed, 50);
SETTING(perimeterBeforeInfill, 0);
SETTING(supportType, SUPPORT_TYPE_GRID);
SETTING(supportAngle, -1);
@@ -61,7 +63,7 @@ ConfigSettings::ConfigSettings()
SETTING(minimalExtrusionBeforeRetraction, 100);
SETTING(retractionZHop, 0);
SETTING(enableCombing, 1);
SETTING(enableCombing, COMBING_ALL);
SETTING(enableOozeShield, 0);
SETTING(wipeTowerSize, 0);
SETTING(multiVolumeOverlap, 0);
@@ -150,6 +152,17 @@ ConfigSettings::ConfigSettings()
"G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\n"
"M84 ;steppers off\n"
"G90 ;absolute positioning\n";
//Time estimate settings
SETTING(acceleration, 3000 * 1000);
SETTING(max_acceleration[0], 9000 * 1000);
SETTING(max_acceleration[1], 9000 * 1000);
SETTING(max_acceleration[2], 100 * 1000);
SETTING(max_acceleration[3], 10000 * 1000);
SETTING(max_xy_jerk, 20.0 * 1000);
SETTING(max_z_jerk, 0.4 * 1000);
SETTING(max_e_jerk, 5.0 * 1000);
}
#undef STRINGIFY
@@ -199,7 +212,7 @@ bool ConfigSettings::readSettings(const char* path) {
if(!config.good()) return false;
while(config.good()) {
while(config.good()) {
bool multilineContent = false;
size_t pos = std::string::npos;
std::getline(config, line);
@@ -223,7 +236,7 @@ bool ConfigSettings::readSettings(const char* path) {
// Are we about to read a multiline string?
if(val == CONFIG_MULTILINE_SEPARATOR) {
val = "";
val = "";
multilineContent = true;
bool done_multiline = false;
@@ -245,7 +258,7 @@ bool ConfigSettings::readSettings(const char* path) {
// to the parsed value
RTRIM_STRING(val);
}
else {
else {
line += "\n";
val += line;
}
+19
Ver Arquivo
@@ -101,6 +101,16 @@ enum Infill_Pattern
INFILL_CONCENTRIC = 3,
};
/**
* Where to use the combing feature
*/
enum Combing_Feature
{
COMBING_OFF = 0,
COMBING_ALL = 1,
COMBING_NOSKIN = 2,
};
class _ConfigSettingIndex
{
public:
@@ -116,6 +126,7 @@ private:
std::vector<_ConfigSettingIndex> _index;
public:
static ConfigSettings *config; // allow access to config settings from everywhere
int nozzleSize;
int layerThickness;
int initialLayerThickness;
int filamentDiameter;
@@ -157,6 +168,7 @@ public:
int infillSpeed;
int infillPattern;
int skinSpeed;
int perimeterBeforeInfill;
//Support material
int supportType;
@@ -207,6 +219,13 @@ public:
std::string endCode;
std::string preSwitchExtruderCode;
std::string postSwitchExtruderCode;
//Time estimate settings
int acceleration;
int max_acceleration[4];
int max_xy_jerk;
int max_z_jerk;
int max_e_jerk;
ConfigSettings();
bool setSetting(const char* key, const char* value);
+17 -7
Ver Arquivo
@@ -6,16 +6,26 @@
#define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
const double max_feedrate[TimeEstimateCalculator::NUM_AXIS] = {600, 600, 40, 25};
const double minimumfeedrate = 0.01;
const double acceleration = 3000;
const double max_acceleration[TimeEstimateCalculator::NUM_AXIS] = {9000,9000,100,10000};
const double max_xy_jerk = 20.0;
const double max_z_jerk = 0.4;
const double max_e_jerk = 5.0;
static double max_feedrate[TimeEstimateCalculator::NUM_AXIS] = {600, 600, 40, 25};
static double minimumfeedrate = 0.01;
static double acceleration = 3000;
static double max_acceleration[TimeEstimateCalculator::NUM_AXIS] = {9000,9000,100,10000};
static double max_xy_jerk = 20.0;
static double max_z_jerk = 0.4;
static double max_e_jerk = 5.0;
template<typename T> const T square(const T& a) { return a * a; }
void TimeEstimateCalculator::applyAccelerationSettings(ConfigSettings& config)
{
acceleration = float(config.acceleration) / 1000.0;
for(unsigned int n=0; n<TimeEstimateCalculator::NUM_AXIS; n++)
max_acceleration[n] = float(config.max_acceleration[n]) / 1000.0;
max_xy_jerk = float(config.max_xy_jerk) / 1000.0;
max_z_jerk = float(config.max_z_jerk) / 1000.0;
max_e_jerk = float(config.max_e_jerk) / 1000.0;
}
void TimeEstimateCalculator::setPosition(Position newPos)
{
currentPosition = newPos;
+3
Ver Arquivo
@@ -1,6 +1,7 @@
#ifndef TIME_ESTIMATE_H
#define TIME_ESTIMATE_H
#include "settings.h"
#include <stdint.h>
#include <vector>
@@ -58,6 +59,8 @@ private:
std::vector<Block> blocks;
public:
void applyAccelerationSettings(ConfigSettings& config);
void setPosition(Position newPos);
void plan(Position newPos, double feedRate);
void reset();