proper DoArchive for OCCGeometry

This commit is contained in:
mhochsteger@cerbsim.com 2021-11-10 18:16:25 +01:00
parent b63baa57be
commit 4d7ef21791

View File

@ -1659,26 +1659,28 @@ namespace netgen
if(ar.Output()) if(ar.Output())
{ {
std::stringstream ss; std::stringstream ss;
STEPControl_Writer writer; BRepTools::Write(shape, ss);
writer.Transfer(shape, STEPControl_AsIs);
auto filename = GetTempFilename();
writer.Write(filename.c_str());
std::ifstream is(filename.c_str());
ss << is.rdbuf();
ar << ss.str(); ar << ss.str();
std::remove(filename.c_str());
} }
else else
{ {
std::string str; std::string str;
ar & str; ar & str;
stringstream ss(str);
BRep_Builder builder;
BRepTools::Read(shape, ss, builder);
}
auto filename = GetTempFilename(); ar & occdim;
auto tmpfile = std::fopen(filename.c_str(), "w"); for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
std::fputs(str.c_str(), tmpfile); for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
std::fclose(tmpfile); ar & global_shape_properties[e.Current().TShape()];
LoadOCCInto(this, filename.c_str());
std::remove(filename.c_str()); if(ar.Input())
{
changed = 1;
BuildFMap();
CalcBoundingBox();
} }
} }