[TD] remove some more superfluous nullptr checks
This commit is contained in:
@@ -230,9 +230,8 @@ PyObject* DrawViewPartPy::getCosmeticVertexBySelection(PyObject *args)
|
||||
PyObject* DrawViewPartPy::removeCosmeticVertex(PyObject *args)
|
||||
{
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp)
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
char* tag;
|
||||
if (PyArg_ParseTuple(args, "s", &tag)) {
|
||||
@@ -714,17 +713,15 @@ PyObject* DrawViewPartPy::getEdgeByIndex(PyObject *args)
|
||||
PyObject* DrawViewPartPy::getVertexByIndex(PyObject *args)
|
||||
{
|
||||
int vertexIndex = 0;
|
||||
if (!PyArg_ParseTuple(args, "i", &vertexIndex)) {
|
||||
if (!PyArg_ParseTuple(args, "i", &vertexIndex))
|
||||
throw Py::TypeError("expected (vertIndex)");
|
||||
}
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::VertexPtr vert = dvp->getProjVertexByIndex(vertexIndex);
|
||||
if (vert == nullptr) {
|
||||
if (!vert)
|
||||
throw Py::ValueError("wrong vertIndex");
|
||||
}
|
||||
Base::Vector3d point = DrawUtil::invertY(vert->point()) / dvp->getScale();
|
||||
|
||||
gp_Pnt gPoint(point.x, point.y, point.z);
|
||||
@@ -737,9 +734,8 @@ PyObject* DrawViewPartPy::getEdgeBySelection(PyObject *args)
|
||||
{
|
||||
int edgeIndex = 0;
|
||||
char* selName; //Selection routine name - "Edge0"
|
||||
if (!PyArg_ParseTuple(args, "s", &selName)) {
|
||||
if (!PyArg_ParseTuple(args, "s", &selName))
|
||||
throw Py::TypeError("expected (string)");
|
||||
}
|
||||
|
||||
edgeIndex = DrawUtil::getIndexFromName(std::string(selName));
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
@@ -747,9 +743,8 @@ PyObject* DrawViewPartPy::getEdgeBySelection(PyObject *args)
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::BaseGeomPtr geom = dvp->getGeomByIndex(edgeIndex);
|
||||
if (geom == nullptr) {
|
||||
if (!geom)
|
||||
throw Py::ValueError("wrong edgeIndex");
|
||||
}
|
||||
|
||||
TopoDS_Shape temp = TechDraw::mirrorShapeVec(geom->occEdge,
|
||||
Base::Vector3d(0.0, 0.0, 0.0),
|
||||
@@ -773,9 +768,8 @@ PyObject* DrawViewPartPy::getVertexBySelection(PyObject *args)
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::VertexPtr vert = dvp->getProjVertexByIndex(vertexIndex);
|
||||
if (vert == nullptr) {
|
||||
if (!vert)
|
||||
throw Py::ValueError("wrong vertIndex");
|
||||
}
|
||||
Base::Vector3d point = DrawUtil::invertY(vert->point()) / dvp->getScale();
|
||||
|
||||
gp_Pnt gPoint(point.x, point.y, point.z);
|
||||
|
||||
Reference in New Issue
Block a user