1
/***************************************************************************
2
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
26
# include <BRepBuilderAPI_MakeFace.hxx>
27
# include <BRepBuilderAPI_MakeShell.hxx>
28
# include <Geom_BSplineSurface.hxx>
29
# include <Geom_Geometry.hxx>
30
# include <Geom_Surface.hxx>
31
# include <GeomAPI_IntSS.hxx>
32
# include <GeomAPI_ProjectPointOnSurf.hxx>
33
# include <GeomConvert_ApproxSurface.hxx>
34
# include <GeomLib_IsPlanarSurface.hxx>
35
# include <GeomLProp_SLProps.hxx>
37
# include <gp_Quaternion.hxx>
39
# include <Precision.hxx>
40
# include <ShapeAnalysis_Surface.hxx>
41
# include <Standard_Failure.hxx>
42
# include <Standard_Version.hxx>
45
#include <Base/GeometryPyCXX.h>
46
#include <Base/PyWrapParseTupleAndKeywords.h>
47
#include <Base/VectorPy.h>
49
#include "GeometrySurfacePy.h"
50
#include "GeometrySurfacePy.cpp"
51
#include "BSplineSurfacePy.h"
52
#include "GeometryCurvePy.h"
55
#include "TopoShapeFacePy.h"
56
#include "TopoShapeShellPy.h"
60
const Py::Object makeTrimmedCurvePy(const Handle(Geom_Curve)& c, double f, double l)
63
std::unique_ptr<GeomCurve> gc(makeFromTrimmedCurve(c, f, l));
64
return Py::asObject(gc->getPyObject());
66
catch (const Base::Exception& e) {
67
throw Py::TypeError(e.what());
71
const Py::Object makeGeometryCurvePy(const Handle(Geom_Curve)& c)
74
std::unique_ptr<GeomCurve> gc(makeFromCurve(c));
75
return Py::asObject(gc->getPyObject());
77
catch (const Base::Exception& e) {
78
throw Py::TypeError(e.what());
84
// ---------------------------------------
88
// returns a string which represents the object e.g. when printed in python
89
std::string GeometrySurfacePy::representation() const
91
return "<Surface object>";
94
PyObject *GeometrySurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
96
// never create such objects with the constructor
97
PyErr_SetString(PyExc_RuntimeError,
98
"You cannot create an instance of the abstract class 'GeometrySurface'.");
103
int GeometrySurfacePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
108
PyObject* GeometrySurfacePy::toShape(PyObject *args)
110
Handle(Geom_Geometry) g = getGeometryPtr()->handle();
111
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(g);
115
s->Bounds(u1,u2,v1,v2);
116
if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2))
118
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion() );
119
TopoDS_Shape sh = mkBuilder.Shape();
120
return new TopoShapeFacePy(new TopoShape(sh));
123
catch (Standard_Failure& e) {
125
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
129
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
133
PyObject* GeometrySurfacePy::toShell(PyObject *args, PyObject* kwds)
135
PyObject* bound = nullptr;
136
PyObject* segm = nullptr;
137
static const std::array<const char *, 3> kwlist {"Bounds", "Segment", nullptr};
138
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "|O!O!", kwlist,
139
&PyTuple_Type, &bound, &PyBool_Type, &segm)) {
143
Handle(Geom_Geometry) g = getGeometryPtr()->handle();
144
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(g);
148
Standard_Boolean segment = Base::asBoolean(segm);
149
BRepBuilderAPI_MakeShell mkBuilder(s, segment);
150
TopoDS_Shape sh = mkBuilder.Shape();
151
return new TopoShapeShellPy(new TopoShape(sh));
155
s->Bounds(u1,u2,v1,v2);
158
Py::Tuple tuple(bound);
159
u1 = double(Py::Float(tuple[0]));
160
u2 = double(Py::Float(tuple[1]));
161
v1 = double(Py::Float(tuple[2]));
162
v2 = double(Py::Float(tuple[3]));
165
BRepBuilderAPI_MakeShell mkBuilder(s, u1, u2, v1, v2);
166
TopoDS_Shape sh = mkBuilder.Shape();
167
return new TopoShapeShellPy(new TopoShape(sh));
171
catch (Standard_Failure& e) {
172
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
176
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
180
PyObject* GeometrySurfacePy::getD0(PyObject *args)
182
Handle(Geom_Geometry) g = getGeometryPtr()->handle();
183
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(g);
187
if (!PyArg_ParseTuple(args, "dd", &u, &v))
191
return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z()));
194
catch (Standard_Failure& e) {
195
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
199
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
203
PyObject* GeometrySurfacePy::getDN(PyObject *args)
208
if (!PyArg_ParseTuple(args, "ddii", &u, &v, &nu, &nv))
210
gp_Vec v1 = getGeomSurfacePtr()->getDN(u, v, nu, nv);
211
return new Base::VectorPy(Base::Vector3d(v1.X(),v1.Y(),v1.Z()));
213
catch (Standard_Failure& e) {
214
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
219
PyObject* GeometrySurfacePy::value(PyObject *args)
221
Handle(Geom_Geometry) g = getGeometryPtr()->handle();
222
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(g);
226
if (!PyArg_ParseTuple(args, "dd", &u,&v))
228
gp_Pnt p = s->Value(u,v);
229
return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z()));
232
catch (Standard_Failure& e) {
234
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
238
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
242
PyObject* GeometrySurfacePy::tangent(PyObject *args)
244
Handle(Geom_Geometry) g = getGeometryPtr()->handle();
245
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(g);
249
if (!PyArg_ParseTuple(args, "dd", &u,&v))
253
GeomLProp_SLProps prop(s,u,v,2,Precision::Confusion());
254
if (prop.IsTangentUDefined()) {
256
tuple.setItem(0, Py::Vector(Base::Vector3d(dir.X(),dir.Y(),dir.Z())));
258
if (prop.IsTangentVDefined()) {
260
tuple.setItem(1, Py::Vector(Base::Vector3d(dir.X(),dir.Y(),dir.Z())));
263
return Py::new_reference_to(tuple);
266
catch (Standard_Failure& e) {
268
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
272
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
276
PyObject* GeometrySurfacePy::normal(PyObject *args)
279
GeomSurface* s = getGeomSurfacePtr();
282
if (!PyArg_ParseTuple(args, "dd", &u,&v))
285
if (s->normal(u,v,d)) {
286
return new Base::VectorPy(Base::Vector3d(d.X(),d.Y(),d.Z()));
289
PyErr_SetString(PyExc_RuntimeError, "normal at this point is not defined");
294
catch (Standard_Failure& e) {
295
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
299
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
303
PyObject* GeometrySurfacePy::projectPoint(PyObject *args, PyObject* kwds)
306
const char* meth = "NearestPoint";
307
static const std::array<const char *, 3> kwlist {"Point", "Method", nullptr};
308
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!|s", kwlist, &Base::VectorPy::Type, &v, &meth)) {
313
Base::Vector3d vec = Py::Vector(v, false).toVector();
314
gp_Pnt pnt(vec.x, vec.y, vec.z);
315
std::string method = meth;
317
Handle(Geom_Geometry) geom = getGeometryPtr()->handle();
318
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(geom);
320
GeomAPI_ProjectPointOnSurf proj(pnt, surf);
321
if (method == "NearestPoint") {
322
pnt = proj.NearestPoint();
323
vec.Set(pnt.X(), pnt.Y(), pnt.Z());
324
return new Base::VectorPy(vec);
326
else if (method == "LowerDistance") {
327
Py::Float dist(proj.LowerDistance());
328
return Py::new_reference_to(dist);
330
else if (method == "LowerDistanceParameters") {
332
proj.LowerDistanceParameters(u, v);
334
par.setItem(0, Py::Float(u));
335
par.setItem(1, Py::Float(v));
336
return Py::new_reference_to(par);
338
else if (method == "Distance") {
339
Standard_Integer num = proj.NbPoints();
341
for (Standard_Integer i=1; i <= num; i++) {
342
list.append(Py::Float(proj.Distance(i)));
344
return Py::new_reference_to(list);
346
else if (method == "Parameters") {
347
Standard_Integer num = proj.NbPoints();
349
for (Standard_Integer i=1; i <= num; i++) {
351
proj.Parameters(i, u, v);
353
par.setItem(0, Py::Float(u));
354
par.setItem(1, Py::Float(v));
357
return Py::new_reference_to(list);
359
else if (method == "Point") {
360
Standard_Integer num = proj.NbPoints();
362
for (Standard_Integer i=1; i <= num; i++) {
363
gp_Pnt pnt = proj.Point(i);
364
Base::Vector3d vec(pnt.X(), pnt.Y(), pnt.Z());
365
list.append(Py::Vector(vec));
367
return Py::new_reference_to(list);
370
PyErr_SetString(PartExceptionOCCError, "Unsupported method");
374
catch (Standard_Failure& e) {
375
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
380
PyObject* GeometrySurfacePy::isUmbillic(PyObject *args)
383
GeomSurface* s = getGeomSurfacePtr();
386
if (!PyArg_ParseTuple(args, "dd", &u,&v))
389
bool val = s->isUmbillic(u,v);
390
return PyBool_FromLong(val ? 1 : 0);
393
catch (Standard_Failure& e) {
395
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
399
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
403
PyObject* GeometrySurfacePy::curvatureDirections(PyObject *args)
406
GeomSurface* s = getGeomSurfacePtr();
409
if (!PyArg_ParseTuple(args, "dd", &u,&v))
413
s->curvatureDirections(u,v,maxd,mind);
416
tuple.setItem(0, Py::Vector(Base::Vector3d(maxd.X(),maxd.Y(),maxd.Z())));
417
tuple.setItem(1, Py::Vector(Base::Vector3d(mind.X(),mind.Y(),mind.Z())));
418
return Py::new_reference_to(tuple);
421
catch (Standard_Failure& e) {
423
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
427
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
431
PyObject* GeometrySurfacePy::curvature(PyObject *args)
434
GeomSurface* s = getGeomSurfacePtr();
438
if (!PyArg_ParseTuple(args, "dds", &u,&v,&type))
441
GeomSurface::Curvature t;
442
if (strcmp(type,"Max") == 0) {
443
t = GeomSurface::Maximum;
445
else if (strcmp(type,"Min") == 0) {
446
t = GeomSurface::Minimum;
448
else if (strcmp(type,"Mean") == 0) {
449
t = GeomSurface::Mean;
451
else if (strcmp(type,"Gauss") == 0) {
452
t = GeomSurface::Gaussian;
455
PyErr_SetString(PyExc_ValueError, "unknown curvature type");
459
double c = s->curvature(u,v,t);
460
return PyFloat_FromDouble(c);
463
catch (Standard_Failure& e) {
465
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
469
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
473
PyObject* GeometrySurfacePy::isPlanar(PyObject *args)
476
Handle(Geom_Surface) surf = Handle(Geom_Surface)
477
::DownCast(getGeometryPtr()->handle());
478
if (!surf.IsNull()) {
479
double tol = Precision::Confusion();
480
if (!PyArg_ParseTuple(args, "|d", &tol))
483
GeomLib_IsPlanarSurface check(surf, tol);
484
Standard_Boolean val = check.IsPlanar();
485
return PyBool_FromLong(val ? 1 : 0);
488
catch (Standard_Failure& e) {
489
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
493
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
497
PyObject* GeometrySurfacePy::parameter(PyObject *args)
499
Handle(Geom_Surface) surf = Handle(Geom_Surface)
500
::DownCast(getGeometryPtr()->handle());
502
if (!surf.IsNull()) {
504
double prec = Precision::Confusion();
505
if (!PyArg_ParseTuple(args, "O!|d", &(Base::VectorPy::Type), &p, &prec))
507
Base::Vector3d v = Py::Vector(p, false).toVector();
508
gp_Pnt pnt(v.x,v.y,v.z);
509
ShapeAnalysis_Surface as(surf);
510
gp_Pnt2d uv = as.ValueOfUV(pnt, prec);
512
tuple.setItem(0, Py::Float(uv.X()));
513
tuple.setItem(1, Py::Float(uv.Y()));
514
return Py::new_reference_to(tuple);
517
catch (Standard_Failure& e) {
519
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
523
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
527
PyObject* GeometrySurfacePy::bounds(PyObject * args)
529
if (!PyArg_ParseTuple(args, ""))
532
Handle(Geom_Surface) surf = Handle(Geom_Surface)
533
::DownCast(getGeometryPtr()->handle());
535
Standard_Real u1,u2,v1,v2;
536
surf->Bounds(u1,u2,v1,v2);
537
bound.setItem(0,Py::Float(u1));
538
bound.setItem(1,Py::Float(u2));
539
bound.setItem(2,Py::Float(v1));
540
bound.setItem(3,Py::Float(v2));
541
return Py::new_reference_to(bound);
544
PyObject* GeometrySurfacePy::uIso(PyObject * args)
547
if (!PyArg_ParseTuple(args, "d", &v))
551
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
552
(getGeometryPtr()->handle());
553
Handle(Geom_Curve) c = surf->UIso(v);
555
PyErr_SetString(PyExc_RuntimeError, "failed to create u iso curve");
559
if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
560
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(c);
561
GeomLine* line = new GeomLine();
562
Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast
564
this_curv->SetLin(aLine->Lin());
565
return new LinePy(line);
568
return Py::new_reference_to(makeGeometryCurvePy(c));
571
catch (Standard_Failure& e) {
573
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
578
PyObject* GeometrySurfacePy::vIso(PyObject * args)
581
if (!PyArg_ParseTuple(args, "d", &v))
585
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
586
(getGeometryPtr()->handle());
587
Handle(Geom_Curve) c = surf->VIso(v);
589
PyErr_SetString(PyExc_RuntimeError, "failed to create v iso curve");
593
if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
594
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(c);
595
GeomLine* line = new GeomLine();
596
Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast
598
this_curv->SetLin(aLine->Lin());
599
return new LinePy(line);
602
return Py::new_reference_to(makeGeometryCurvePy(c));
605
catch (Standard_Failure& e) {
607
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
612
PyObject* GeometrySurfacePy::isUPeriodic(PyObject * args)
614
if (!PyArg_ParseTuple(args, ""))
617
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
618
(getGeometryPtr()->handle());
619
Standard_Boolean val = surf->IsUPeriodic();
620
return PyBool_FromLong(val ? 1 : 0);
623
PyObject* GeometrySurfacePy::isVPeriodic(PyObject * args)
625
if (!PyArg_ParseTuple(args, ""))
628
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
629
(getGeometryPtr()->handle());
630
Standard_Boolean val = surf->IsVPeriodic();
631
return PyBool_FromLong(val ? 1 : 0);
634
PyObject* GeometrySurfacePy::isUClosed(PyObject * args)
636
if (!PyArg_ParseTuple(args, ""))
639
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
640
(getGeometryPtr()->handle());
641
Standard_Boolean val = surf->IsUClosed();
642
return PyBool_FromLong(val ? 1 : 0);
645
PyObject* GeometrySurfacePy::isVClosed(PyObject * args)
647
if (!PyArg_ParseTuple(args, ""))
650
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
651
(getGeometryPtr()->handle());
652
Standard_Boolean val = surf->IsVClosed();
653
return PyBool_FromLong(val ? 1 : 0);
656
PyObject* GeometrySurfacePy::UPeriod(PyObject * args)
658
if (!PyArg_ParseTuple(args, ""))
662
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
663
(getGeometryPtr()->handle());
664
Standard_Real val = surf->UPeriod();
665
return PyFloat_FromDouble(val);
667
catch (Standard_Failure& e) {
669
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
674
PyObject* GeometrySurfacePy::VPeriod(PyObject * args)
676
if (!PyArg_ParseTuple(args, ""))
680
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
681
(getGeometryPtr()->handle());
682
Standard_Real val = surf->VPeriod();
683
return PyFloat_FromDouble(val);
685
catch (Standard_Failure& e) {
687
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
692
Py::String GeometrySurfacePy::getContinuity() const
694
GeomAbs_Shape c = Handle(Geom_Surface)::DownCast
695
(getGeometryPtr()->handle())->Continuity();
723
return Py::String(str);
726
PyObject* GeometrySurfacePy::toBSpline(PyObject * args, PyObject * kwds)
728
double tol3d=Precision::Confusion();
729
const char *ucont = "C1";
730
const char *vcont = "C1";
731
int maxDegU=Geom_BSplineSurface::MaxDegree();
732
int maxDegV=Geom_BSplineSurface::MaxDegree();
733
int maxSegm=1000, prec=0;
735
static const std::array<const char *, 8> kwlist{"Tol3d", "UContinuity", "VContinuity", "MaxDegreeU", "MaxDegreeV",
736
"MaxSegments", "PrecisCode", nullptr};
737
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "|dssiiii", kwlist,
738
&tol3d, &ucont, &vcont,
739
&maxDegU, &maxDegV, &maxSegm, &prec)) {
743
GeomAbs_Shape absU, absV;
744
std::string uc = ucont;
762
std::string vc = vcont;
781
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast
782
(getGeometryPtr()->handle());
783
GeomConvert_ApproxSurface cvt(surf, tol3d, absU, absV, maxDegU, maxDegV, maxSegm, prec);
784
if (cvt.IsDone() && cvt.HasResult()) {
785
return new BSplineSurfacePy(new GeomBSplineSurface(cvt.Surface()));
788
Standard_Failure::Raise("Cannot convert to B-spline surface");
791
catch (Standard_Failure& e) {
793
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
799
PyObject *GeometrySurfacePy::getCustomAttributes(const char* /*attr*/) const
804
int GeometrySurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
809
// Specialized intersection functions
811
PyObject* GeometrySurfacePy::intersectSS(PyObject *args)
813
Handle(Geom_Surface) surf1 = Handle(Geom_Surface)::DownCast(getGeometryPtr()->handle());
815
if (!surf1.IsNull()) {
817
double prec = Precision::Confusion();
818
if (!PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec))
820
Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::DownCast(static_cast<GeometryPy*>(p)->getGeometryPtr()->handle());
821
GeomAPI_IntSS intersector(surf1, surf2, prec);
822
if (!intersector.IsDone()) {
823
PyErr_SetString(PyExc_RuntimeError, "Intersection of surfaces failed");
828
for (int i = 1; i <= intersector.NbLines(); i++) {
829
Handle(Geom_Curve) line = intersector.Line(i);
830
result.append(makeGeometryCurvePy(line));
833
return Py::new_reference_to(result);
836
catch (Standard_Failure& e) {
838
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
842
PyErr_SetString(PyExc_TypeError, "intersectSS(): Geometry is not a surface");
846
// General intersection function
848
PyObject* GeometrySurfacePy::intersect(PyObject *args)
850
Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(getGeometryPtr()->handle());
852
if (!surf.IsNull()) {
854
double prec = Precision::Confusion();
857
if (PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec))
858
return intersectSS(args);
862
if (PyArg_ParseTuple(args, "O!|d", &(Part::GeometryCurvePy::Type), &p, &prec)) {
863
GeometryCurvePy* curve = static_cast<GeometryCurvePy*>(p);
864
PyObject* t = PyTuple_New(2);
866
PyTuple_SetItem(t, 0, this);
867
PyTuple_SetItem(t, 1, PyFloat_FromDouble(prec));
868
return curve->intersectCS(t);
874
catch (Standard_Failure& e) {
876
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
880
PyErr_SetString(PyExc_TypeError, "intersect(): Geometry is not a surface");
884
Py::Object GeometrySurfacePy::getRotation() const
886
Handle(Geom_ElementarySurface) s = Handle(Geom_ElementarySurface)::DownCast
887
(getGeometryPtr()->handle());
891
trsf.SetTransformation(s->Position().Ax2(),gp_Ax3());
892
auto q = trsf.GetRotation();
893
return Py::Rotation(Base::Rotation(q.X(),q.Y(),q.Z(),q.W()));