mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 21:27:52 -06:00
Logging file system error and formatting png output filename for equal leading zeros.
This commit is contained in:
parent
e6e078cbf7
commit
6cc4e99632
2 changed files with 22 additions and 5 deletions
2
xs/src/agg/VERSION
Normal file
2
xs/src/agg/VERSION
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
2.4
|
||||||
|
svn revision 128
|
|
@ -10,6 +10,7 @@
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
|
|
||||||
// For png export of the sliced model
|
// For png export of the sliced model
|
||||||
|
@ -1352,13 +1353,22 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void save(const std::string& path) {
|
inline void save(const std::string& path) {
|
||||||
|
|
||||||
for(unsigned i = 0; i < layers_rst_.size(); i++) {
|
for(unsigned i = 0; i < layers_rst_.size(); i++) {
|
||||||
if(layers_rst_[i].second.rdbuf()->in_avail() > 0) {
|
if(layers_rst_[i].second.rdbuf()->in_avail() > 0) {
|
||||||
std::string loc = path + "layer" + std::to_string(i) + ".png";
|
|
||||||
|
char lyrnum[6];
|
||||||
|
std::sprintf(lyrnum, "%.5d", i);
|
||||||
|
std::string loc = path + "layer" + lyrnum + ".png";
|
||||||
|
|
||||||
std::fstream out(loc, std::fstream::out | std::fstream::binary);
|
std::fstream out(loc, std::fstream::out | std::fstream::binary);
|
||||||
if(out.good()) {
|
if(out.good()) {
|
||||||
out << layers_rst_[i].second.rdbuf();
|
out << layers_rst_[i].second.rdbuf();
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Can't create file for layer "
|
||||||
|
<< i;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
layers_rst_[i].second.str("");
|
layers_rst_[i].second.str("");
|
||||||
}
|
}
|
||||||
|
@ -1368,13 +1378,18 @@ public:
|
||||||
void saveLayer(unsigned lyr, const std::string& path) {
|
void saveLayer(unsigned lyr, const std::string& path) {
|
||||||
unsigned i = lyr;
|
unsigned i = lyr;
|
||||||
assert(i < layers_rst_.size());
|
assert(i < layers_rst_.size());
|
||||||
std::string loc = path + "layer" + std::to_string(i) + ".png";
|
|
||||||
|
char lyrnum[6];
|
||||||
|
std::sprintf(lyrnum, "%.5d", lyr);
|
||||||
|
std::string loc = path + "layer" + lyrnum + ".png";
|
||||||
|
|
||||||
std::fstream out(loc, std::fstream::out | std::fstream::binary);
|
std::fstream out(loc, std::fstream::out | std::fstream::binary);
|
||||||
if(out.good()) {
|
if(out.good()) {
|
||||||
layers_rst_[i].first.save(out, Raster::Compression::PNG);
|
layers_rst_[i].first.save(out, Raster::Compression::PNG);
|
||||||
} /*else {
|
} else {
|
||||||
some logging should be done here...
|
BOOST_LOG_TRIVIAL(error) << "Can't create file for layer";
|
||||||
}*/
|
}
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
layers_rst_[i].first.reset();
|
layers_rst_[i].first.reset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue