]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid the ""Conflicting constraints" message on constraint Mirror
authorazv <azv@opencascade.com>
Tue, 7 Jun 2016 11:14:12 +0000 (14:14 +0300)
committerazv <azv@opencascade.com>
Tue, 7 Jun 2016 15:53:02 +0000 (18:53 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp
src/SketchSolver/SketchSolver_ConstraintMirror.cpp

index 027d57a0ad12afdf53a3c6d17b43c32317076651..0213cceaa76bf3ed1534564c16104362afd3c18a 100644 (file)
@@ -1197,6 +1197,7 @@ void adjustMirror(ConstraintWrapperPtr theConstraint)
       aMirrorLine = *anIt;
   }
 
-  makeMirrorPoints(aPoints[0], aPoints[1], aMirrorLine);
+  if (aPoints.size() == 2)
+    makeMirrorPoints(aPoints[0], aPoints[1], aMirrorLine);
 }
 
index 4238120082f85a4d7efb4e646f40bb1b69f17070..aa011cc4f6181db19a70eb832f9f0c7a6c83c8e4 100644 (file)
@@ -387,7 +387,8 @@ void PlaneGCSSolver_Storage::processArc(const EntityWrapperPtr& theArc)
   double* aEndAngle   = std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(*aSubIt++)->scalar();
   double* aRadius     = std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(*aSubIt)->scalar();
 
-  FeaturePtr anArcFeature = theArc->baseFeature();
+  std::shared_ptr<SketchPlugin_Feature> anArcFeature =
+      std::dynamic_pointer_cast<SketchPlugin_Feature>(theArc->baseFeature());
   std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       anArcFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
   std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
@@ -409,6 +410,9 @@ void PlaneGCSSolver_Storage::processArc(const EntityWrapperPtr& theArc)
     return;
   anArcEdge->getRange(*aStartAngle, *aEndAngle);
 
+  // do not constraint copied arc
+  if (anArcFeature->isCopy())
+    return;
   // No need to add constraints if they are already exist
   std::map<EntityWrapperPtr, std::vector<GCSConstraintPtr> >::const_iterator
       aFound = myArcConstraintMap.find(theArc);
index 4173be33b95136b36085828c58ac1c1a0ea4c583..db638723787883b1753c310ae966928b86475a4a 100644 (file)
@@ -88,23 +88,6 @@ void SketchSolver_ConstraintMirror::process()
   std::vector<EntityWrapperPtr>::iterator aBIt = aBaseList.begin();
   std::vector<EntityWrapperPtr>::iterator aMIt = aMirrorList.begin();
   for (; aBIt != aBaseList.end(); ++aBIt, ++aMIt) {
-    if ((*aBIt)->type() == ENTITY_ARC) {
-      // add new points on arcs and mirror them
-      EntityWrapperPtr aBasePnt = myStorage->calculateMiddlePoint(*aBIt, 0.5);
-      EntityWrapperPtr aMirrPnt = myStorage->calculateMiddlePoint(*aMIt, 0.5);
-      // point on base arc
-      aNewConstraints = aBuilder->createConstraint(myBaseConstraint, myGroupID, mySketchID,
-          CONSTRAINT_PT_ON_CIRCLE, 0.0, aBasePnt, EntityWrapperPtr(), *aBIt);
-      aMirConstrList.insert(aMirConstrList.end(), aNewConstraints.begin(), aNewConstraints.end());
-      // point on mirrored arc
-      aNewConstraints = aBuilder->createConstraint(myBaseConstraint, myGroupID, mySketchID,
-          CONSTRAINT_PT_ON_CIRCLE, 0.0, aMirrPnt, EntityWrapperPtr(), *aMIt);
-      aMirConstrList.insert(aMirConstrList.end(), aNewConstraints.begin(), aNewConstraints.end());
-      // mirror these points
-      aNewConstraints = aBuilder->createConstraint(myBaseConstraint, myGroupID, mySketchID,
-          aConstrType, 0.0, aBasePnt, aMirrPnt, aMirrorLine);
-      aMirConstrList.insert(aMirConstrList.end(), aNewConstraints.begin(), aNewConstraints.end());
-    }
     aNewConstraints = aBuilder->createConstraint(
         myBaseConstraint, myGroupID, mySketchID, aConstrType,
         0.0, *aBIt, *aMIt, aMirrorLine);
@@ -115,6 +98,8 @@ void SketchSolver_ConstraintMirror::process()
   for (aMIt = aMirrorList.begin(); aMIt != aMirrorList.end(); ++aMIt)
     myStorage->update((*aMIt)->baseFeature(), myGroupID);
   myStorage->addConstraint(myBaseConstraint, aMirConstrList);
+
+  adjustConstraint();
 }