Improve error messages for invalid shapes

This commit is contained in:
wandererfan
2019-04-01 09:08:04 -04:00
committed by WandererFan
parent 8f8473a212
commit 175966a6f7
4 changed files with 58 additions and 7 deletions

View File

@@ -162,7 +162,14 @@ TopoDS_Shape DrawViewPart::getSourceShape(void) const
TopoDS_Shape result;
const std::vector<App::DocumentObject*>& links = Source.getValues();
if (links.empty()) {
Base::Console().Log("DVP::getSourceShape - No Sources - creation? - %s\n",getNameInDocument());
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
if (isRestoring) {
Base::Console().Warning("DVP::getSourceShape - No Sources (but document is restoring) - %s\n",
getNameInDocument());
} else {
Base::Console().Error("Error: DVP::getSourceShape - No Source(s) linked. - %s\n",
getNameInDocument());
}
} else {
std::vector<TopoDS_Shape> sourceShapes;
for (auto& l:links) {
@@ -237,20 +244,34 @@ TopoDS_Shape DrawViewPart::getSourceShapeFused(void) const
App::DocumentObjectExecReturn *DrawViewPart::execute(void)
{
// Base::Console().Message("DVP::execute() - %s\n",getNameInDocument());
if (!keepUpdated()) {
return App::DocumentObject::StdReturn;
}
const std::vector<App::DocumentObject*>& links = Source.getValues();
if (links.empty()) {
Base::Console().Log("DVP::execute - %s - No Sources - creation time?\n",getNameInDocument());
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
if (isRestoring) {
Base::Console().Warning("DVP::execute - No Sources (but document is restoring) - %s\n",
getNameInDocument());
} else {
Base::Console().Error("Error: DVP::execute - No Source(s) linked. - %s\n",
getNameInDocument());
}
return App::DocumentObject::StdReturn;
}
TopoDS_Shape shape = getSourceShape(); //if shape is null, it is probably obj creation time.
TopoDS_Shape shape = getSourceShape(); //if shape is null, it is probably(?) obj creation time.
if (shape.IsNull()) {
Base::Console().Log("DVP::execute - %s - source shape is invalid - creation time?\n",
getNameInDocument());
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
if (isRestoring) {
Base::Console().Warning("DVP::execute - source shape is invalid - (but document is restoring) - %s\n",
getNameInDocument());
} else {
Base::Console().Error("Error: DVP::execute - Source shape is Null. - %s\n",
getNameInDocument());
}
return App::DocumentObject::StdReturn;
}
@@ -332,6 +353,11 @@ void DrawViewPart::onChanged(const App::Property* prop)
//TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.
}
//void DrawViewPart::onDocumentRestored()
//{
// m_restoreComplete = true;
//}
//note: slightly different than routine with same name in DrawProjectSplit
TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Ax2 viewAxis)
{