(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ /// check external line created on Trihedron Axis
+ /// selection of a point on external edge referenced to AIS_Trihedron axis
+ /// should be prohibited or point should be replaced to "Origin". The second
+ /// case is implemented because of not correct AIS_Trihedron origin point highlight
+ /// When AIS is corrected(exactly priority of origin and stayed vertex by highlight)
+ /// the next check should be moved to Partset 2d point widget in isValidSelectionCustom
+ bool isAxis = isAxisSelected(theObject);
+ if (isAxis)
+ aRes = ResultPtr(); // to rely on code below that found the Origin result
+
// if there is no object,
// it means that this is the origin point: search it in the module document
if (!aRes.get()) {
return ResultPtr();
}
+bool PartSet_Tools::isAxisSelected(const ObjectPtr& theObject)
+{
+ bool isAxis = false;
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aRes.get()) {
+ // check if result belongs to external feature
+ // in this case we should use as a result reference of external feature
+ FeaturePtr aResFeature = ModelAPI_Feature::feature(aRes);
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aResFeature);
+ if (aSPFeature.get() && aSPFeature->isExternal()) {
+ AttributeSelectionPtr aAttr = aResFeature->selection(
+ SketchPlugin_SketchEntity::EXTERNAL_ID());
+ if (aAttr) { /// check if the result is Axis
+ ResultPtr anExternalRes = std::dynamic_pointer_cast<ModelAPI_Result>(aAttr->context());
+ FeaturePtr aResFeature = ModelAPI_Feature::feature(anExternalRes);
+ isAxis = aResFeature->getKind() == "Axis"; //ConstructionPlugin_Axis::ID()
+ }
+ }
+ }
+ return isAxis;
+}
+
bool PartSet_Tools::isContainPresentation(const QList<ModuleBase_ViewerPrsPtr>& theSelected,
const ModuleBase_ViewerPrsPtr& thePrs)
{
CompositeFeaturePtr theSketch,
const bool theTemporary = false);
- /// Checks whether the list of selected presentations contains the given one
+
+ /// Checks if the shape is Origin, the conditions are the shape is a vertex and
+ /// selected feature is an external feature created on Axis
+ /// \param theObject a selected object in the viewer
+ /// \return boolean value
+ static bool isAxisSelected(const ObjectPtr& theObject);
+
+ /// Checks whether the list of selected presentations contains the given one
/// \param theSelected a list of presentations
/// \param thePrs a presentation to be found
/// \return - result of check, true if the list contains the prs