+
+FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePtr theOrigin,
+ double theX, double theY, double theZ)
+{
+ std::shared_ptr<ModelAPI_Feature> aAxis = theDoc->addFeature("Axis");
+ aAxis->string("CreationMethod")->setValue("AxisByPointAndDirection");
+
+ ResultPtr aResult = theOrigin->firstResult();
+ aAxis->selection("FirstPoint")->setValue(aResult, aResult->shape());
+
+ aAxis->real("X_Direction")->setValue(theX);
+ aAxis->real("Y_Direction")->setValue(theY);
+ aAxis->real("Z_Direction")->setValue(theZ);
+
+ if (theX != 0) {
+ aAxis->data()->setName(L"OX");
+ } else if (theY != 0) {
+ aAxis->data()->setName(L"OY");
+ } else if (theZ != 0) {
+ aAxis->data()->setName(L"OZ");
+ }
+ // don't show automatically created feature in the features history
+ aAxis->setInHistory(aAxis, false);
+ aAxis->execute();
+ aAxis->data()->execState(ModelAPI_StateDone);
+ aAxis->firstResult()->data()->execState(ModelAPI_StateDone);
+
+ return aAxis;
+}
+
+void InitializationPlugin_Plugin::createPart(DocumentPtr thePartSet)
+{
+ std::shared_ptr<ModelAPI_Feature> aPart = thePartSet->addFeature("Part");
+ if (aPart.get())
+ aPart->execute(); // to initialize and activate this part document
+}