Skip to content

Commit

Permalink
[TD]Expose getVisibleVertexes/getHiddenVertexes to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Apr 18, 2024
1 parent d611611 commit 5ed00d5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Mod/TechDraw/App/DrawViewPartPy.xml
Expand Up @@ -18,11 +18,21 @@
<UserDocu>getVisibleEdges() - get the visible edges in the View as Part::TopoShapeEdges</UserDocu>
</Documentation>
</Methode>
<Methode Name="getVisibleVertexes">
<Documentation>
<UserDocu>getVisibleVertexes() - get the visible vertexes as App.Vector in the View's coordinate system.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getHiddenEdges">
<Documentation>
<UserDocu>getHiddenEdges() - get the hidden edges in the View as Part::TopoShapeEdges</UserDocu>
</Documentation>
</Methode>
<Methode Name="getHiddenVertexes">
<Documentation>
<UserDocu>getHiddenVertexes() - get the hidden vertexes as App.Vector in the View's coordinate system.</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeCosmeticVertex">
<Documentation>
<UserDocu>id = makeCosmeticVertex(p1) - add a CosmeticVertex at p1 (View coordinates). Returns unique id vertex.</UserDocu>
Expand Down
40 changes: 40 additions & 0 deletions src/Mod/TechDraw/App/DrawViewPartPyImp.cpp
Expand Up @@ -98,6 +98,46 @@ PyObject* DrawViewPartPy::getHiddenEdges(PyObject *args)
return Py::new_reference_to(pEdgeList);
}

PyObject* DrawViewPartPy::getVisibleVertexes(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}

DrawViewPart* dvp = getDrawViewPartPtr();
Py::List pVertexList;
auto vertsAll = dvp->getVertexGeometry();
for (auto& vert: vertsAll) {

Check warning on line 110 in src/Mod/TechDraw/App/DrawViewPartPyImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Missing space around colon in range-based for loop [whitespace/forcolon] [2]
if (vert->getHlrVisible()) {
PyObject* pVertex = new Base::VectorPy(new Base::Vector3d(vert->point()));
pVertexList.append(Py::asObject(pVertex));
}
}

return Py::new_reference_to(pVertexList);
}

PyObject* DrawViewPartPy::getHiddenVertexes(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}

DrawViewPart* dvp = getDrawViewPartPtr();
Py::List pVertexList;
auto vertsAll = dvp->getVertexGeometry();
for (auto& vert: vertsAll) {

Check warning on line 129 in src/Mod/TechDraw/App/DrawViewPartPyImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Missing space around colon in range-based for loop [whitespace/forcolon] [2]
if (!vert->getHlrVisible()) {
PyObject* pVertex = new Base::VectorPy(new Base::Vector3d(vert->point()));
pVertexList.append(Py::asObject(pVertex));
}
}

return Py::new_reference_to(pVertexList);
}



PyObject* DrawViewPartPy::requestPaint(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) {
Expand Down

0 comments on commit 5ed00d5

Please sign in to comment.