Part: [skip ci] add missing methods to RectangularTrimmedSurface
This commit is contained in:
@@ -4566,7 +4566,7 @@ void GeomTrimmedSurface::Restore (Base::XMLReader &/*reader*/) {as
|
||||
|
||||
PyObject *GeomTrimmedSurface::getPyObject(void)
|
||||
{
|
||||
return 0;
|
||||
return new RectangularTrimmedSurfacePy(static_cast<GeomTrimmedSurface*>(this->clone()));
|
||||
}
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
@@ -25,5 +25,16 @@ The trimmed surface is built from a copy of the basis surface. Therefore, when t
|
||||
is modified the trimmed surface is not changed. Consequently, the trimmed surface does not
|
||||
necessarily have the same orientation as the basis surface.</UserDocu>
|
||||
</Documentation>
|
||||
</PythonExport>
|
||||
<Methode Name="setTrim">
|
||||
<Documentation>
|
||||
<UserDocu>Modifies this patch by changing the trim values applied to the original surface</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="BasisSurface" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu></UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="BasisSurface" Type="Object"/>
|
||||
</Attribute>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -86,6 +86,41 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* RectangularTrimmedSurfacePy::setTrim(PyObject *args)
|
||||
{
|
||||
double u1, u2, v1, v2;
|
||||
if (!PyArg_ParseTuple(args, "dddd", &u1, &u2, &v1, &v2))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_RectangularTrimmedSurface) surf = Handle(Geom_RectangularTrimmedSurface)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
if (surf.IsNull()) {
|
||||
PyErr_SetString(PyExc_TypeError, "geometry is not a surface");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
surf->SetTrim(u1, u2, v1, v2);
|
||||
Py_Return;
|
||||
}
|
||||
catch (const Standard_Failure& e) {
|
||||
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object RectangularTrimmedSurfacePy::getBasisSurface() const
|
||||
{
|
||||
Handle(Geom_RectangularTrimmedSurface) surf = Handle(Geom_RectangularTrimmedSurface)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
if (surf.IsNull()) {
|
||||
throw Py::TypeError("geometry is not a surface");
|
||||
}
|
||||
|
||||
std::unique_ptr<GeomSurface> geo(makeFromSurface(surf->BasisSurface()));
|
||||
return Py::asObject(geo->getPyObject());
|
||||
}
|
||||
|
||||
PyObject *RectangularTrimmedSurfacePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user