mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Rewritten library to use code generated from IFC2X3_TC1.exp
This commit is contained in:
+17
-2
@@ -26,6 +26,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
|
||||
@@ -46,9 +47,12 @@ int main ( int argc, char** argv ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Stream for log messages, we don't want to interupt our new progress bar...
|
||||
std::stringstream ss;
|
||||
|
||||
// Parse the file supplied in argv[1]. Returns true on succes.
|
||||
// The second argument defines whether geometry will be defined using global or local coordinates.
|
||||
if ( ! IfcGeomObjects::Init(argv[1],true) ) {
|
||||
if ( ! IfcGeomObjects::Init(argv[1],true,&ss) ) {
|
||||
std::cout << "[Error] unable to parse .ifc file or no geometrical entities found" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@@ -59,6 +63,8 @@ int main ( int argc, char** argv ) {
|
||||
|
||||
time_t start,end;
|
||||
time(&start);
|
||||
int old_progress = -1;
|
||||
std::cout << "Creating geometry..." << std::endl;
|
||||
|
||||
// The functions IfcGeomObjects::Get() and IfcGeomObjects::Next() wrap an iterator of all geometrical entities in the Ifc file.
|
||||
// IfcGeomObjects::Get() returns an IfcGeomObjects::IfcGeomObject (see IfcObjects.h for definition)
|
||||
@@ -82,7 +88,13 @@ int main ( int argc, char** argv ) {
|
||||
const int v3 = *(it++)-vcount;
|
||||
fObj << "f " << v1 << " " << v2 << " " << v3 << std::endl;
|
||||
}
|
||||
|
||||
const int progress = IfcGeomObjects::Progress() / 2;
|
||||
if ( old_progress!= progress ) std::cout << "\r[" << std::string(progress,'#') << std::string(50 - progress,' ') << "]" << std::flush;
|
||||
old_progress = progress;
|
||||
|
||||
} while ( IfcGeomObjects::Next() );
|
||||
std::cout << "\rDone creating geometry " << std::endl;
|
||||
|
||||
// Writes the material settings, defined in Materials.h
|
||||
fMtl << "# File generated by IfcOpenShell" << std::endl;
|
||||
@@ -90,7 +102,10 @@ int main ( int argc, char** argv ) {
|
||||
fMtl << GetMaterial(*it);
|
||||
}
|
||||
|
||||
std::cout << std::endl << "Log:" << std::endl;
|
||||
std::cout << ss.str();
|
||||
|
||||
time(&end);
|
||||
int dif = (int) difftime (end,start);
|
||||
printf ("Conversion took %d seconds\n", dif );
|
||||
printf ("\nConversion took %d seconds\n", dif );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user