Skip to content

Commit

Permalink
[finishes: 30372237] First pass at a volumetric anchor. Requires that…
Browse files Browse the repository at this point in the history
… your starting position from the start.gcode also be in your config
  • Loading branch information
Joe Sadusk committed May 29, 2012
1 parent f8c0490 commit 52f82d3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
5 changes: 4 additions & 1 deletion miracle.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
"scalingFactor" : 1,
"rapidMoveFeedRateXY": 6000,
"rapidMoveFeedRateZ": 1400,
"homingFeedRateZ" : 100
"homingFeedRateZ" : 100,
"startX" : -110.4,
"startY" : -74.0,
"startZ" : 0.2
},
"outline" : { // a rectangle around the part on the build platform
"enabled" : false,
Expand Down
4 changes: 4 additions & 0 deletions src/mgl/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,17 @@ void mgl::loadGCoderConfigFromFile(const Configuration& conf, GCoderConfig &gcod
gcoderCfg.machineName = stringCheck(conf.root["machineName"],"machineName");
gcoderCfg.firmware = stringCheck(conf.root["firmware"], "firmware");


gcoderCfg.gantry.xyMaxHoming = boolCheck(conf.root["gantry"]["xyMaxHoming"], "gantry.xyMaxHoming");
gcoderCfg.gantry.zMaxHoming = boolCheck(conf.root["gantry"]["zMaxHoming" ], "gantry.zMaxHoming");
gcoderCfg.gantry.scalingFactor = doubleCheck(conf.root["gantry"]["scalingFactor"], "gantry.scalingFactor");
gcoderCfg.gantry.rapidMoveFeedRateXY = doubleCheck(conf.root["gantry"]["rapidMoveFeedRateXY"], "gantry.rapidMoveFeedRateXY");
gcoderCfg.gantry.rapidMoveFeedRateZ = doubleCheck(conf.root["gantry"]["rapidMoveFeedRateZ"], "gantry.rapidMoveFeedRateZ");
gcoderCfg.gantry.homingFeedRateZ = doubleCheck(conf.root["gantry"]["homingFeedRateZ"], "gantry.homingFeedRateZ");
gcoderCfg.gantry.layerH = doubleCheck(conf.root["slicer"]["layerH"], "slicer.layerH");
gcoderCfg.gantry.x = doubleCheck(conf.root["gantry"]["startX"], "gantry.startX");
gcoderCfg.gantry.y = doubleCheck(conf.root["gantry"]["startY"], "gantry.startY");
gcoderCfg.gantry.z = doubleCheck(conf.root["gantry"]["startZ"], "gantry.startZ");


gcoderCfg.platform.temperature = doubleCheck(conf.root["platform"]["temperature"], "platform.temperature");
Expand Down
25 changes: 25 additions & 0 deletions src/mgl/gcoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,18 @@ void GCoder::writeGcodeFile(std::vector <SliceData>& slices,
if(iFirstSliceIdx > 0) firstSliceIdx = (size_t) iFirstSliceIdx;
if(iLastSliceIdx < 0) lastSliceIdx = (size_t) iLastSliceIdx;

Extruder &extruder = gcoderCfg.extruders[0];
Extrusion extrusion;
calcInfillExtrusion(0, 0, extrusion);
Vector2 start = startPoint(slices[0]);
gcoderCfg.gantry.squirt(gout, start, extruder, extrusion);
gcoderCfg.gantry.g1(gout, extruder, extrusion, start.x, start.y,
gcoderCfg.gantry.z, extrusion.feedrate,
"Extrude into position");

initProgress("gcode", sliceCount);
size_t codeSlice = 0;

for(size_t sliceId=0; sliceId < sliceCount; sliceId++)
{
tick();
Expand All @@ -470,6 +480,21 @@ void GCoder::writeGcodeFile(std::vector <SliceData>& slices,
writeEndDotGCode(gout);
}

Vector2 GCoder::startPoint(const SliceData& sliceData) {
if (gcoderCfg.doInfills && gcoderCfg.doInfillsFirst) {
return sliceData.extruderSlices[0].infills[0][0];
}
else if (gcoderCfg.doOutlines) {
return sliceData.extruderSlices[0].boundary[0][0];
}
else if (gcoderCfg.doInsets) {
return sliceData.extruderSlices[0].insetLoopsList[0][0][0];
}
else {
return sliceData.extruderSlices[0].infills[0][0];
}
}

void GCoder::writeSlice(ostream& ss, const SliceData& sliceData )
{
double layerZ = sliceData.getZHeight();
Expand Down
3 changes: 3 additions & 0 deletions src/mgl/gcoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ struct GCoderConfig
bool doInfills;
bool doInfillsFirst;

Scalar startX;
Scalar startY;
std::string header;
std::string footer;

Expand Down Expand Up @@ -368,6 +370,7 @@ class GCoder : public Progressive
const Extrusion &extrusion,
const Polygon & polygon);

libthing::Vector2 startPoint(const SliceData &sliceData);
// void writeWipeExtruder(std::ostream& ss, int extruderId) const {};
};

Expand Down
7 changes: 2 additions & 5 deletions start_replicator_dual.gcode
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ G1 X-110.5 Y-74 Z150 F3300.0 (move to waiting position)
G130 X0 Y0 A0 B0 (Lower stepper Vrefs while heating)
M6 T0 (wait for toolhead, and HBP to reach temperature)
G130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)
M108 R3.0 T0

G0 X-110.5 Y-74 (Position Nozzle)
G0 Z0.2 (Position Height)
M108 R4.0 (Set Extruder Speed)
M101 (Start Extruder)
G4 P1500 (Create Anchor)
M103 (Stop Extruder)
G1 A2.0 (Create Anchor)
(**** end of start.gcode ****)

0 comments on commit 52f82d3

Please sign in to comment.