From 33baff7f12f3bbd64fd08dbbac50f256e7e5eb6b Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 25 Aug 2016 11:07:38 +0300 Subject: [PATCH] Issue #1664 In the Sketcher, add the function Split a segment - comment. --- .../SketchPlugin_ConstraintSplit.cpp | 17 ++---- .../SketchPlugin_ConstraintSplit.h | 53 +++++++++---------- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp index bab340c85..8bbdb36e8 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> // File: SketchPlugin_ConstraintSplit.cpp -// Created: 17 Jul 2016 +// Created: 25 Aug 2016 // Author: Natalia ERMOLAEVA #include "SketchPlugin_ConstraintSplit.h" @@ -35,7 +35,7 @@ #include #include -#define DEBUG_SPLIT +//#define DEBUG_SPLIT #ifdef DEBUG_SPLIT #include #endif @@ -149,9 +149,6 @@ void SketchPlugin_ConstraintSplit::execute() std::cout << " -Point attribute:" << ModelGeomAlgo_Point2D::getPointAttributeInfo(aPointAttr) << std::endl; } } -#endif - -#ifdef DEBUG_SPLIT std::cout << std::endl; std::cout << "---- SPLIT ----" << std::endl; std::cout << std::endl; @@ -799,13 +796,9 @@ FeaturePtr SketchPlugin_ConstraintSplit::createLineFeature(const FeaturePtr& the return aFeature; aFeature = aSketch->addFeature(SketchPlugin_Line::ID()); - // update fillet arc: make the arc correct for sure, so, it is not needed to process the "attribute updated" - // by arc; moreover, it may cause cyclicity in hte mechanism of updater - aFeature->data()->blockSendAttributeUpdated(true); fillAttribute(aFeature->attribute(SketchPlugin_Line::START_ID()), theFirstPointAttr); fillAttribute(aFeature->attribute(SketchPlugin_Line::END_ID()), theSecondPointAttr); - aFeature->data()->blockSendAttributeUpdated(false); aFeature->execute(); // to obtain result return aFeature; @@ -925,11 +918,9 @@ std::string SketchPlugin_ConstraintSplit::getFeatureInfo( return "none"; } - //anInfo.append(theFeature->getKind().c_str()); - if (theFeature->data()->isValid()) { - //anInfo.append(", name="); + if (theFeature->data()->isValid()) anInfo.append(theFeature->data()->name().c_str()); - } + if (isUseAttributesInfo) { std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature, getEdgeAttributes(theFeature)); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintSplit.h b/src/SketchPlugin/SketchPlugin_ConstraintSplit.h index d06c7d548..4c1e2bfea 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintSplit.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintSplit.h @@ -1,8 +1,8 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> // File: SketchPlugin_ConstraintSplit.h -// Created: 19 Mar 2015 -// Author: Artem ZHIDKOV +// Created: 25 Aug 2016 +// Author: Natalia ERMOLAEVA #ifndef SketchPlugin_ConstraintSplit_H_ #define SketchPlugin_ConstraintSplit_H_ @@ -19,24 +19,37 @@ typedef std::pair > IdToPointP /** \class SketchPlugin_ConstraintSplit * \ingroup Plugins - * \brief Feature for creation of a new constraint filleting two objects which have coincident point + * \brief Feature for creation of a new constraint splitting object. Entities for split: + * - Linear segment by point(s) on this line + * - Arc by point(s) on this arc + * - Circle by at least 2 split-points on this circle + * + * The following constraints will be applied after split to keep the divided segments geometry: + * - Coincident constraints for both parts of created segments in the point of splitting + * - For linear segments parallel, for circles – tangent constraint, for arc – tangent and equal + * constraints. In case of three segments in result two couple of constraints are created + * - parallel and equal constraints: the first is between 1st and middle entity, the second is + * between 1st and 3rd. + * - tangency constraints: the first between 1st and 2nd, the second between 2nd and 3rd. + * - Constraints assigned to the feature before split operation are assigned after using rules: + * - Coincident constraints are assigned to the segment where they belong to. Segment of split + * has only a coincidence to the neighbor segment. All constraints used in the splitting of + * this segment are moved to point of neighbor segment. If constraint was initially built + * to the point of splitting segment, it stays for this point. + * - Geometrical and dimensional constraints are assigned to one of result segment, not the + * selected for split. In case of 3 result segments, this will be the segment nearest to the + * start point of arc/line. + * - Replication constraint used split feature will be deleted in the same way as it is deleted + * by any of entity delete in sketch which is used in this constraint. * * This constraint has three attributes: * SketchPlugin_Constraint::VALUE() contains reference object to be splitted * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() for the points of split; * - * Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C() - * which contains created list objects forming the fillet */ class SketchPlugin_ConstraintSplit : public SketchPlugin_ConstraintBase { public: - /*struct FilletFeatures { - std::list> baseEdgesState; ///< list of objects the fillet is based and its states - std::list resultEdges; ///< list of result edges - std::list resultConstraints; ///< list of constraints provided by the fillet - };*/ - /// Split constraint kind inline static const std::string& ID() { @@ -56,9 +69,6 @@ class SketchPlugin_ConstraintSplit : public SketchPlugin_ConstraintBase /// \brief Request for initialization of data model of the feature: adding all attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); - /// Returns the AIS preview - //SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true SKETCHPLUGIN_EXPORT virtual bool isMacro() const; @@ -88,13 +98,6 @@ private: /// \param geom point 2D or NULL std::shared_ptr getPointOfRefAttr(const AttributePtr& theAttribute); - /// Creates a new feature in the base shape type with bounding points given in parameters - /// \param theStartPointAttr an attribute of the start point - /// \param theEndPointAttr an attribute of the end point - //std::shared_ptr createFeature( - // const std::shared_ptr& theStartPointAttr, - // const std::shared_ptr& theEndPointAttr); - /// Obtains those constraints of the feature that should be modified. output maps contain /// point of coincidence and attribute id to be modified after split /// \param theFeaturesToDelete [out] constrains that will be deleted after split @@ -225,14 +228,6 @@ private: /// \return string value std::string getFeatureInfo(const std::shared_ptr& theFeature, const bool isUseAttributesInfo = true); - -private: - //std::set myNewPoints; ///< set of new points - //std::map myPointFeaturesMap; ///< map of point and features for fillet - //bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code - //bool myRadiusChangedByUser; ///< flag to track that radius changed by user - //bool myRadiusChangedInCode; ///< flag to track that radius changed in code - //bool myRadiusInitialized; /// < flag to track that radius initialized }; #endif -- 2.39.2