Edge.curveOnSurface : add placement to the output tuple

This commit is contained in:
tomate44
2020-08-28 17:47:17 +02:00
committed by wwmayer
parent 291050c8d0
commit 21562568d6
2 changed files with 15 additions and 6 deletions

View File

@@ -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>

View File

@@ -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) {