Comparar commits

..

10 Commits

Autor SHA1 Mensagem Data
daid 2e5b72cfef Merge pull request #150 from presslab-us/fixpathstart
Reset start position for new layers
2014-12-15 09:59:11 +01:00
Ryan Press 3aa638ea42 Reset start position for new layers
Reset the start position of the path optimizer for each new layer
so that it doesn't double up on the layers, causing problems for
cooling.
2014-12-14 09:08:17 -08:00
daid edf2f897d1 Change how open polygons are saved. As std::vector never clears memory and the old implementation could mean a lot of memory was never freed. 2014-12-12 11:00:33 +01:00
daid cacffadc61 It looks like removing duplicate faces actually has a negative effect on "bad" model. 2014-12-10 08:54:38 +01:00
daid d7a26ab715 Improve skirt handling with support material 2014-12-03 15:39:30 +01:00
daid 65dc9fe64b Fix #144 for dos format files. 2014-11-26 15:08:09 +01:00
daid db6c9a05e0 Merge branch 'master' of github.com:Ultimaker/CuraEngine 2014-11-26 12:14:08 +01:00
daid 93e2cda988 Fix BFB support. 2014-11-26 12:12:57 +01:00
daid d49257d30c Merge pull request #141 from qbit/master
Add flags for OpenBSD
2014-11-24 07:25:31 +01:00
Aaron Bieber e53408dc52 Flags for OpenBSD 2014-11-20 18:06:06 -07:00
9 arquivos alterados com 66 adições e 37 exclusões
+3
Ver Arquivo
@@ -53,6 +53,9 @@ else
LDFLAGS += --static -flto
endif
endif
ifeq ($(UNAME), OpenBSD)
LDFLAGS += -lm -lpthread
endif
ifeq ($(UNAME), Darwin)
OPEN_HTML=open
#For MacOS force to build
+3 -2
Ver Arquivo
@@ -190,7 +190,7 @@ private:
{
//Reporting the outline here slows down the engine quite a bit, so only do so when debugging.
//sendPolygonsToGui("outline", layerNr, slicer->layers[layerNr].z, slicer->layers[layerNr].polygonList);
sendPolygonsToGui("openoutline", layerNr, slicer->layers[layerNr].z, slicer->layers[layerNr].openPolygonList);
sendPolygonsToGui("openoutline", layerNr, slicer->layers[layerNr].z, slicer->layers[layerNr].openPolygons);
}
}
cura::log("Sliced model in %5.3fs\n", timeKeeper.restart());
@@ -471,6 +471,7 @@ private:
}
}
gcode.setZ(z);
gcode.resetStartPosition();
bool printSupportFirst = (storage.support.generated && config.supportExtruder > 0 && config.supportExtruder == gcodeLayer.getExtruder());
if (printSupportFirst)
@@ -579,7 +580,7 @@ private:
}
PathOrderOptimizer partOrderOptimizer(gcode.getPositionXY());
PathOrderOptimizer partOrderOptimizer(gcode.getStartPositionXY());
for(unsigned int partNr=0; partNr<layer->parts.size(); partNr++)
{
partOrderOptimizer.addPolygon(layer->parts[partNr].insets[0][0]);
+31 -9
Ver Arquivo
@@ -11,7 +11,7 @@
namespace cura {
GCodeExport::GCodeExport()
: currentPosition(0,0,0)
: currentPosition(0,0,0), startPosition(INT32_MIN,INT32_MIN,0)
{
extrusionAmount = 0;
extrusionPerMM = 0;
@@ -129,6 +129,17 @@ Point GCodeExport::getPositionXY()
return Point(currentPosition.x, currentPosition.y);
}
void GCodeExport::resetStartPosition()
{
startPosition.x = INT32_MIN;
startPosition.y = INT32_MIN;
}
Point GCodeExport::getStartPositionXY()
{
return Point(startPosition.x, startPosition.y);
}
int GCodeExport::getPositionZ()
{
return currentPosition.z;
@@ -163,7 +174,10 @@ void GCodeExport::writeComment(const char* comment, ...)
va_start(args, comment);
fprintf(f, ";");
vfprintf(f, comment, args);
fprintf(f, "\n");
if (flavor == GCODE_FLAVOR_BFB)
fprintf(f, "\r\n");
else
fprintf(f, "\n");
va_end(args);
}
@@ -172,7 +186,10 @@ void GCodeExport::writeLine(const char* line, ...)
va_list args;
va_start(args, line);
vfprintf(f, line, args);
fprintf(f, "\n");
if (flavor == GCODE_FLAVOR_BFB)
fprintf(f, "\r\n");
else
fprintf(f, "\n");
va_end(args);
}
@@ -212,10 +229,10 @@ void GCodeExport::writeMove(Point p, int speed, int lineWidth)
if (currentSpeed != int(rpm * 10))
{
//fprintf(f, "; %f e-per-mm %d mm-width %d mm/s\n", extrusionPerMM, lineWidth, speed);
fprintf(f, "M108 S%0.1f\n", rpm);
fprintf(f, "M108 S%0.1f\r\n", rpm);
currentSpeed = int(rpm * 10);
}
fprintf(f, "M%d01\n", extruderNr);
fprintf(f, "M%d01\r\n", extruderNr + 1);
isRetracted = false;
}
//Fix the speed by the actual RPM we are asking, because of rounding errors we cannot get all RPM values, but we have a lot more resolution in the feedrate value.
@@ -229,11 +246,11 @@ void GCodeExport::writeMove(Point p, int speed, int lineWidth)
//If we are not extruding, check if we still need to disable the extruder. This causes a retraction due to auto-retraction.
if (!isRetracted)
{
fprintf(f, "M103\n");
fprintf(f, "M103\r\n");
isRetracted = true;
}
}
fprintf(f, "G1 X%0.3f Y%0.3f Z%0.3f F%0.1f\n", INT2MM(p.X - extruderOffset[extruderNr].X), INT2MM(p.Y - extruderOffset[extruderNr].Y), INT2MM(zPos), fspeed);
fprintf(f, "G1 X%0.3f Y%0.3f Z%0.3f F%0.1f\r\n", INT2MM(p.X - extruderOffset[extruderNr].X), INT2MM(p.Y - extruderOffset[extruderNr].Y), INT2MM(zPos), fspeed);
}else{
//Normal E handling.
@@ -278,6 +295,7 @@ void GCodeExport::writeMove(Point p, int speed, int lineWidth)
}
currentPosition = Point3(p.X, p.Y, zPos);
startPosition = currentPosition;
estimateCalculator.plan(TimeEstimateCalculator::Position(INT2MM(currentPosition.x), INT2MM(currentPosition.y), INT2MM(currentPosition.z), extrusionAmount), speed);
}
@@ -310,7 +328,7 @@ void GCodeExport::switchExtruder(int newExtruder)
if (flavor == GCODE_FLAVOR_BFB)
{
if (!isRetracted)
fprintf(f, "M103\n");
fprintf(f, "M103\r\n");
isRetracted = true;
return;
}
@@ -339,7 +357,11 @@ void GCodeExport::switchExtruder(int newExtruder)
void GCodeExport::writeCode(const char* str)
{
fprintf(f, "%s\n", str);
fprintf(f, "%s", str);
if (flavor == GCODE_FLAVOR_BFB)
fprintf(f, "\r\n");
else
fprintf(f, "\n");
}
void GCodeExport::writeFanCommand(int speed)
+5
Ver Arquivo
@@ -27,6 +27,7 @@ private:
double minimalExtrusionBeforeRetraction;
double extrusionAmountAtPreviousRetraction;
Point3 currentPosition;
Point3 startPosition;
Point extruderOffset[MAX_EXTRUDERS];
char extruderCharacter[MAX_EXTRUDERS];
int currentSpeed, retractionSpeed;
@@ -67,6 +68,10 @@ public:
Point getPositionXY();
void resetStartPosition();
Point getStartPositionXY();
int getPositionZ();
int getExtruderNr();
+1 -1
Ver Arquivo
@@ -20,7 +20,7 @@ namespace cura {
void createLayerWithParts(SliceLayer& storageLayer, SlicerLayer* layer, int unionAllType)
{
storageLayer.openLines = layer->openPolygonList;
storageLayer.openLines = layer->openPolygons;
if (unionAllType & FIX_HORRIBLE_UNION_ALL_TYPE_B)
{
+7 -5
Ver Arquivo
@@ -44,6 +44,7 @@ OptimizedVolume::OptimizedVolume(SimpleVolume* volume, OptimizedModel* model)
}
if (f.index[0] != f.index[1] && f.index[0] != f.index[2] && f.index[1] != f.index[2])
{
/*
//Check if there is a face with the same points
bool duplicate = false;
for(unsigned int _idx0 = 0; _idx0 < points[f.index[0]].faceIndexList.size(); _idx0++)
@@ -59,11 +60,12 @@ OptimizedVolume::OptimizedVolume(SimpleVolume* volume, OptimizedModel* model)
}
if (!duplicate)
{
points[f.index[0]].faceIndexList.push_back(faces.size());
points[f.index[1]].faceIndexList.push_back(faces.size());
points[f.index[2]].faceIndexList.push_back(faces.size());
faces.push_back(f);
}
*/
points[f.index[0]].faceIndexList.push_back(faces.size());
points[f.index[1]].faceIndexList.push_back(faces.size());
points[f.index[2]].faceIndexList.push_back(faces.size());
faces.push_back(f);
//}
}
}
//fprintf(stdout, "\rAll faces are optimized in %5.1fs.\n",timeElapsed(t));
+6 -1
Ver Arquivo
@@ -11,6 +11,7 @@ void generateSkirt(SliceDataStorage& storage, int distance, int extrusionWidth,
{
int offsetDistance = distance + extrusionWidth * skirtNr + extrusionWidth / 2;
SupportPolyGenerator supportGenerator(storage.support, initialLayerHeight);
Polygons skirtPolygons(storage.wipeTower.offset(offsetDistance));
for(unsigned int volumeIdx = 0; volumeIdx < storage.volumes.size(); volumeIdx++)
{
@@ -26,10 +27,14 @@ void generateSkirt(SliceDataStorage& storage, int distance, int extrusionWidth,
}
else
skirtPolygons = skirtPolygons.unionPolygons(layer->parts[i].outline.offset(offsetDistance));
supportGenerator.polygons = supportGenerator.polygons.difference(layer->parts[i].outline);
}
}
SupportPolyGenerator supportGenerator(storage.support, initialLayerHeight);
//Contract and expand the suppory polygons so small sections are removed and the final polygon is smoothed a bit.
supportGenerator.polygons = supportGenerator.polygons.offset(-extrusionWidth * 3);
supportGenerator.polygons = supportGenerator.polygons.offset(extrusionWidth * 3);
skirtPolygons = skirtPolygons.unionPolygons(supportGenerator.polygons.offset(offsetDistance));
//Remove small inner skirt holes. Holes have a negative area, remove anything smaller then 100x extrusion "area"
+9 -18
Ver Arquivo
@@ -11,6 +11,8 @@ namespace cura {
void SlicerLayer::makePolygons(OptimizedVolume* ov, bool keepNoneClosed, bool extensiveStitching)
{
Polygons openPolygonList;
for(unsigned int startSegment=0; startSegment < segmentList.size(); startSegment++)
{
if (segmentList[startSegment].addedToPolygon)
@@ -261,19 +263,6 @@ void SlicerLayer::makePolygons(OptimizedVolume* ov, bool keepNoneClosed, bool ex
}
}
/*
int q=0;
for(unsigned int i=0;i<openPolygonList.size();i++)
{
if (openPolygonList[i].size() < 2) continue;
if (!q) log("***\n");
log("S: %f %f\n", float(openPolygonList[i][0].X), float(openPolygonList[i][0].Y));
log("E: %f %f\n", float(openPolygonList[i][openPolygonList[i].size()-1].X), float(openPolygonList[i][openPolygonList[i].size()-1].Y));
q = 1;
}
*/
//if (q) exit(1);
if (keepNoneClosed)
{
for(unsigned int n=0; n<openPolygonList.size(); n++)
@@ -282,8 +271,11 @@ void SlicerLayer::makePolygons(OptimizedVolume* ov, bool keepNoneClosed, bool ex
polygonList.add(openPolygonList[n]);
}
}
//Clear the openPolygonList to save memory, the only reason to keep it after this is for debugging.
//openPolygonList.clear();
for(unsigned int i=0;i<openPolygonList.size();i++)
{
if (openPolygonList[i].size() > 0)
openPolygons.newPoly() = openPolygonList[i];
}
//Remove all the tiny polygons, or polygons that are not closed. As they do not contribute to the actual print.
int snapDistance = MM2INT(1.0);
@@ -403,10 +395,9 @@ void Slicer::dumpSegmentsToHTML(const char* filename)
}
fprintf(f, "\"/>");
fprintf(f, "</g>\n");
for(unsigned int j=0; j<layers[i].openPolygonList.size(); j++)
for(unsigned int j=0; j<layers[i].openPolygons.size(); j++)
{
PolygonRef p = layers[i].openPolygonList[j];
if (p.size() < 1) continue;
PolygonRef p = layers[i].openPolygons[j];
fprintf(f, "<polyline marker-mid='url(#MidMarker)' points=\"");
for(unsigned int n=0; n<p.size(); n++)
{
+1 -1
Ver Arquivo
@@ -44,7 +44,7 @@ public:
int z;
Polygons polygonList;
Polygons openPolygonList;
Polygons openPolygons;
void makePolygons(OptimizedVolume* ov, bool keepNoneClosed, bool extensiveStitching);