+// Create point on circle line
+void SketchAPI_Circle::createPoint()
+{
+ // Find sketch
+ CompositeFeaturePtr aSketch;
+ const std::set<AttributePtr>& aRefs = feature()->data()->refsToMe();
+ for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin(); anIt != aRefs.end(); ++anIt)
+ if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID())
+ {
+ aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>((*anIt)->owner());
+ break;
+ }
+ if (!aSketch)
+ return;
+
+ // create point on line
+ FeaturePtr aPointFeature = aSketch->addFeature(SketchPlugin_Point::ID());
+ aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(feature());
+
+ AttributePoint2DPtr aCoord = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aPointFeature->attribute(SketchPlugin_Point::COORD_ID()));
+
+ GeomPnt2dPtr aPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ feature()->attribute(SketchPlugin_Circle::ROTATE_ID()))->pnt();
+
+ aCoord->setValue(aPnt);
+ aPointFeature->execute();
+
+ FeaturePtr aConstraint = aSketch->addFeature(SketchPlugin_ConstraintCoincidenceInternal::ID());
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
+ aRefAttr->setAttr(feature()->attribute(SketchPlugin_Circle::ROTATE_ID()));
+
+ aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
+ aRefAttr->setAttr(aCoord);
+
+ feature()->reference(SketchPlugin_Circle::ROTATE_REF_ID())->setValue(aPointFeature);
+}
+