]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create radius dimension
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 16 Apr 2015 12:51:54 +0000 (15:51 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 16 Apr 2015 12:51:54 +0000 (15:51 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/SketcherPrs/SketcherPrs_Radius.cpp

index cb1250a763fb7e815db580ce70738843167e5e13..e46d1a60c83d0695a8d2e2d86f8743a2994a3eb6 100644 (file)
@@ -324,6 +324,17 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
       get2dPoint(theWnd, theEvent, myCurrentPoint);
       myDragDone = false;
       launchEditing();
+      // Init flyout point for radius rotation
+      FeaturePtr aFeature = myCurrentSelection.begin().key();
+      std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
+                std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+      if (aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) {
+        DataPtr aData = aSPFeature->data();
+        AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+        std::shared_ptr<GeomDataAPI_Point2D> aFPAttr = 
+          std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
+        aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
+      }
 
     } else if (isSketchOpe && isEditing) {
       // If selected another object commit current result
index 6f398803684351741ba609bb3fa18c9e998d45ed..5d7135e063f274502802d781487822bb1efcab9c 100644 (file)
@@ -84,14 +84,15 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the
 
   GeomAPI_Circ aCircle(aCenter, aNormal, aRadius);
     
-  std::shared_ptr<GeomAPI_Pnt> anAnchor = aCircle.project(aFlyoutPnt);
-  std::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
-  anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz());
-  std::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
-  const double aDelta = 1e-3;
-  anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x());
-  anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y());
-  anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z());
+  std::shared_ptr<GeomAPI_Pnt> anAnchor = SketcherPrs_Tools::getAnchorPoint(myConstraint, myPlane);
+  //std::shared_ptr<GeomAPI_Pnt> anAnchor = aCircle.project(aFlyoutPnt);
+  //std::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
+  //anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz());
+  //std::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
+  //const double aDelta = 1e-3;
+  //anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x());
+  //anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y());
+  //anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z());
 
   SetMeasuredGeometry(aCircle.impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
   SetCustomValue(aRadius);