Fix Warnings

Add Time in Step File
pull/549/head
Madrich 2015-05-01 22:19:40 +02:00
parent ca8a3909be
commit 58a72d9302
3 changed files with 10 additions and 9 deletions

View File

@ -99,7 +99,7 @@ void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector
{ {
if (scene->mNumMeshes == 0) return; if (scene->mNumMeshes == 0) return;
FindMeshCenter(scene->mMeshes[0], out, min, max); FindMeshCenter(scene->mMeshes[0], out, min, max);
for (int i = 1; i < scene->mNumMeshes; ++i) for (unsigned int i = 1; i < scene->mNumMeshes; ++i)
{ {
aiVector3D tout, tmin, tmax; aiVector3D tout, tmin, tmax;
FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax); FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax);

View File

@ -150,8 +150,6 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") ); mOutput.imbue( std::locale("C") );
mFile = std::string(file);
mPath = std::string(path);
mScene = pScene; mScene = pScene;
mSceneOwned = false; mSceneOwned = false;
@ -182,9 +180,7 @@ void StepExporter::WriteFile()
// note, that all realnumber values must be comma separated in x files // note, that all realnumber values must be comma separated in x files
mOutput.setf(std::ios::fixed); mOutput.setf(std::ios::fixed);
mOutput.precision(16); // precission for double mOutput.precision(16); // precission for double
aiMatrix4x4 baseTransform = mScene->mRootNode->mTransformation;
int ind = 100; // the start index to be used int ind = 100; // the start index to be used
int faceEntryLen = 30; // number of entries for a triangle/face int faceEntryLen = 30; // number of entries for a triangle/face
// prepare unique (count triangles and vertices) // prepare unique (count triangles and vertices)
@ -212,11 +208,16 @@ void StepExporter::WriteFile()
} }
} }
static const unsigned int date_nb_chars = 20;
char date_str[date_nb_chars];
std::time_t date = std::time(NULL);
std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date));
// write the header // write the header
mOutput << "ISO-10303-21" << endstr; mOutput << "ISO-10303-21" << endstr;
mOutput << "HEADER" << endstr; mOutput << "HEADER" << endstr;
mOutput << "FILE_DESCRIPTION(('STEP AP214'),'1')" << endstr; mOutput << "FILE_DESCRIPTION(('STEP AP214'),'1')" << endstr;
mOutput << "FILE_NAME('" << mFile << ".stp','2015-04-23T09:26:41',(' '),(' '),'Spatial InterOp 3D',' ',' ')" << endstr; mOutput << "FILE_NAME('" << mFile << ".stp','" << date_str << "',(' '),(' '),'Spatial InterOp 3D',' ',' ')" << endstr;
mOutput << "FILE_SCHEMA(('automotive_design'))" << endstr; mOutput << "FILE_SCHEMA(('automotive_design'))" << endstr;
mOutput << "ENDSEC" << endstr; mOutput << "ENDSEC" << endstr;

View File

@ -111,7 +111,7 @@ XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const s
mSceneOwned = false; mSceneOwned = false;
// set up strings // set up strings
endstr = "\n"; endstr = "\n";
// start writing // start writing
WriteFile(); WriteFile();
@ -509,7 +509,7 @@ std::string XFileExporter::toXFileString(aiString &name)
{ {
std::string pref = "NN_"; // node name prefix to prevent unexpected start of string std::string pref = "NN_"; // node name prefix to prevent unexpected start of string
std::string str = pref + std::string(name.C_Str()); std::string str = pref + std::string(name.C_Str());
for (int i=0; i<str.length(); ++i) for (int i=0; i < (int) str.length(); ++i)
{ {
if ((str[i] >= 48 && str[i] <= 57) || // 0-9 if ((str[i] >= 48 && str[i] <= 57) || // 0-9
(str[i] >= 65 && str[i] <= 90) || // A-Z (str[i] >= 65 && str[i] <= 90) || // A-Z