]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
fast fix for creating circle point
authorasozinov <alexey.sozinov@opencascade.com>
Thu, 2 Nov 2023 10:21:07 +0000 (10:21 +0000)
committerasozinov <alexey.sozinov@opencascade.com>
Thu, 2 Nov 2023 10:21:07 +0000 (10:21 +0000)
src/SketchAPI/SketchAPI_Circle.cpp
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_MacroCircle.cpp
src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py
src/SketchPlugin/Test/TestCreateCircleByThreePoints.py

index 95d48f39706716786722bdf624af1ded13d85140..6a9316086f6213ca9f392d1ea7f643f8762480e8 100644 (file)
@@ -133,19 +133,10 @@ void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY
   fillAttribute(theRadius, myradius);
   fillAttribute(theAngle, myangle);
 
-  bool isNeedPoint =
-    feature()->integer(SketchPlugin_Circle::VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0;
-  if (isNeedPoint)
-  {
-    fillAttribute(theAngle, angle());
+  fillAttribute(theAngle, angle());
 
-    execute();
-    createPoint();
-  }
-  else
-  {
-    execute();
-  }
+  execute();
+  createPoint();
 }
 
 //==================================================================================================
@@ -154,21 +145,10 @@ void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>
 {
   fillAttribute(theCenter, mycenter);
   fillAttribute(theRadius, myradius);
+  fillAttribute(theAngle, angle());
 
-  bool isNeedPoint =
-    feature()->integer(SketchPlugin_Circle::VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0;
-
-  if (isNeedPoint)
-  {
-    fillAttribute(theAngle, angle());
-
-    execute();
-    createPoint();
-  }
-  else
-  {
-    execute();
-  }
+  execute();
+  createPoint();
 }
 
 //==================================================================================================
@@ -247,26 +227,16 @@ void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const
   const std::string& aSketchName = theDumper.parentName(aBase);
 
   AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
-  std::string aComName = aBase->integer(SketchPlugin_Circle::VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0 ?
-    "addCircleWithPoint" : "addCircle";
-
   if (anExternal->context()) {
     // circle is external
-    theDumper << aBase << " = " << aSketchName << "." << aComName << "(" << anExternal << ")" << std::endl;
+    theDumper << aBase << " = " << aSketchName << ".addCircleWithPoint(" << anExternal << ")" << std::endl;
   }
   else {// circle given by center and radius
-    theDumper << aBase << " = " << aSketchName << "." << aComName << "(" << center() << ", " << radius();
-    if (aBase->integer(SketchPlugin_Circle::VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-    {
-      theDumper << ", " << angle() << ")" << std::endl;
-      std::shared_ptr<SketchAPI_SketchEntity> aPoint = createdPoint();
-      if (aPoint)
-        theDumper << aPoint->feature() << " = " << theDumper.name(aBase) << ".createdPoint()" << std::endl;
-    }
-    else
-    {
-      theDumper << ")" << std::endl;
-    }
+    theDumper << aBase << " = " << aSketchName << ".addCircleWithPoint(" << center() << ", " << radius();
+    theDumper << ", " << angle() << ")" << std::endl;
+    std::shared_ptr<SketchAPI_SketchEntity> aPoint = createdPoint();
+    if (aPoint)
+      theDumper << aPoint->feature() << " = " << theDumper.name(aBase) << ".createdPoint()" << std::endl;
   }
   // dump "auxiliary" flag if necessary
   SketchAPI_SketchEntity::dump(theDumper);
index 3c30c146a1f915867aaef34d71fab54c1c2c9262..bc679078e0fdb60e75bd575fe89a2217e2e95075 100644 (file)
@@ -598,7 +598,6 @@ std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Circle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_Circle::VERSION_ID()));
   return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius, 0));
 }
 
@@ -609,7 +608,6 @@ std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Circle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_Circle::VERSION_ID()));
   return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius, 0));
 }
 
@@ -621,7 +619,6 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theCen
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_MacroCircle::VERSION_ID()));
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterX, theCenterY,
                                                             thePassedX, thePassedY, 0));
 }
@@ -633,7 +630,6 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_MacroCircle::VERSION_ID()));
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint, 0));
 }
 
@@ -644,7 +640,6 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theX1,
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_MacroCircle::VERSION_ID()));
 
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1,
                                                             theX2, theY2,
