]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2024: Redesign of circle and arc of circle
authorazv <azv@opencascade.com>
Mon, 27 Mar 2017 06:20:34 +0000 (09:20 +0300)
committerdbv <dbv@opencascade.com>
Mon, 27 Mar 2017 06:56:58 +0000 (09:56 +0300)
Constraints for tangent arc

src/SketchPlugin/SketchPlugin_MacroArc.cpp

index c1affb73688bfd65560c5b64e36ec48aba7afcaa..e53b85efecc46fb7930a230150ba7b794aa7ec83 100644 (file)
@@ -7,6 +7,7 @@
 #include "SketchPlugin_MacroArc.h"
 
 #include "SketchPlugin_Arc.h"
+#include "SketchPlugin_ConstraintTangent.h"
 #include "SketchPlugin_Sketch.h"
 #include "SketchPlugin_Tools.h"
 
@@ -225,6 +226,20 @@ void SketchPlugin_MacroArc::execute()
                                          anArcFeature->lastResult(),
                                          true);
   } else if(anArcType == ARC_TYPE_BY_TANGENT_EDGE()) {
+    // constraints for tangent arc
+    SketchPlugin_Tools::createConstraint(this,
+                                         TANGENT_POINT_ID(),
+                                         anArcFeature->attribute(SketchPlugin_Arc::START_ID()),
+                                         ObjectPtr(),
+                                         false);
+    FeaturePtr aTangent = sketch()->addFeature(SketchPlugin_ConstraintTangent::ID());
+    AttributeRefAttrPtr aRefAttrA = aTangent->refattr(SketchPlugin_Constraint::ENTITY_A());
+    AttributeRefAttrPtr aTgPntRefAttr = refattr(TANGENT_POINT_ID());
+    FeaturePtr aTgFeature = ModelAPI_Feature::feature(aTgPntRefAttr->attr()->owner());
+    aRefAttrA->setObject(aTgFeature->lastResult());
+    AttributeRefAttrPtr aRefAttrB = aTangent->refattr(SketchPlugin_Constraint::ENTITY_B());
+    aRefAttrB->setObject(anArcFeature->lastResult());
+    // constraint for end point
     SketchPlugin_Tools::createConstraint(this,
                                          END_POINT_REF_ID(),
                                          anArcFeature->attribute(SketchPlugin_Arc::END_ID()),