+
+void ConstructionPlugin_Axis::createAxisByPointAndDirection()
+{
+ AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST());
+ AttributeDoublePtr aXAttr = data()->real(ConstructionPlugin_Axis::X_DIRECTION());
+ AttributeDoublePtr aYAttr = data()->real(ConstructionPlugin_Axis::Y_DIRECTION());
+ AttributeDoublePtr aZAttr = data()->real(ConstructionPlugin_Axis::Z_DIRECTION());
+ if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) &&
+ (aYAttr.get() != NULL) && (aZAttr.get() != NULL)) {
+ GeomShapePtr aShape1 = aRef1->value();
+ if (!aShape1.get())
+ aShape1 = aRef1->context()->shape();
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aXAttr->value(),
+ aYAttr->value(),
+ aZAttr->value()));
+ if (aShape1->isVertex() && (!aShape1->isEqual(aVertex))) {
+ std::shared_ptr<GeomAPI_Pnt> aStart = GeomAlgoAPI_PointBuilder::point(aShape1);
+ std::shared_ptr<GeomAPI_Pnt> anEnd = aVertex->point();
+ if (aStart->distance(anEnd) > ConstructionPlugin_Axis::MINIMAL_LENGTH()) {
+ std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
+
+ ResultConstructionPtr aConstr = document()->createConstruction(data());
+ aConstr->setInfinite(true);
+ aConstr->setShape(anEdge);
+ setResult(aConstr);
+ }
+ }
+ }
+}
+
+