@@ -659,7 +654,6 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  fillAttribute(SketchPlugin_Circle::THE_VERSION_0, aFeature->integer(SketchPlugin_Circle::VERSION_ID()));
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3, 0));
 }
 
index 86d5721e8d9c14f4da5a1cc14c30f5e998c09c37..ad29a71fb3eaf93e6388ffbca80112035d37f6e5 100644 (file)
@@ -63,17 +63,6 @@ void SketchPlugin_Circle::initDerivedClassAttributes()
   data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
-  // While exist addCircle without creating point.
-  AttributeIntegerPtr aVerAttr = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(
-    data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId()));
-  aVerAttr->setIsArgument(false);
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID());
-  if (!aVerAttr->isInitialized()) {
-    // this is a newly created feature (not read from file),
-    // so, initialize the latest version
-    aVerAttr->setValue(SketchPlugin_Circle::THE_VERSION_1);
-  }
-
   data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ROTATE_ID());
@@ -114,21 +103,15 @@ void SketchPlugin_Circle::execute()
       aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
   std::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
 
-  std::shared_ptr<GeomAPI_Edge> aCircleShape;
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-  {
-    double aValAn = anAngleAttr->value();
-    aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius, aValAn / 180 * PI);
-
-    // Update corrdinates for point on circle
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-    GeomPnt2dPtr aCircleSewPoint = aSketch->to2D(aCircleShape->firstPoint());
-    std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ROTATE_ID()))
-      ->setValue(aCircleSewPoint->x(), aCircleSewPoint->y());
-    data()->blockSendAttributeUpdated(aWasBlocked, false);
-  }
-  else
-    aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
+  double aValAn = anAngleAttr->value();
+  std::shared_ptr<GeomAPI_Edge> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius, aValAn / 180 * PI);
+
+  // Update corrdinates for point on circle
+  bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+  GeomPnt2dPtr aCircleSewPoint = aSketch->to2D(aCircleShape->firstPoint());
+  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ROTATE_ID()))
+    ->setValue(aCircleSewPoint->x(), aCircleSewPoint->y());
+  data()->blockSendAttributeUpdated(aWasBlocked, false);
 
   std::shared_ptr<ModelAPI_ResultConstruction> aResult = document()->createConstruction(data(), 1);
   aResult->setShape(aCircleShape);
@@ -162,8 +145,7 @@ void SketchPlugin_Circle::attributeChanged(const std::string& theID) {
       real(ANGLE_ID())->setValue(0);
     }
   }
-  else if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0 &&
-           theID == ROTATE_ID())
+  else if (theID == ROTATE_ID())
   {
     // get cricle from results
     std::shared_ptr<GeomAPI_Shape> aSelection;
index 0f620d7a7459121405337e6310773b7e285a4c0d..fa843984bc9d5f38befc919582a6102a20687181 100644 (file)
@@ -80,16 +80,6 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity
     return MY_KIND;
   }
 
-  static const int THE_VERSION_0 = 0;
-  static const int THE_VERSION_1 = 20232206;
-
-  /// Attribute name of the version of Circle feature
-  inline static const std::string& VERSION_ID()
-  {
-    static const std::string MY_VERSION_ID("version");
-    return MY_VERSION_ID;
-  }
-
   /// Returns true is sketch element is under the rigid constraint
   SKETCHPLUGIN_EXPORT virtual bool isFixed();
 
index 4f107ebe594766f134bf74112a1862925f84b5a4..97afaa9c0511958d47d8f9d03f5eb3d9f7807630 100644 (file)
@@ -117,11 +117,6 @@ void SketchPlugin_MacroCircle::initAttributes()
     data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId()));
   aVerAttr->setIsArgument(false);
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID());
-  if (!aVerAttr->isInitialized()) {
-    // this is a newly created feature (not read from file),
-    // so, initialize the latest version
-    aVerAttr->setValue(SketchPlugin_Circle::THE_VERSION_1);
-  }
 
   string(EDIT_CIRCLE_TYPE())->setValue("");
 }
