diff --git a/src/Mod/Import/App/CMakeLists.txt b/src/Mod/Import/App/CMakeLists.txt index b9e1f9cf77..9e5531a939 100644 --- a/src/Mod/Import/App/CMakeLists.txt +++ b/src/Mod/Import/App/CMakeLists.txt @@ -1,5 +1,6 @@ set(Import_LIBS Part + PartDesign ${OCC_OCAF_LIBRARIES} ${OCC_OCAF_DEBUG_LIBRARIES} ) diff --git a/src/Mod/Import/App/ExportOCAF.cpp b/src/Mod/Import/App/ExportOCAF.cpp index b48ef161c3..4c9c57fcd0 100644 --- a/src/Mod/Import/App/ExportOCAF.cpp +++ b/src/Mod/Import/App/ExportOCAF.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "ExportOCAF.h" #include "Tools.h" @@ -172,6 +173,14 @@ int ExportOCAF::exportObject(App::DocumentObject* obj, return_label = root_id; } + if (obj->isDerivedFrom(PartDesign::Body::getClassTypeId())) { + PartDesign::Body* body = static_cast(obj); + App::DocumentObject* tip = body->Tip.getValue(); + if (tip && tip->isDerivedFrom()) { + // use the tip instead of the body for export + obj = tip; + } + } if (obj->isDerivedFrom()) { Part::Feature* part = static_cast(obj); diff --git a/src/Mod/Import/App/ExportOCAF2.cpp b/src/Mod/Import/App/ExportOCAF2.cpp index ea8ce61dd6..1ac693f8e5 100644 --- a/src/Mod/Import/App/ExportOCAF2.cpp +++ b/src/Mod/Import/App/ExportOCAF2.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include "ExportOCAF2.h" @@ -392,6 +393,16 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj, return {}; } + if (obj->isDerivedFrom(PartDesign::Body::getClassTypeId())) { + PartDesign::Body* body = static_cast(obj); + App::DocumentObject* tip = body->Tip.getValue(); + if (tip) { + // keep the shape from the body, but use the tip's colors + // by replacing obj with tip + obj = tip; + } + } + // sub may contain more than one hierarchy, e.g. Assembly container may use // getSubObjects to skip some hierarchy containing constraints and stuff // when exporting. We search for extra '.', and set it as prefix if found.