Manual changes to improve isDerivedFrom usage

This commit is contained in:
Benjamin Nauck
2025-01-16 23:37:04 +01:00
parent d3fa11a77c
commit 45c997f40a
12 changed files with 43 additions and 97 deletions

View File

@@ -73,14 +73,8 @@ TopoDS_Shape SketchExportHelper::projectShape(const TopoDS_Shape& inShape,
//! true if obj is a sketch
bool SketchExportHelper::isSketch(App::DocumentObject* obj)
{
// TODO:: the check for an object being a sketch should be done as in the commented
// if statement below. To do this, we need to include Mod/Sketcher/SketchObject.h,
// but that makes Import dependent on Eigen libraries which we don't use. As a
// workaround we will inspect the object's class name.
// if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
std::string objTypeName = obj->getTypeId().getName();
std::string sketcherToken("Sketcher");
return objTypeName.find(sketcherToken) != std::string::npos;
// Use name to lookup to avoid dependency on Sketcher module
return obj->isDerivedFrom(Base::Type::fromName("Sketcher::SketchObject"));
}