mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 02:21:02 +00:00
Provide more contextual information in the IFC SPF file header
This commit is contained in:
@@ -48,6 +48,7 @@ int main(int argc, char** argv) {
|
|||||||
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
|
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
|
||||||
// convenience functions for working with geometry in IFC files.
|
// convenience functions for working with geometry in IFC files.
|
||||||
IfcHierarchyHelper file;
|
IfcHierarchyHelper file;
|
||||||
|
file.filename("IfcOpenHouse.ifc");
|
||||||
|
|
||||||
// Start by adding a wall to the file, initially leaving most attributes blank.
|
// Start by adding a wall to the file, initially leaving most attributes blank.
|
||||||
Ifc2x3::IfcWallStandardCase* south_wall = new Ifc2x3::IfcWallStandardCase(
|
Ifc2x3::IfcWallStandardCase* south_wall = new Ifc2x3::IfcWallStandardCase(
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#include "../ifcparse/IfcCharacterDecoder.h"
|
#include "../ifcparse/IfcCharacterDecoder.h"
|
||||||
#include "../ifcparse/IfcParse.h"
|
#include "../ifcparse/IfcParse.h"
|
||||||
@@ -643,6 +644,7 @@ IfcFile::IfcFile() {
|
|||||||
lastId = 0;
|
lastId = 0;
|
||||||
tokens = 0;
|
tokens = 0;
|
||||||
MaxId = 0;
|
MaxId = 0;
|
||||||
|
initTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -849,7 +851,15 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
|
|||||||
os << "ISO-10303-21;" << std::endl;
|
os << "ISO-10303-21;" << std::endl;
|
||||||
os << "HEADER;" << std::endl;
|
os << "HEADER;" << std::endl;
|
||||||
os << "FILE_DESCRIPTION(('ViewDefinition []'),'2;1');" << std::endl;
|
os << "FILE_DESCRIPTION(('ViewDefinition []'),'2;1');" << std::endl;
|
||||||
os << "FILE_NAME('','',(''),('',''),'IfcOpenShell','IfcOpenShell','');" << std::endl;
|
os << "FILE_NAME("
|
||||||
|
<< static_cast<std::string>(IfcWrite::IfcCharacterEncoder(f.filename())) << ","
|
||||||
|
<< static_cast<std::string>(IfcWrite::IfcCharacterEncoder(f.timestamp())) << ",("
|
||||||
|
<< static_cast<std::string>(IfcWrite::IfcCharacterEncoder(f.authorOrganisation())) << "),("
|
||||||
|
<< static_cast<std::string>(IfcWrite::IfcCharacterEncoder(f.authorName())) << ","
|
||||||
|
<< static_cast<std::string>(IfcWrite::IfcCharacterEncoder(f.authorEmail()))
|
||||||
|
<< "),'IfcOpenShell " << IFCOPENSHELL_VERSION
|
||||||
|
<< "','IfcOpenShell " << IFCOPENSHELL_VERSION
|
||||||
|
<< "','');" << std::endl;
|
||||||
os << "FILE_SCHEMA(('IFC2X3'));" << std::endl;
|
os << "FILE_SCHEMA(('IFC2X3'));" << std::endl;
|
||||||
os << "ENDSEC;" << std::endl;
|
os << "ENDSEC;" << std::endl;
|
||||||
os << "DATA;" << std::endl;
|
os << "DATA;" << std::endl;
|
||||||
@@ -864,3 +874,25 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
|
|||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IfcFile::filename(const std::string& s) { _filename = s; }
|
||||||
|
std::string IfcFile::filename() const { return _filename; }
|
||||||
|
void IfcFile::timestamp(const std::string& s) { _timestamp = s; }
|
||||||
|
std::string IfcFile::timestamp() const { return _timestamp; }
|
||||||
|
void IfcFile::author(const std::string& name, const std::string& email, const std::string& organisation) {
|
||||||
|
_author = name;
|
||||||
|
_author_email = email;
|
||||||
|
_author_organisation = organisation;
|
||||||
|
}
|
||||||
|
std::string IfcFile::authorName() const { return _author; }
|
||||||
|
std::string IfcFile::authorEmail() const { return _author_email; }
|
||||||
|
std::string IfcFile::authorOrganisation() const { return _author_organisation; }
|
||||||
|
void IfcFile::initTimestamp() {
|
||||||
|
char buf[255];
|
||||||
|
time_t t;
|
||||||
|
time(&t);
|
||||||
|
struct tm * ti = localtime (&t);
|
||||||
|
if (strftime(buf,255,"%Y-%m-%dT%H:%M:%S",ti)) {
|
||||||
|
_timestamp = std::string(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -229,6 +229,12 @@ private:
|
|||||||
MapOffsetById offsets;
|
MapOffsetById offsets;
|
||||||
unsigned int lastId;
|
unsigned int lastId;
|
||||||
unsigned int MaxId;
|
unsigned int MaxId;
|
||||||
|
std::string _filename;
|
||||||
|
std::string _timestamp;
|
||||||
|
std::string _author;
|
||||||
|
std::string _author_email;
|
||||||
|
std::string _author_organisation;
|
||||||
|
void initTimestamp();
|
||||||
public:
|
public:
|
||||||
typedef MapEntityById::const_iterator const_iterator;
|
typedef MapEntityById::const_iterator const_iterator;
|
||||||
IfcFile();
|
IfcFile();
|
||||||
@@ -273,6 +279,15 @@ public:
|
|||||||
unsigned int FreshId() { MaxId ++; return MaxId; }
|
unsigned int FreshId() { MaxId ++; return MaxId; }
|
||||||
void AddEntity(IfcUtil::IfcSchemaEntity e);
|
void AddEntity(IfcUtil::IfcSchemaEntity e);
|
||||||
void AddEntities(IfcEntities es);
|
void AddEntities(IfcEntities es);
|
||||||
|
|
||||||
|
void filename(const std::string& s);
|
||||||
|
std::string filename() const;
|
||||||
|
void timestamp(const std::string& s);
|
||||||
|
std::string timestamp() const;
|
||||||
|
void author(const std::string& name, const std::string& email, const std::string& organisation);
|
||||||
|
std::string authorName() const;
|
||||||
|
std::string authorEmail() const;
|
||||||
|
std::string authorOrganisation() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
double UnitPrefixToValue( Ifc2x3::IfcSIPrefix::IfcSIPrefix v );
|
double UnitPrefixToValue( Ifc2x3::IfcSIPrefix::IfcSIPrefix v );
|
||||||
|
|||||||
Reference in New Issue
Block a user