Skip to content

Commit

Permalink
Edge.curveOnSurface : add placement to the output tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
tomate44 authored and wwmayer committed Aug 29, 2020
1 parent 7d3ff63 commit efb403b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Mod/Part/App/TopoShapeEdgePy.xml
Expand Up @@ -531,9 +531,9 @@ coordinate system.</UserDocu>
<Methode Name="curveOnSurface" Const="true">
<Documentation>
<UserDocu>curveOnSurface(idx) -> None or tuple
Returns the 2D curve, the surface and the parameter range of index idx.
Returns the 2D curve, the surface, the placement and the parameter range of index idx.
Returns None if index idx is out of range.
Returns a 4-items tuple of a curve, a surface, first parameter and last parameter.
Returns a 5-items tuple of a curve, a surface, a placement, first parameter and last parameter.
</UserDocu>
</Documentation>
</Methode>
Expand Down
17 changes: 13 additions & 4 deletions src/Mod/Part/App/TopoShapeEdgePyImp.cpp
Expand Up @@ -1071,12 +1071,21 @@ PyObject* TopoShapeEdgePy::curveOnSurface(PyObject *args)
Part::GeomSurface* geosurf = makeFromSurface(surf);
if (!geosurf)
Py_Return;

Py::Tuple tuple(4);

gp_Trsf trsf = loc.Transformation();
gp_XYZ pos = trsf.TranslationPart();
gp_XYZ axis;
Standard_Real angle;
trsf.GetRotation(axis, angle);
Base::Rotation rot(Base::Vector3d(axis.X(), axis.Y(), axis.Z()), angle);
Base::Placement placement(Base::Vector3d(pos.X(), pos.Y(), pos.Z()), rot);

Py::Tuple tuple(5);
tuple.setItem(0, Py::asObject(geo2d->getPyObject()));
tuple.setItem(1, Py::asObject(geosurf->getPyObject()));
tuple.setItem(2, Py::Float(first));
tuple.setItem(3, Py::Float(last));
tuple.setItem(2, Py::Object(new Base::PlacementPy(placement), true));
tuple.setItem(3, Py::Float(first));
tuple.setItem(4, Py::Float(last));
return Py::new_reference_to(tuple);
}
catch (Standard_Failure& e) {
Expand Down

0 comments on commit efb403b

Please sign in to comment.