本文整理汇总了C++中GCodeExport::getPositionXY方法的典型用法代码示例。如果您正苦于以下问题:C++ GCodeExport::getPositionXY方法的具体用法?C++ GCodeExport::getPositionXY怎么用?C++ GCodeExport::getPositionXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GCodeExport
的用法示例。
在下文中一共展示了GCodeExport::getPositionXY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gcode
GCodePlanner::GCodePlanner(GCodeExport& gcode, int travelSpeed, int retractionMinimalDistance)
: gcode(gcode), travelConfig(travelSpeed, 0, "travel")
{
lastPosition = gcode.getPositionXY();
comb = NULL;
extrudeSpeedFactor = 100;
travelSpeedFactor = 100;
extraTime = 0.0;
totalPrintTime = 0.0;
forceRetraction = false;
alwaysRetract = false;
currentExtruder = gcode.getExtruderNr();
this->retractionMinimalDistance = retractionMinimalDistance;
}
示例2: gcode
GCodePlanner::GCodePlanner(GCodeExport& gcode, SliceDataStorage& storage, RetractionConfig* retraction_config_travel, double travelSpeed, bool retraction_combing, unsigned int layer_nr, int64_t comb_boundary_offset, bool travel_avoid_other_parts, int64_t travel_avoid_distance)
: gcode(gcode), storage(storage)
, travelConfig(retraction_config_travel, "MOVE")
{
lastPosition = gcode.getPositionXY();
travelConfig.setSpeed(travelSpeed);
comb = nullptr;
last_retraction_config = &storage.retraction_config; // start with general config
setExtrudeSpeedFactor(1.0);
setTravelSpeedFactor(1.0);
extraTime = 0.0;
totalPrintTime = 0.0;
currentExtruder = gcode.getExtruderNr();
if (retraction_combing)
{
was_combing = true; // means it will try to get inside the comb boundary first
is_going_to_comb = true; // means it will try to get inside the comb boundary
comb = new Comb(storage, layer_nr, comb_boundary_offset, travel_avoid_other_parts, travel_avoid_distance);
}
else
comb = nullptr;
}
示例3: main
//.........这里部分代码省略.........
"G28 ;Home\n"
"G1 Z15.0 F300 ;move the platform down 15mm\n"
"G92 E0 ;zero the extruded length\n"
"G1 F200 E5 ;extrude 5mm of feed stock\n"
"G92 E0 ;zero the extruded length again\n";
config.endCode =
"M104 S0 ;extruder heater off\n"
"M140 S0 ;heated bed heater off (if you have it)\n"
"G91 ;relative positioning\n"
"G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\n"
"G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\n"
"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";
fprintf(stderr,"Cura_SteamEngine version %s\n", VERSION);
for(int argn = 1; argn < argc; argn++)
{
char* str = argv[argn];
if (str[0] == '-')
{
for(str++; *str; str++)
{
switch(*str)
{
case 'h':
print_usage();
exit(1);
case 'v':
verbose_level++;
break;
case 'b':
argn++;
binaryMeshBlob = fopen(argv[argn], "rb");
break;
case 'o':
argn++;
gcode.setFilename(argv[argn]);
if (!gcode.isValid())
{
logError("Failed to open %s for output.\n", argv[argn]);
exit(1);
}
break;
case 's':
{
argn++;
char* valuePtr = strchr(argv[argn], '=');
if (valuePtr)
{
*valuePtr++ = '\0';
if (!config.setSetting(argv[argn], valuePtr))
printf("Setting found: %s %s\n", argv[argn], valuePtr);
}
}
break;
case 'm':
argn++;
sscanf(argv[argn], "%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
&config.matrix.m[0][0], &config.matrix.m[0][1], &config.matrix.m[0][2],
&config.matrix.m[1][0], &config.matrix.m[1][1], &config.matrix.m[1][2],
&config.matrix.m[2][0], &config.matrix.m[2][1], &config.matrix.m[2][2]);
break;
default:
logError("Unknown option: %c\n", *str);
break;
}
}
} else {
if (!gcode.isValid())
{
logError("No output file specified\n");
return 1;
}
gcode.addComment("Generated with Cura_SteamEngine %s", VERSION);
processFile(argv[argn], config, gcode, fileNr == 0);
fileNr ++;
}
}
if (gcode.isValid())
{
gcode.addFanCommand(0);
gcode.setZ(maxObjectHeight + 5000);
gcode.addMove(gcode.getPositionXY(), config.moveSpeed, 0);
gcode.addCode(config.endCode);
log("Print time: %d\n", int(gcode.getTotalPrintTime()));
log("Filament: %d\n", int(gcode.getTotalFilamentUsed()));
if (gcode.getFlavor() == GCODE_FLAVOR_ULTIGCODE)
{
char numberString[16];
sprintf(numberString, "%d", int(gcode.getTotalPrintTime()));
gcode.replaceTagInStart("<__TIME__>", numberString);
sprintf(numberString, "%d", int(gcode.getTotalFilamentUsed()));
gcode.replaceTagInStart("<FILAMENT>", numberString);
}
}
}
示例4: processFile
//.........这里部分代码省略.........
gcode.addComment("RAFT");
GCodePlanner gcodeLayer(gcode, config.moveSpeed, config.retractionMinimalDistance);
gcode.setZ(config.raftBaseThickness + config.raftInterfaceThickness);
gcode.setExtrusion(config.raftInterfaceThickness, config.filamentDiameter, config.filamentFlow);
Polygons raftLines;
generateLineInfill(storage.raftOutline, raftLines, config.raftInterfaceLinewidth, config.raftLineSpacing, config.infillOverlap, 90);
gcodeLayer.addPolygonsByOptimizer(raftLines, &raftInterfaceConfig);
gcodeLayer.writeGCode(false, config.raftInterfaceThickness);
}
}
int volumeIdx = 0;
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
logProgress("export", layerNr+1, totalLayers);
GCodePlanner gcodeLayer(gcode, config.moveSpeed, config.retractionMinimalDistance);
gcode.addComment("LAYER:%d", layerNr);
int32_t z = config.initialLayerThickness + layerNr * config.layerThickness;
z += config.raftBaseThickness + config.raftInterfaceThickness;
gcode.setZ(z);
if (layerNr == 0)
gcodeLayer.addPolygonsByOptimizer(storage.skirt, &skirtConfig);
for(unsigned int volumeCnt = 0; volumeCnt < storage.volumes.size(); volumeCnt++)
{
if (volumeCnt > 0)
volumeIdx = (volumeIdx + 1) % storage.volumes.size();
SliceLayer* layer = &storage.volumes[volumeIdx].layers[layerNr];
gcodeLayer.setExtruder(volumeIdx);
PathOrderOptimizer partOrderOptimizer(gcode.getPositionXY());
for(unsigned int partNr=0; partNr<layer->parts.size(); partNr++)
{
partOrderOptimizer.addPolygon(layer->parts[partNr].insets[0][0]);
}
partOrderOptimizer.optimize();
for(unsigned int partCounter=0; partCounter<partOrderOptimizer.polyOrder.size(); partCounter++)
{
SliceLayerPart* part = &layer->parts[partOrderOptimizer.polyOrder[partCounter]];
if (config.enableCombing)
gcodeLayer.setCombBoundary(&part->combBoundery);
else
gcodeLayer.setAlwaysRetract(true);
gcodeLayer.forceRetract();
if (config.insetCount > 0)
{
if (config.spiralizeMode)
{
if (int(layerNr) >= config.downSkinCount)
inset0Config.spiralize = true;
if (int(layerNr) == config.downSkinCount && part->insets.size() > 0)
gcodeLayer.addPolygonsByOptimizer(part->insets[0], &inset1Config);
}
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], &inset1Config);
}
示例5: processFile
//.........这里部分代码省略.........
gcode.setExtrusion(config.raftInterfaceThickness, config.filamentDiameter, config.filamentFlow);
Polygons raftLines;
generateLineInfill(storage.raftOutline, raftLines, config.raftInterfaceLinewidth, config.raftLineSpacing, config.infillOverlap, 90);
gcodeLayer.addPolygonsByOptimizer(raftLines, &raftInterfaceConfig);
gcodeLayer.writeGCode(false);
}
}
int volumeIdx = 0;
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
logProgress("export", layerNr+1, totalLayers);
log("Handling layer %u out of %u \n", layerNr+1, totalLayers);
GCodePlanner gcodeLayer(gcode, config.moveSpeed);
gcode.addComment("LAYER:%d", layerNr);
int32_t z = config.initialLayerThickness + layerNr * config.layerThickness;
z += config.raftBaseThickness + config.raftInterfaceThickness;
gcode.setZ(z);
//if (layerNr == 0)
// gcodeLayer.addPolygonsByOptimizer(storage.skirt, &skirtConfig);
//log("Mark1 in %5.3fs\n", timeElapsed(t));
for(unsigned int volumeCnt = 0; volumeCnt < storage.volumes.size(); volumeCnt++)
{
log(" Going through volume %u out of %u \n", volumeCnt+1, storage.volumes.size());
if (volumeCnt > 0)
volumeIdx = (volumeIdx + 1) % storage.volumes.size();
SliceLayer* layer = &storage.volumes[volumeIdx].layers[layerNr];
gcodeLayer.setExtruder(volumeIdx);
PathOptimizer partOrderOptimizer(gcode.getPositionXY());
for(unsigned int partNr=0; partNr<layer->parts.size(); partNr++)
{
partOrderOptimizer.addPolygon(layer->parts[partNr].insets[0][0]);
}
log("partOrderOptimizer polygons %u \n", partOrderOptimizer.polygons.size());
log("partOrderOptimizer polyorder %u \n", partOrderOptimizer.polyOrder.size());
partOrderOptimizer.optimize();
log("POST OPTIM partOrderOptimizer polygons %u \n", partOrderOptimizer.polygons.size());
log("POST OPTIM partOrderOptimizer polyorder %u \n", partOrderOptimizer.polyOrder.size());
//log("POST OPTIM polyorder at 0 %u \n", partOrderOptimizer.polyOrder[0]);
log("toto\n");
for(unsigned int partCounter=0; partCounter<partOrderOptimizer.polyOrder.size(); partCounter++)
{
//log(" Going through part %u out of %u \n", partCounter+1, partOrderOptimizer.polyOrder.size());
SliceLayerPart* part = &layer->parts[partOrderOptimizer.polyOrder[partCounter]];
log("order index %u \n", partOrderOptimizer.polyOrder[partCounter]);
try
{
if(part->skinOutline.size()>0)
{
if(part->skinOutline[0].size()>0)
{
Point p0 = (part->skinOutline)[0][0];
log("bla %f pof\n",p0.X);
}
}
}
catch (int e)
{
log("An exception occurred. Exception Nr.%i \n",e);