]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
PlaneGCS: Sketch is moved when moving arc, attached to it by center.
authorazv <azv@opencascade.com>
Mon, 19 Dec 2016 11:43:22 +0000 (14:43 +0300)
committerazv <azv@opencascade.com>
Mon, 19 Dec 2016 11:54:17 +0000 (14:54 +0300)
Change algorithm of calculation of arc characteristics (start and end angles), because reversed arcs had invalid values.

src/SketchPlugin/Test/TestConstraintMirror.py
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp

index 16ab8201cce8de8c6021862fb9fedbe0997d93fe..3f5ae69248744e5d9bac51e85bfac47c1119a748 100644 (file)
@@ -161,8 +161,8 @@ aMirror = aSketchFeature.addFeature("SketchConstraintMirror")
 aRefObjectA = aMirror.refattr("ConstraintEntityA")
 aRefObjectA.setObject(modelAPI_ResultConstruction(aMirrorLine.firstResult()))
 aRefListInitial = aMirror.reflist("ConstraintMirrorList")
-aRefListInitial.append(aSketchArc1.lastResult())
 aRefListInitial.append(aSketchLine1.lastResult())
+aRefListInitial.append(aSketchArc1.lastResult())
 aRefListInitial.append(aSketchLine2.lastResult())
 aMirror.execute()
 aSession.finishOperation()
index b26213dcc8c703cef60ecf79ea2a4e8dc02b21fb..6c8527ada14493693e3a070a458139ef0c77da37 100644 (file)
@@ -414,22 +414,13 @@ void PlaneGCSSolver_Storage::processArc(const EntityWrapperPtr& theArc)
   *aRadius = aCenterPnt->distance(aStartPnt);
   if (!anArcFeature->lastResult())
     return;
-  std::shared_ptr<GeomAPI_Edge> anArcEdge =
-      std::dynamic_pointer_cast<GeomAPI_Edge>(anArcFeature->lastResult()->shape());
-  if (!anArcEdge)
-    return;
-  anArcEdge->getRange(*aStartAngle, *aEndAngle);
-  // verify the range is correct and not shifted to an angle
-  std::shared_ptr<GeomAPI_Dir2d> aDir(new GeomAPI_Dir2d(cos(*aStartAngle), sin(*aStartAngle)));
-  std::shared_ptr<GeomAPI_Pnt2d> aCalcStartPnt(
-      new GeomAPI_Pnt2d(aCenterPnt->xy()->added(aDir->xy()->multiplied(*aRadius))));
-  if (aCalcStartPnt->distance(aStartPnt) > tolerance) {
-    std::shared_ptr<GeomAPI_Dir2d> aDirToStart(
-        new GeomAPI_Dir2d(aStartPnt->xy()->decreased(aCenterPnt->xy())));
-    double anAngle = aDir->angle(aDirToStart);
-    *aStartAngle += anAngle;
-    *aEndAngle += anAngle;
-  }
+  static std::shared_ptr<GeomAPI_Dir2d> OX(new GeomAPI_Dir2d(1.0, 0.0));
+  std::shared_ptr<GeomAPI_Dir2d> aDir(new GeomAPI_Dir2d(
+      aStartPnt->xy()->decreased(aCenterPnt->xy())));
+  *aStartAngle = OX->angle(aDir);
+  aDir = std::shared_ptr<GeomAPI_Dir2d>(new GeomAPI_Dir2d(
+      aEndPnt->xy()->decreased(aCenterPnt->xy())));
+  *aEndAngle = OX->angle(aDir);
 
   // no need to constraint a fixed or a copied arc
   if (theArc->group() == GID_OUTOFGROUP || anArcFeature->isCopy())