本文整理汇总了C++中GCodeExport::setExtruderOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ GCodeExport::setExtruderOffset方法的具体用法?C++ GCodeExport::setExtruderOffset怎么用?C++ GCodeExport::setExtruderOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GCodeExport
的用法示例。
在下文中一共展示了GCodeExport::setExtruderOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processFile
void processFile(const char* input_filename, ConfigSettings& config, GCodeExport& gcode, bool firstFile)
{
for(unsigned int n=1; n<16; n++)
gcode.setExtruderOffset(n, config.extruderOffset[n].p());
gcode.setFlavor(config.gcodeFlavor);
double t = getTime();
log("Loading %s from disk...\n", input_filename);
SimpleModel* m = loadModel(input_filename, config.matrix);
if (!m)
{
log("Failed to load model: %s\n", input_filename);
return;
}
log("Loaded from disk in %5.3fs\n", timeElapsed(t));
log("Analyzing and optimizing model...\n");
OptimizedModel* om = new OptimizedModel(m, Point3(config.objectPosition.X, config.objectPosition.Y, -config.objectSink));
for(unsigned int v = 0; v < m->volumes.size(); v++)
{
log(" Face counts: %i -> %i %0.1f%%\n", (int)m->volumes[v].faces.size(), (int)om->volumes[v].faces.size(), float(om->volumes[v].faces.size()) / float(m->volumes[v].faces.size()) * 100);
log(" Vertex counts: %i -> %i %0.1f%%\n", (int)m->volumes[v].faces.size() * 3, (int)om->volumes[v].points.size(), float(om->volumes[v].points.size()) / float(m->volumes[v].faces.size() * 3) * 100);
}
delete m;
log("Optimize model %5.3fs \n", timeElapsed(t));
//om->saveDebugSTL("c:\\models\\output.stl");
log("Slicing model...\n");
vector<Slicer*> slicerList;
for(unsigned int volumeIdx=0; volumeIdx < om->volumes.size(); volumeIdx++)
{
slicerList.push_back(new Slicer(&om->volumes[volumeIdx], config.initialLayerThickness / 2, config.layerThickness, config.fixHorrible & FIX_HORRIBLE_KEEP_NONE_CLOSED, config.fixHorrible & FIX_HORRIBLE_EXTENSIVE_STITCHING));
//slicerList[volumeIdx]->dumpSegmentsToHTML("C:\\models\\output.html");
}
log("Sliced model in %5.3fs\n", timeElapsed(t));
SliceDataStorage storage;
fprintf(stdout,"Generating support map...\n");
generateSupportGrid(storage.support, om, config.supportAngle, config.supportEverywhere > 0, config.supportXYDistance, config.supportZDistance);
storage.modelSize = om->modelSize;
storage.modelMin = om->vMin;
storage.modelMax = om->vMax;
delete om;
log("Generating layer parts...\n");
for(unsigned int volumeIdx=0; volumeIdx < slicerList.size(); volumeIdx++)
{
storage.volumes.push_back(SliceVolumeStorage());
createLayerParts(storage.volumes[volumeIdx], slicerList[volumeIdx], config.fixHorrible & (FIX_HORRIBLE_UNION_ALL_TYPE_A | FIX_HORRIBLE_UNION_ALL_TYPE_B | FIX_HORRIBLE_UNION_ALL_TYPE_C));
delete slicerList[volumeIdx];
}
//carveMultipleVolumes(storage.volumes);
generateMultipleVolumesOverlap(storage.volumes, config.multiVolumeOverlap);
log("Generated layer parts in %5.3fs\n", timeElapsed(t));
//dumpLayerparts(storage, "c:/models/output.html");
const unsigned int totalLayers = storage.volumes[0].layers.size();
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
int insetCount = config.insetCount;
if (config.spiralizeMode && int(layerNr) < config.downSkinCount && layerNr % 2 == 1)//Add extra insets every 2 layers when spiralizing, this makes bottoms of cups watertight.
insetCount += 5;
generateInsets(&storage.volumes[volumeIdx].layers[layerNr], config.extrusionWidth, insetCount);
}
logProgress("inset",layerNr+1,totalLayers);
}
log("Generated inset in %5.3fs\n", timeElapsed(t));
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
if (!config.spiralizeMode || int(layerNr) < config.downSkinCount) //Only generate up/downskin and infill for the first X layers when spiralize is choosen.
{
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
generateSkins(layerNr, storage.volumes[volumeIdx], config.extrusionWidth, config.downSkinCount, config.upSkinCount, config.infillOverlap);
generateSparse(layerNr, storage.volumes[volumeIdx], config.extrusionWidth, config.downSkinCount, config.upSkinCount);
}
}
logProgress("skin",layerNr+1,totalLayers);
}
log("Generated up/down skin in %5.3fs\n", timeElapsed(t));
generateSkirt(storage, config.skirtDistance, config.extrusionWidth, config.skirtLineCount, config.skirtMinLength);
generateRaft(storage, config.raftMargin);
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
for(unsigned int partNr=0; partNr<storage.volumes[volumeIdx].layers[layerNr].parts.size(); partNr++)
{
if (layerNr > 0)
storage.volumes[volumeIdx].layers[layerNr].parts[partNr].bridgeAngle = bridgeAngle(&storage.volumes[volumeIdx].layers[layerNr].parts[partNr], &storage.volumes[volumeIdx].layers[layerNr-1]);
else
storage.volumes[volumeIdx].layers[layerNr].parts[partNr].bridgeAngle = -1;
}
}
}
//.........这里部分代码省略.........
示例2: processFile
void processFile(const char* input_filename, Config& config, GCodeExport& gcode, bool firstFile)
{
for(unsigned int n=1; n<16;n++)
gcode.setExtruderOffset(n, config.extruderOffset[n]);
double t = getTime();
log("Loading %s from disk...\n", input_filename);
SimpleModel* m = loadModel(input_filename, config.matrix);
if (!m)
{
log("Failed to load model: %s\n", input_filename);
return;
}
log("Loaded from disk in %5.3fs\n", timeElapsed(t));
log("Analyzing and optimizing model...\n");
OptimizedModel* om = new OptimizedModel(m, Point3(config.objectPosition.X, config.objectPosition.Y, -config.objectSink));
for(unsigned int v = 0; v < m->volumes.size(); v++)
{
log(" Face counts: %i -> %i %0.1f%%\n", (int)m->volumes[v].faces.size(), (int)om->volumes[v].faces.size(), float(om->volumes[v].faces.size()) / float(m->volumes[v].faces.size()) * 100);
log(" Vertex counts: %i -> %i %0.1f%%\n", (int)m->volumes[v].faces.size() * 3, (int)om->volumes[v].points.size(), float(om->volumes[v].points.size()) / float(m->volumes[v].faces.size() * 3) * 100);
}
delete m;
log("Optimize model %5.3fs \n", timeElapsed(t));
//om->saveDebugSTL("c:\\models\\output.stl");
log("Slicing model...\n");
vector<Slicer*> slicerList;
for(unsigned int volumeIdx=0; volumeIdx < om->volumes.size(); volumeIdx++)
{
slicerList.push_back(new Slicer(&om->volumes[volumeIdx], config.initialLayerThickness / 2, config.layerThickness, config.fixHorrible & FIX_HORRIBLE_KEEP_NONE_CLOSED, config.fixHorrible & FIX_HORRIBLE_EXTENSIVE_STITCHING));
//slicerList[volumeIdx]->dumpSegments("C:\\models\\output.html");
}
log("Sliced model in %5.3fs\n", timeElapsed(t));
SliceDataStorage storage;
if (config.supportAngle > -1)
{
fprintf(stdout,"Generating support map...\n");
generateSupportGrid(storage.support, om, config.initialLayerThickness / 2, config.layerThickness);
}
storage.modelSize = om->modelSize;
storage.modelMin = om->vMin;
storage.modelMax = om->vMax;
delete om;
log("Generating layer parts...\n");
for(unsigned int volumeIdx=0; volumeIdx < slicerList.size(); volumeIdx++)
{
storage.volumes.push_back(SliceVolumeStorage());
createLayerParts(storage.volumes[volumeIdx], slicerList[volumeIdx], config.fixHorrible & (FIX_HORRIBLE_UNION_ALL_TYPE_A | FIX_HORRIBLE_UNION_ALL_TYPE_B));
delete slicerList[volumeIdx];
}
//carveMultipleVolumes(storage.volumes);
generateMultipleVolumesOverlap(storage.volumes, config.multiVolumeOverlap);
log("Generated layer parts in %5.3fs\n", timeElapsed(t));
//dumpLayerparts(storage, "c:/models/output.html");
const unsigned int totalLayers = storage.volumes[0].layers.size();
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
generateInsets(&storage.volumes[volumeIdx].layers[layerNr], config.extrusionWidth, config.insetCount);
}
logProgress("inset",layerNr+1,totalLayers);
}
log("Generated inset in %5.3fs\n", timeElapsed(t));
//dumpLayerparts(storage, "c:/models/output.html");
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
generateSkins(layerNr, storage.volumes[volumeIdx], config.extrusionWidth, config.downSkinCount, config.upSkinCount, config.infillOverlap);
generateSparse(layerNr, storage.volumes[volumeIdx], config.extrusionWidth, config.downSkinCount, config.upSkinCount);
}
logProgress("skin",layerNr+1,totalLayers);
}
log("Generated up/down skin in %5.3fs\n", timeElapsed(t));
generateSkirt(storage, config.skirtDistance, config.extrusionWidth, config.skirtLineCount);
generateRaft(storage, config.raftMargin);
log("Generated skirt and raft in %5.3fs\n", timeElapsed(t));
for(unsigned int volumeIdx=0; volumeIdx<storage.volumes.size(); volumeIdx++)
{
for(unsigned int layerNr=0; layerNr<totalLayers; layerNr++)
{
for(unsigned int partNr=0; partNr<storage.volumes[volumeIdx].layers[layerNr].parts.size(); partNr++)
{
if (layerNr > 0)
storage.volumes[volumeIdx].layers[layerNr].parts[partNr].bridgeAngle = bridgeAngle(&storage.volumes[volumeIdx].layers[layerNr].parts[partNr], &storage.volumes[volumeIdx].layers[layerNr-1]);
else
storage.volumes[volumeIdx].layers[layerNr].parts[partNr].bridgeAngle = -1;
}
}
}
log("Stored volumes in %5.3fs\n", timeElapsed(t));
gcode.setRetractionSettings(config.retractionAmount, config.retractionSpeed, config.retractionAmountExtruderSwitch);
//.........这里部分代码省略.........