Improve error messages for invalid shapes
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
# include <QFileInfo>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Base/Exception.h>
|
||||
@@ -158,7 +159,14 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
|
||||
|
||||
App::DocumentObject* baseObj = BaseView.getValue();
|
||||
if (!baseObj) {
|
||||
Base::Console().Log("INFO - DVD::execute - No BaseView - creation?\n");
|
||||
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
|
||||
if (isRestoring) {
|
||||
Base::Console().Warning("DVD::execute - No BaseView (but document is restoring) - %s\n",
|
||||
getNameInDocument());
|
||||
} else {
|
||||
Base::Console().Error("Error: DVD::execute - No BaseView(s) linked. - %s\n",
|
||||
getNameInDocument());
|
||||
}
|
||||
return DrawView::execute();
|
||||
}
|
||||
|
||||
@@ -189,6 +197,14 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
|
||||
}
|
||||
|
||||
if (shape.IsNull()) {
|
||||
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
|
||||
if (isRestoring) {
|
||||
Base::Console().Warning("DVD::execute - source shape is invalid - (but document is restoring) - %s\n",
|
||||
getNameInDocument());
|
||||
} else {
|
||||
Base::Console().Error("Error: DVD::execute - Source shape is Null. - %s\n",
|
||||
getNameInDocument());
|
||||
}
|
||||
return new App::DocumentObjectExecReturn("DVD - Linked shape object is invalid");
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -136,6 +136,7 @@ public:
|
||||
const bool flip=true) const;
|
||||
|
||||
virtual short mustExecute() const;
|
||||
/* virtual void onDocumentRestored() override;*/
|
||||
|
||||
bool handleFaces(void);
|
||||
bool showSectionEdges(void);
|
||||
@@ -184,6 +185,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool nowUnsetting;
|
||||
/* bool m_restoreComplete;*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -204,7 +204,14 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
|
||||
}
|
||||
|
||||
if (baseShape.IsNull()) {
|
||||
Base::Console().Log("DVS::execute - baseShape is Null\n");
|
||||
bool isRestoring = getDocument()->testStatus(App::Document::Status::Restoring);
|
||||
if (isRestoring) {
|
||||
Base::Console().Warning("DVS::execute - base shape is invalid - (but document is restoring) - %s\n",
|
||||
getNameInDocument());
|
||||
} else {
|
||||
Base::Console().Error("Error: DVS::execute - base shape is Null. - %s\n",
|
||||
getNameInDocument());
|
||||
}
|
||||
return new App::DocumentObjectExecReturn("BaseView Source object is Null");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user