| 929 | } |
| 930 | |
| 931 | PyObject* DrawViewPartPy::getVertexBySelection(PyObject *args) |
| 932 | { |
| 933 | int vertexIndex = 0; |
| 934 | const char* selName{}; //Selection routine name - "Vertex0" |
| 935 | if (!PyArg_ParseTuple(args, "s", &selName)) { |
| 936 | return nullptr; |
| 937 | } |
| 938 | |
| 939 | vertexIndex = DrawUtil::getIndexFromName(std::string(selName)); |
| 940 | DrawViewPart* dvp = getDrawViewPartPtr(); |
| 941 | |
| 942 | //this is scaled and +Yup |
| 943 | //need unscaled and +Ydown |
| 944 | TechDraw::VertexPtr vert = dvp->getProjVertexByIndex(vertexIndex); |
| 945 | if (!vert) { |
| 946 | PyErr_SetString(PyExc_ValueError, "Wrong vertex index"); |
| 947 | return nullptr; |
| 948 | } |
| 949 | |
| 950 | Base::Vector3d point = DrawUtil::invertY(vert->point()) / dvp->getScale(); |
| 951 | gp_Pnt gPoint(point.x, point.y, point.z); |
| 952 | BRepBuilderAPI_MakeVertex mkVertex(gPoint); |
| 953 | TopoDS_Vertex outVertex = mkVertex.Vertex(); |
| 954 | |
| 955 | return new Part::TopoShapeVertexPy(new Part::TopoShape(outVertex)); |
| 956 | } |
| 957 | |
| 958 | PyObject* DrawViewPartPy::projectPoint(PyObject *args) |
| 959 | { |
no test coverage detected