aleuly / ifcplusplus

Automatically exported from code.google.com/p/ifcplusplus
Other
0 stars 0 forks source link

remove entity and write ifc errors #39

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Removing entity (IfcProduct) does not remove references to it (and probably its 
childs).

Steps that will reproduce the problem:

1. Load an IFC model
2. Use "IfcPPModel::removeEntity" and remove one element of type ifcproduct 
(e.g. wall)
3. Write IFC to file

There also are missing keywords: "ISO-10303-21;" "HEADER;" and "ENDSEC" in 
saved IFC files.

I download latest version and compile "IfcPlusPlus" and 
"SimpleLoadingModelExample" with Visual Studio 2013 (installed boost from 
nuget).

code:

//...

shared_ptr<IfcPPModel> ifc_model( new IfcPPModel() );
shared_ptr<IfcPPReaderSTEP> reader( new IfcPPReaderSTEP() );

reader->loadModelFromFile( file_path, ifc_model );

ifc_model->removeEntity(69835);

shared_ptr<IfcPPWriter> writer(new IfcPPWriterSTEP());

std::stringstream   ss;

writer->writeModelToStream(ss, ifc_model);
std::ofstream os("test.ifc");   
os << ss.rdbuf();

//...

Original issue reported on code.google.com by g.w...@datacomp.com.pl on 7 Apr 2015 at 8:59

GoogleCodeExporter commented 9 years ago
When writing a file, 
ifc_model->initFileHeader( file_path.toStdString().c_str() );
needs to be called.

If you have suggestions how to improve IfcPPModel::removeEntity, please let me 
know :)

Original comment by fabian.g...@gmail.com on 7 Apr 2015 at 10:45