Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplified calculation of fly out distance and creation of constraints limited only...
[modules/shaper.git]
/
src
/
SketchPlugin
/
SketchPlugin_Sketch.cpp
diff --git
a/src/SketchPlugin/SketchPlugin_Sketch.cpp
b/src/SketchPlugin/SketchPlugin_Sketch.cpp
index 7b993c2161e0ad1d3daa39ea59f25188c5490430..2a5dd0944780f0c7e21decd6617dd180b335de41 100644
(file)
--- a/
src/SketchPlugin/SketchPlugin_Sketch.cpp
+++ b/
src/SketchPlugin/SketchPlugin_Sketch.cpp
@@
-19,6
+19,7
@@
#include <GeomAlgoAPI_PointBuilder.h>
#include <ModelAPI_AttributeRefList.h>
#include <GeomAlgoAPI_PointBuilder.h>
#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
@@
-56,6
+57,9
@@
void SketchPlugin_Sketch::initAttributes()
data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(
getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID());
data()->addAttribute(SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(
getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID());
+ data()->addAttribute(SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString::typeId());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(
+ getKind(), SketchPlugin_Sketch::SOLVER_ERROR());
}
void SketchPlugin_Sketch::execute()
}
void SketchPlugin_Sketch::execute()
@@
-73,7
+77,7
@@
void SketchPlugin_Sketch::execute()
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
std::list<ObjectPtr> aFeatures = aRefList->list();
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
std::list<ObjectPtr> aFeatures = aRefList->list();
- if (aFeatures.empty())
+ if (aFeatures.empty())
// actually, this must be avoided by the validators
return;
std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
return;
std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
@@
-109,8
+113,12
@@
void SketchPlugin_Sketch::execute()
}
}
}
}
- if (aFeaturesPreview.empty())
+ if (aFeaturesPreview.empty()) {
+ // no good features for generation of preview => erase result if exists
+ if (firstResult().get() && !firstResult()->isDisabled())
+ removeResults(0, false);
return;
return;
+ }
// Collect all edges as one big wire
std::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
// Collect all edges as one big wire
std::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
@@
-143,14
+151,6
@@
void SketchPlugin_Sketch::removeFeature(std::shared_ptr<ModelAPI_Feature> theFea
// to keep the persistent sub-elements indexing, do not remove elements from list,
// but substitute by nulls
reflist(SketchPlugin_Sketch::FEATURES_ID())->substitute(theFeature, ObjectPtr());
// to keep the persistent sub-elements indexing, do not remove elements from list,
// but substitute by nulls
reflist(SketchPlugin_Sketch::FEATURES_ID())->substitute(theFeature, ObjectPtr());
-
- std::map<int, std::shared_ptr<ModelAPI_Feature> >::iterator aSubIter = mySubs.begin();
- for(; aSubIter != mySubs.end(); aSubIter++) {
- if (aSubIter->second == theFeature) {
- mySubs.erase(aSubIter);
- break;
- }
- }
}
int SketchPlugin_Sketch::numberOfSubs(bool forTree) const
}
int SketchPlugin_Sketch::numberOfSubs(bool forTree) const
@@
-166,12
+166,8
@@
std::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::subFeature(
if (forTree)
return FeaturePtr();
if (forTree)
return FeaturePtr();
- if (mySubs.find(theIndex) != mySubs.end())
- return mySubs[theIndex];
-
ObjectPtr anObj = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->object(theIndex, false);
FeaturePtr aRes = std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
ObjectPtr anObj = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->object(theIndex, false);
FeaturePtr aRes = std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
- mySubs[theIndex] = aRes;
return aRes;
}
return aRes;
}