-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// E.A. : On windows with python 2.6, there is a conflict
// E.A. : between pymath.h and Standard_math.h which define
// E.A. : some same symbols : acosh, asinh, ...
-#include <Standard_math.hxx>
+#include <Standard_Real.hxx>
+#include <pyport.h>
#include <pymath.h>
#endif
#include "GEOMImpl_IIsoline.hxx"
#include "GEOMImpl_PolylineDumper.hxx"
-#include <Basics_OCCTVersion.hxx>
-
#include "utilities.h"
#include <TDF_Tool.hxx>
PyStdOut_write(PyStdOut* self, PyObject* args)
{
char *c;
- int l;
- if (!PyArg_ParseTuple(args, "t#:write", &c, &l))
+ if (!PyArg_ParseTuple(args, "s", &c))
return NULL;
*(self->out) = *(self->out) + c;
static PyMethodDef PyStdOut_methods[] = {
{"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
PyDoc_STR("write(string) -> None")},
- {NULL, NULL} /* sentinel */
+ {0, 0, 0, 0} /* sentinel */
};
static PyMemberDef PyStdOut_memberlist[] = {
{(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
(char*)"flag indicating that a space needs to be printed; used by print"},
- {NULL} /* Sentinel */
+ {0, 0, 0, 0, 0} /* sentinel */
};
static PyTypeObject PyStdOut_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
+ /* 0, */ /*ob_size*/
"PyOut", /*tp_name*/
sizeof(PyStdOut), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ 0, /*tp_finalize*/
};
PyObject* newPyStdOut( std::string& out )
* constructor:
*/
//=============================================================================
-GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
{
MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
}
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle object
- Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
+ Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
//Add a new Circle function for creation a circle relatively to three points
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle object
- Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
+ Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
//Add a new Circle function for creation a circle relatively to center and 2 points
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//if (thePnt.IsNull() || theVec.IsNull()) return NULL;
//Add a new Circle object
- Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
+ Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
//Add a new Circle function for creation a circle relatively to point and vector
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//if (thePnt.IsNull() || theVec.IsNull()) return NULL;
//Add a new Ellipse object
- Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE);
+ Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_ELLIPSE);
//Add a new Ellipse function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle Arc object
- Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
+ Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
//Add a new Circle Arc function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle Arc object
- Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
+ Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
//Add a new Circle Arc function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Make a Python command
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle Arc object
- Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE_ARC);
+ Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_ELLIPSE_ARC);
//Add a new Circle Arc function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(KO);
//Add a new Polyline object
- Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE);
+ Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GEOM_POLYLINE);
//Add a new Polyline function for creation a polyline relatively to points set
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(KO);
//Add a new Spline object
- Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+ Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
//Add a new Spline function for creation a bezier curve relatively to points set
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(KO);
//Add a new Spline object
- Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+ Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
//Add a new Spline function for interpolation type
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(KO);
//Add a new Spline object
- Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+ Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
//Add a new Spline function for interpolation type
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
std::string err_description="";
PyObject* new_stderr = newPyStdOut(err_description);
PyObject* old_stderr = PySys_GetObject((char*)"stderr");
+ Py_INCREF(old_stderr);
PySys_SetObject((char*)"stderr", new_stderr);
PyErr_Print();
PySys_SetObject((char*)"stderr", old_stderr);
switch(theCurveType) {
case Polyline: {
//Add a new Polyline object
- aCurve = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE);
+ aCurve = GetEngine()->AddObject(GEOM_POLYLINE);
//Add a new Polyline function for creation a polyline relatively to points set
aFunction = aCurve->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
}
case Bezier: {
//Add a new Spline object
- aCurve = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+ aCurve = GetEngine()->AddObject(GEOM_SPLINE);
//Add a new Spline function for creation a bezier curve relatively to points set
aFunction =
aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
}
case Interpolation: {
//Add a new Spline object
- aCurve = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+ aCurve = GetEngine()->AddObject(GEOM_SPLINE);
//Add a new Spline function for creation a bezier curve relatively to points set
aFunction = aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
//Add a new Sketcher object
- Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
+ Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
//Add a new Sketcher function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
//Add a new Sketcher object
- Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
+ Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
//Add a new Sketcher function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
//Add a new Sketcher object
- Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
+ Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
//Add a new Sketcher function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(KO);
//Add a new Sketcher object
- Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
+ Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
//Add a new Sketcher function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Add a new Spline object
Handle(GEOM_Object) anIsoline =
- GetEngine()->AddObject(GetDocID(), GEOM_ISOLINE);
+ GetEngine()->AddObject(GEOM_ISOLINE);
//Add a new Spline function for interpolation type
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
// Add a new Polyline object
Handle(GEOM_Object) aResult =
- GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE2D);
+ GetEngine()->AddObject(GEOM_POLYLINE2D);
Handle(GEOM_Function) aFunction = aResult->AddFunction
(GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_COORDS);
// Compute the isoline curve
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Polyline driver failed");
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Add a new Polyline object
Handle(GEOM_Object) aResult =
- GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE2D);
+ GetEngine()->AddObject(GEOM_POLYLINE2D);
Handle(GEOM_Function) aFunction = aResult->AddFunction
(GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_OBJECT);
//Compute the isoline curve
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Polyline driver failed");
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}