anArcCentr.setValue(aCenterCoords, aCenterCoords/2) # move center
aSession.finishOperation()
assert aSketchArc.boolean("InversedArc").value() == anInversed
+#=========================================================================
+# Test that movement of start point of arc does not change central point
+#=========================================================================
+TOL = 1.e-5
+x = anArcCentr.x()
+y = anArcCentr.y()
+sx = anArcStartPoint.x()
+sy = anArcStartPoint.y()
+for aDelta in range(0, 20):
+ aSession.startOperation()
+ anArcStartPoint.setValue(sx, sy+aDelta) # move start point
+ aSession.finishOperation()
+ assert math.fabs(anArcCentr.x() - x) < TOL
+ assert math.fabs(anArcCentr.y() - y) < TOL
+for aDelta in range(20, -1, -1):
+ aSession.startOperation()
+ anArcStartPoint.setValue(sx, sy+aDelta) # move start point
+ aSession.finishOperation()
+ assert math.fabs(anArcCentr.x() - x) < TOL
+ assert math.fabs(anArcCentr.y() - y) < TOL
+#=========================================================================
+# Test that movement of end point of arc does not change central point
+#=========================================================================
+x = anArcCentr.x()
+y = anArcCentr.y()
+sx = anArcEndPoint.x()
+sy = anArcEndPoint.y()
+for aDelta in range(0, 20):
+ aSession.startOperation()
+ anArcEndPoint.setValue(sx+aDelta, sy) # move end point
+ aSession.finishOperation()
+ assert math.fabs(anArcCentr.x() - x) < TOL
+ assert math.fabs(anArcCentr.y() - y) < TOL
+for aDelta in range(20, -1, -1):
+ aSession.startOperation()
+ anArcEndPoint.setValue(sx+aDelta, sy) # move end point
+ aSession.finishOperation()
+ assert math.fabs(anArcCentr.x() - x) < TOL
+ assert math.fabs(anArcCentr.y() - y) < TOL
// Calculate additional parameters necessary for PlaneGCS
const std::list<EntityWrapperPtr>& aSubs = theArc->subEntities();
std::list<EntityWrapperPtr>::const_iterator aSubIt = aSubs.begin();
- while ((*aSubIt)->type() == ENTITY_POINT) // search scalar entities
+ bool isFixed[3] = {false, false, false};
+ for (int i = 0; (*aSubIt)->type() == ENTITY_POINT; ++i) { // search scalar entities
+ isFixed[i] = (*aSubIt)->group() == GID_OUTOFGROUP;
++aSubIt;
+ }
double* aStartAngle =
std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(*aSubIt++)->scalar();
double* aEndAngle =
std::shared_ptr<GeomAPI_Pnt2d> aStartPnt = aStartAttr->pnt();
std::shared_ptr<GeomAPI_Pnt2d> aEndPnt = aEndAttr->pnt();
- *aRadius = aCenterPnt->distance(aStartPnt);
+ if (isFixed[2] && !isFixed[1])
+ *aRadius = aCenterPnt->distance(aEndPnt);
+ else
+ *aRadius = aCenterPnt->distance(aStartPnt);
if (!anArcFeature->lastResult())
return;
static std::shared_ptr<GeomAPI_Dir2d> OX(new GeomAPI_Dir2d(1.0, 0.0));
// No need to add constraints if they are already exist
std::map<EntityWrapperPtr, std::vector<GCSConstraintPtr> >::const_iterator
aFound = myArcConstraintMap.find(theArc);
- if (aFound != myArcConstraintMap.end())
- return;
+// if (aFound != myArcConstraintMap.end())
+// return;
// Prepare additional constraints to produce the arc
std::vector<GCSConstraintPtr> anArcConstraints;