MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / getEdgeByIndex

Method getEdgeByIndex

src/Mod/TechDraw/App/DrawViewPartPyImp.cpp:851–875  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

849
850//------------------------------------------------------------------------------
851PyObject* DrawViewPartPy::getEdgeByIndex(PyObject *args)
852{
853 int edgeIndex = 0;
854 if (!PyArg_ParseTuple(args, "i", &edgeIndex)) {
855 return nullptr;
856 }
857
858 DrawViewPart* dvp = getDrawViewPartPtr();
859
860 //this is scaled and +Yup
861 //need unscaled and +Ydown
862 TechDraw::BaseGeomPtr geom = dvp->getGeomByIndex(edgeIndex);
863 if (!geom) {
864 PyErr_SetString(PyExc_ValueError, "Wrong edge index");
865 return nullptr;
866 }
867
868 TopoDS_Shape temp = ShapeUtils::mirrorShapeVec(geom->getOCCEdge(),
869 Base::Vector3d(0.0, 0.0, 0.0),
870 1.0 / dvp->getScale());
871
872 TopoDS_Edge outEdge = TopoDS::Edge(temp);
873
874 return new Part::TopoShapeEdgePy(new Part::TopoShape(outEdge));
875}
876
877PyObject* DrawViewPartPy::getVertexByIndex(PyObject *args)
878{

Callers

nothing calls this directly

Calls 4

Vector3dClass · 0.85
getGeomByIndexMethod · 0.80
EdgeClass · 0.50
getScaleMethod · 0.45

Tested by

no test coverage detected