From 4d7ef21791ea60a98bde3374b576e7a19d017762 Mon Sep 17 00:00:00 2001 From: "mhochsteger@cerbsim.com" Date: Wed, 10 Nov 2021 18:16:25 +0100 Subject: [PATCH] proper DoArchive for OCCGeometry --- libsrc/occ/occgeom.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 2ca0c746..c70019a2 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1659,26 +1659,28 @@ namespace netgen if(ar.Output()) { std::stringstream ss; - STEPControl_Writer writer; - writer.Transfer(shape, STEPControl_AsIs); - auto filename = GetTempFilename(); - writer.Write(filename.c_str()); - std::ifstream is(filename.c_str()); - ss << is.rdbuf(); + BRepTools::Write(shape, ss); ar << ss.str(); - std::remove(filename.c_str()); } else { std::string str; ar & str; + stringstream ss(str); + BRep_Builder builder; + BRepTools::Read(shape, ss, builder); + } - auto filename = GetTempFilename(); - auto tmpfile = std::fopen(filename.c_str(), "w"); - std::fputs(str.c_str(), tmpfile); - std::fclose(tmpfile); - LoadOCCInto(this, filename.c_str()); - std::remove(filename.c_str()); + ar & occdim; + for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE }) + for (TopExp_Explorer e(shape, typ); e.More(); e.Next()) + ar & global_shape_properties[e.Current().TShape()]; + + if(ar.Input()) + { + changed = 1; + BuildFMap(); + CalcBoundingBox(); } }