Browse Source

Fix Warnings
Add Time in Step File

Madrich 10 years ago
parent
commit
58a72d9302
3 changed files with 10 additions and 9 deletions
  1. 1 1
      code/ProcessHelper.cpp
  2. 7 6
      code/StepExporter.cpp
  3. 2 2
      code/XFileExporter.cpp

+ 1 - 1
code/ProcessHelper.cpp

@@ -99,7 +99,7 @@ void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector
 {
 	if (scene->mNumMeshes == 0) return;
 	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;
 		FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax);

+ 7 - 6
code/StepExporter.cpp

@@ -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
 	mOutput.imbue( std::locale("C") );
 
-	mFile = std::string(file);
-	mPath = std::string(path);
 	mScene = pScene;
 	mSceneOwned = false;
 
@@ -182,9 +180,7 @@ void StepExporter::WriteFile()
 	// note, that all realnumber values must be comma separated in x files
 	mOutput.setf(std::ios::fixed);
 	mOutput.precision(16); // precission for double
-
-	aiMatrix4x4 baseTransform = mScene->mRootNode->mTransformation;
-
+	
 	int ind = 100; // the start index to be used
 	int faceEntryLen = 30; // number of entries for a triangle/face
 	// 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	
 	mOutput << "ISO-10303-21" << endstr;
 	mOutput << "HEADER" << 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 << "ENDSEC" << endstr;
 

+ 2 - 2
code/XFileExporter.cpp

@@ -111,7 +111,7 @@ XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const s
 	mSceneOwned = false;
 
 	// set up strings
-	endstr = "\n"; 
+	endstr = "\n";
 
 	// start writing
 	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 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
 			(str[i] >= 65 && str[i] <= 90) || // A-Z