From: nds Date: Wed, 30 Nov 2016 09:00:05 +0000 (+0300) Subject: #1787 Dump NameError: name 'SketchLine_15' is not defined X-Git-Tag: V_2.6.0~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a2a8604fa34248ef11cada4642e0260d8f00808;p=modules%2Fshaper.git #1787 Dump NameError: name 'SketchLine_15' is not defined --- diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index ba73f12ae..53c1dc13f 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -563,6 +563,16 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = std::dynamic_pointer_cast(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()) { @@ -618,6 +628,29 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap return ResultPtr(); } +bool PartSet_Tools::isAxisSelected(const ObjectPtr& theObject) +{ + bool isAxis = false; + ResultPtr aRes = std::dynamic_pointer_cast(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 aSPFeature = + std::dynamic_pointer_cast(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(aAttr->context()); + FeaturePtr aResFeature = ModelAPI_Feature::feature(anExternalRes); + isAxis = aResFeature->getKind() == "Axis"; //ConstructionPlugin_Axis::ID() + } + } + } + return isAxis; +} + bool PartSet_Tools::isContainPresentation(const QList& theSelected, const ModuleBase_ViewerPrsPtr& thePrs) { diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 7826014e1..10699dd27 100755 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -180,7 +180,14 @@ public: 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