@@ -221,11 +216,10 @@ void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed(FeaturePtr
       this, PASSED_POINT_REF_ID(), AttributePtr(),
       theCircleFeature->lastResult(), true);
 
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-    SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, ROTATE_POINT_REF_ID(),
-      AttributePtr(),
-      theCircleFeature->lastResult(), false);
+  SketchPlugin_Tools::createCoincidenceOrTangency(
+    this, ROTATE_POINT_REF_ID(),
+    AttributePtr(),
+    theCircleFeature->lastResult(), false);
 }
 
 void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints(FeaturePtr theCircleFeature)
@@ -241,18 +235,14 @@ void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints(FeaturePtr theC
         this, aPointRef[i], AttributePtr(), aCircleResult, true);
   }
 
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-    SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, ROTATE_POINT_REF_ID(),
-      AttributePtr(),
-      aCircleResult, false);
+  SketchPlugin_Tools::createCoincidenceOrTangency(
+    this, ROTATE_POINT_REF_ID(),
+    AttributePtr(),
+    aCircleResult, false);
 }
 
 void SketchPlugin_MacroCircle::computeNewAngle(std::shared_ptr<GeomAPI_Circ2d>& theCircle)
 {
-  if (integer(VERSION_ID())->value() < SketchPlugin_Circle::THE_VERSION_1)
-    return;
-
   AttributePtr aRotateAtr = attribute(ROTATE_POINT_ID());
   if (aRotateAtr->isInitialized())
   {
@@ -308,22 +298,16 @@ FeaturePtr SketchPlugin_MacroCircle::createCircleFeature()
   std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->setValue(myCenter->x(),
                                                                              myCenter->y());
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-  {
-    aCircleFeature->real(SketchPlugin_Circle::ANGLE_ID())->setValue(myAngle);
-  }
+
+  aCircleFeature->real(SketchPlugin_Circle::ANGLE_ID())->setValue(myAngle);
   aCircleFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue(myRadius);
-  aCircleFeature->integer(SketchPlugin_Circle::VERSION_ID())->setValue(integer(VERSION_ID())->value());
   aCircleFeature->boolean(SketchPlugin_Circle::AUXILIARY_ID())
                 ->setValue(boolean(AUXILIARY_ID())->value());
 
   aCircleFeature->execute();
 
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-  {
-    // Create point
-    FeaturePtr aNPoint = CreatePoint(aCircleFeature, myRotPoint);
-  }
+  // Create point
+  FeaturePtr aNPoint = CreatePoint(aCircleFeature, myRotPoint);
 
   return aCircleFeature;
 }
@@ -499,17 +483,13 @@ AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious)
   aShapes.push_back(aCircleShape);
   aShapes.push_back(aCenterPointShape);
 
-  // For addCircle command skip creating point
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-  {
-    std::shared_ptr<GeomAPI_Pnt> aRotPoint;
-    if (myRotPoint.get())
-      aRotPoint = std::shared_ptr<GeomAPI_Pnt>(aSketch->to3D(myRotPoint->x(), myRotPoint->y()));
-    else
-      aRotPoint = std::shared_ptr<GeomAPI_Pnt>(aSketch->to3D(myCenter->x() + myRadius, myCenter->y()));
-    GeomShapePtr aNewPnt = GeomAlgoAPI_PointBuilder::vertex(aRotPoint);
-    aShapes.push_back(aNewPnt);
-  }
+  std::shared_ptr<GeomAPI_Pnt> aRotPoint;
+  if (myRotPoint.get())
+    aRotPoint = std::shared_ptr<GeomAPI_Pnt>(aSketch->to3D(myRotPoint->x(), myRotPoint->y()));
+  else
+    aRotPoint = std::shared_ptr<GeomAPI_Pnt>(aSketch->to3D(myCenter->x() + myRadius, myCenter->y()));
+  GeomShapePtr aNewPnt = GeomAlgoAPI_PointBuilder::vertex(aRotPoint);
+  aShapes.push_back(aNewPnt);
 
   std::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
   AISObjectPtr anAIS = thePrevious;
@@ -537,12 +517,8 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) {
   std::shared_ptr <GeomAPI_Circ2d> aCircle;
   // If circle type switched reset all attributes.
   if(theID == CIRCLE_TYPE()) {
-    if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
-    {
-      SketchPlugin_Tools::resetAttribute(this, ROTATE_POINT_ID());
-      SketchPlugin_Tools::resetAttribute(this, ROTATE_POINT_REF_ID());
-    }
-
+    SketchPlugin_Tools::resetAttribute(this, ROTATE_POINT_ID());
+    SketchPlugin_Tools::resetAttribute(this, ROTATE_POINT_REF_ID());
     SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_ID());
     SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_REF_ID());
     SketchPlugin_Tools::resetAttribute(this, PASSED_POINT_ID());
