Salome HOME
Minor updates in SketchSolver plugin
[modules/shaper.git] / src / SketchSolver / SolveSpaceSolver / SolveSpaceSolver_Builder.cpp
index eabf9f6ae0c25d86a33407b2ec22c2961282802f..5e1b85015d27534de5c319239072282ecb0fbfba 100644 (file)
@@ -231,8 +231,7 @@ std::list<ConstraintWrapperPtr> SolveSpaceSolver_Builder::createMirror(
     std::list<EntityWrapperPtr>::const_iterator anIt1 = theEntity1->subEntities().begin();
     std::list<EntityWrapperPtr>::const_iterator anIt2 = theEntity2->subEntities().begin();
     if ((*anIt2)->group() == theGroupID) // mirrored point is not fixed
-      makeMirrorPoints(theEntity1->subEntities().front(),
-          theEntity2->subEntities().front(), theMirrorLine);
+      makeMirrorPoints(*anIt1, *anIt2, theMirrorLine);
 
     // Workaround to avoid problems in SolveSpace.
     // The symmetry of two arcs will be done using symmetry of three points on these arcs:
@@ -313,9 +312,7 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature(
 
     const Slvs_Entity& aSubEnt =
         std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(aSub)->entity();
-    EntityWrapperPtr aNewEntity(new SolveSpaceSolver_EntityWrapper(theFeature, aSubEnt));
-    aNewEntity->setSubEntities(std::list<EntityWrapperPtr>(1, aSub));
-    return aNewEntity;
+    return EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt));
   }
 
   // wrong entity
@@ -839,6 +836,13 @@ void adjustMultiTranslation(ConstraintWrapperPtr theConstraint)
   std::shared_ptr<GeomAPI_Pnt2d> aEndPnt = aBuilder->point(*aSIt++);
   std::shared_ptr<GeomAPI_XY> aDelta = aEndPnt->xy()->decreased(aStartPnt->xy());
 
+  bool isFullValue = theConstraint->isFullValue();
+  int aNbObjects = aSubs.size()-3;
+  if (isFullValue && aNbObjects > 0) {
+    aDelta->setX(aDelta->x()/aNbObjects);
+    aDelta->setY(aDelta->y()/aNbObjects);
+  }
+
   std::list<EntityWrapperPtr>::const_iterator aPrevIt = aSIt++;
   for (; aSIt != aSubs.end(); ++aPrevIt, ++aSIt)
     translate(*aPrevIt, *aSIt, aDelta);