// 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"
#include <ModelGeomAlgo_Point2D.h>
#include <Events_Loop.h>
-#define DEBUG_SPLIT
+//#define DEBUG_SPLIT
#ifdef DEBUG_SPLIT
#include <iostream>
#endif
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;
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;
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));
// 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_
/** \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 \96 tangent constraint, for arc \96 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<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
- std::list<FeaturePtr> resultEdges; ///< list of result edges
- std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
- };*/
-
/// Split constraint kind
inline static const std::string& ID()
{
/// \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;
/// \param geom point 2D or NULL
std::shared_ptr<GeomDataAPI_Point2D> 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<ModelAPI_Feature> createFeature(
- // const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
- // const std::shared_ptr<GeomDataAPI_Point2D>& 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
/// \return string value
std::string getFeatureInfo(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const bool isUseAttributesInfo = true);
-
-private:
- //std::set<AttributePtr> myNewPoints; ///< set of new points
- //std::map<AttributePtr, FilletFeatures> 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