@@ -586,21 +562,17 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) {
     std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_POINT_ID()))
         ->setValue(myCenter);
   }
+  AttributeDoublePtr anAngleAttr = real(CIRCLE_ROTATE_ANGLE_ID());
 
-  if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0)
+  if (myRotPoint.get())
   {
-    AttributeDoublePtr anAngleAttr = real(CIRCLE_ROTATE_ANGLE_ID());
-
-    if (myRotPoint.get())
-    {
-      AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(ROTATE_POINT_ID()));
-      aPointAttr->setValue(myRotPoint);
-    }
-
-    if (anAngleAttr->isInitialized())
-      anAngleAttr->setValue(myAngle);
+    AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(ROTATE_POINT_ID()));
+    aPointAttr->setValue(myRotPoint);
   }
 
+  if (anAngleAttr->isInitialized())
+    anAngleAttr->setValue(myAngle);
+
   aRadiusAttr->setValue(myRadius);
 
   data()->blockSendAttributeUpdated(aWasBlocked, false);
index 7e5ba93c0f82b6b63f2d4fc5a82be2743dbe8992..2b0063a94cb6ada503bd5fa86b31a49f4c3fcb4e 100644 (file)
@@ -68,13 +68,6 @@ def verifyTangentCircleLine(theCircle, theLine):
     aDistCL = model.distancePointLine(aCenter, theLine)
     assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Circle and line are not tangent"
 
-#=========================================================================
-# Set old version of Circle for avoid create point.
-#=========================================================================
-def setVersionOfCircle(theCircle, theVersion):
-    aCircleVersion = theCircle.integer("version")
-    assert (type(aCircleVersion) == ModelAPI_AttributeInteger)
-    aCircleVersion.setValue(theVersion)
 
 #=========================================================================
 # Start of test
@@ -107,7 +100,6 @@ aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center"))
 assert (not aCircleCenter.isInitialized())
 aCircleRadius = aCircle.real("circle_radius")
 assert (type(aCircleRadius) == ModelAPI_AttributeDouble)
-setVersionOfCircle(aCircle, 0)
 # ModelAPI_AttributeDouble.typeId() is checked in ModelAPI_TestConstants
 assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.typeId())
 aCircleCenter.setValue(-25., -25)
@@ -141,7 +133,6 @@ assert (not aCirclePassed.isInitialized())
 aCircleType = aCircle.string("circle_type")
 assert (not aCircleType.isInitialized())
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 0)
 aCircleCenter.setValue(-25., -25)
 aCirclePassed.setValue(0., -25.)
 aRadius = model.distancePointPoint(aCircleCenter, aCirclePassed)
@@ -175,7 +166,6 @@ aCircleType = aCircle.string("circle_type")
 assert (not aCircleType.isInitialized())
 # initialize attributes
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 0)
 aCenterRef.setObject(aPoint.lastResult())
 aCenter.setValue(aPointCoord.pnt())
 aPassedRef.setAttr(aPrevCenter)
@@ -215,7 +205,6 @@ aPassedRef = aCircle.refattr("passed_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 0)
 aCenterRef.setObject(aLine.lastResult())
 anExpectedCenter = [(aLineStart[0] + aLineEnd[0]) * 0.5, (aLineStart[1] + aLineEnd[1]) * 0.5]
 aCenter.setValue(anExpectedCenter[0], anExpectedCenter[1])
@@ -250,7 +239,6 @@ aPassedRef = aCircle.refattr("passed_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 0)
 anExpectedCenter = [(aLineStart[0] + aLineEnd[0]) * 0.5 + 10., (aLineStart[1] + aLineEnd[1]) * 0.5]
 aCenter.setValue(anExpectedCenter[0], anExpectedCenter[1])
 aPassedRef.setObject(aLine.lastResult())
@@ -280,7 +268,6 @@ aPassedRef = aCircle.refattr("passed_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 0)
 aCenterRef.setObject(aLine.lastResult())
 aCenter.setValue(anExpectedCenter[0], anExpectedCenter[1])
 aPassedRef.setObject(aLine.lastResult())
@@ -307,7 +294,6 @@ aCircleType = aCircle.string("circle_type")
 aCircleAngle = aCircle.real("circle_angle")
 # initialize attributes
 aCircleType.setValue("circle_type_by_center_and_passed_points")
-setVersionOfCircle(aCircle, 20232206)
 aCenter.setValue(35., -35)
 anExpectedCenter = [35., -35]
 aPassed.setValue(45., -35)
index 4c8a5cdfd564357807709e15ca19aa4d04c9ca04..09109c3e0597524a5cf53cfbcfbf4a1426d0418a 100644 (file)
@@ -82,13 +82,6 @@ def verifyTangentCircleLine(theCircle, theLine):
     aDistCL = model.distancePointLine(aCenter, theLine)
     assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Circle and line are not tangent"
 
-#=========================================================================
-# Set old version of Circle for avoid create point.
-#=========================================================================
-def setOldVersionOfCircleFeature(theCircle):
-    aCircleVersion = theCircle.integer("version")
-    assert (type(aCircleVersion) == ModelAPI_AttributeInteger)
-    aCircleVersion.setValue(0)
 
 #=========================================================================
 # Start of test
@@ -128,7 +121,6 @@ assert (not aCirclePnt3.isInitialized())
 aCircleType = aCircle.string("circle_type")
 assert (not aCircleType.isInitialized())
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1.setValue(expectedCenter[0] - expectedRadius, expectedCenter[1])
 aCirclePnt2.setValue(expectedCenter[0] + expectedRadius, expectedCenter[1])
 aCirclePnt3.setValue(expectedCenter[0], expectedCenter[1] + expectedRadius)
@@ -170,7 +162,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1Ref.setAttr(aPrevCenter)
 aCirclePnt1.setValue(aPrevCenter.pnt())
 aCirclePnt2Ref.setObject(aPoint.lastResult())
@@ -218,7 +209,6 @@ aCirclePnt1Ref = aCircle.refattr("first_point_ref")
 aCirclePnt2Ref = aCircle.refattr("second_point_ref")
 aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
-setOldVersionOfCircleFeature(aCircle)
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
 aCirclePnt1Ref.setObject(aPrevCircle.lastResult())
@@ -258,7 +248,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1Ref.setAttr(aStartPnt)
 aCirclePnt1.setValue(aStartPnt.pnt())
 aCirclePnt2Ref.setAttr(aEndPnt)
@@ -290,7 +279,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1.setValue(aLineStart[0] + aDistanceFromLine, aLineStart[1])
 aCirclePnt2.setValue(aLineStart[0] - aDistanceFromLine, aLineStart[1])
 aCirclePnt3Ref.setObject(aLine.lastResult())
@@ -336,7 +324,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1.setValue(0, 0)
 aCirclePnt2Ref.setObject(SketchLine_1.feature().lastResult())
 aCirclePnt2.setValue(SketchLine_1.startPoint().x(), SketchLine_1.startPoint().y())
@@ -366,7 +353,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1.setValue(0, 0)
 aCirclePnt2Ref.setObject(SketchCircle_3.feature().lastResult())
 aCirclePnt2.setValue(40, 0)
@@ -396,7 +382,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1.setValue(0, 0)
 aCirclePnt2Ref.setObject(SketchLine_3.feature().lastResult())
 aCirclePnt2.setValue(30, 0)
@@ -426,7 +411,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1Ref.setObject(SketchLine_1.feature().lastResult())
 aCirclePnt1.setValue(20, 0)
 aCirclePnt2Ref.setObject(SketchLine_2.feature().lastResult())
@@ -458,7 +442,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1Ref.setObject(SketchLine_1.feature().lastResult())
 aCirclePnt1.setValue(20, 0)
 aCirclePnt2Ref.setObject(SketchLine_2.feature().lastResult())
@@ -490,7 +473,6 @@ aCirclePnt3Ref = aCircle.refattr("third_point_ref")
 aCircleType = aCircle.string("circle_type")
 # initialize attributes
 aCircleType.setValue("circle_type_by_three_points")
-setOldVersionOfCircleFeature(aCircle)
 aCirclePnt1Ref.setObject(SketchCircle_1.feature().lastResult())
 aCirclePnt1.setValue(10, 0)
 aCirclePnt2Ref.setObject(SketchCircle_2.feature().lastResult())