mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-12 14:30:48 +05:00
INT PAL 0052942: Error of geompy.MakeCurveParametric() is printed to a terminal instead of the Python Console
- Correct fix now
This commit is contained in:
parent
007a4cd246
commit
0138a9d57c
@ -78,6 +78,8 @@
|
|||||||
* =========== PYTHON ==============
|
* =========== PYTHON ==============
|
||||||
* ==================================*/
|
* ==================================*/
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
int softspace;
|
int softspace;
|
||||||
@ -98,7 +100,6 @@ PyStdOut_write(PyStdOut *self, PyObject *args)
|
|||||||
if (!PyArg_ParseTuple(args, "t#:write", &c, &l))
|
if (!PyArg_ParseTuple(args, "t#:write", &c, &l))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
//std::cerr << c ;
|
|
||||||
*(self->out) = *(self->out) + c;
|
*(self->out) = *(self->out) + c;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@ -167,15 +168,14 @@ static PyTypeObject PyStdOut_Type = {
|
|||||||
|
|
||||||
PyObject* newPyStdOut( std::string& out )
|
PyObject* newPyStdOut( std::string& out )
|
||||||
{
|
{
|
||||||
PyStdOut *self;
|
PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
|
||||||
self = PyObject_New(PyStdOut, &PyStdOut_Type);
|
if (self) {
|
||||||
if (self == NULL)
|
|
||||||
return NULL;
|
|
||||||
self->softspace = 0;
|
self->softspace = 0;
|
||||||
self->out=&out;
|
self->out=&out;
|
||||||
|
}
|
||||||
return (PyObject*)self;
|
return (PyObject*)self;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////END PYTHON///////////////////////////
|
////////////////////////END PYTHON///////////////////////////
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -996,7 +996,6 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
|
|||||||
PyObject* main_dict = PyModule_GetDict(main_mod);
|
PyObject* main_dict = PyModule_GetDict(main_mod);
|
||||||
|
|
||||||
PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL);
|
PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL);
|
||||||
printf("%s\n", aPyScript.ToCString());
|
|
||||||
|
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
SetErrorCode("Error during executing of python script !!!");
|
SetErrorCode("Error during executing of python script !!!");
|
||||||
@ -1022,15 +1021,14 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
|
|||||||
else
|
else
|
||||||
coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
|
coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
|
||||||
|
|
||||||
PyObject* new_stderr = NULL;
|
|
||||||
|
|
||||||
if (coords == NULL){
|
if (coords == NULL){
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
std::string err_description="";
|
std::string err_description="";
|
||||||
new_stderr = newPyStdOut(err_description);
|
PyObject* new_stderr = newPyStdOut(err_description);
|
||||||
|
PyObject* old_stderr = PySys_GetObject((char*)"stderr");
|
||||||
PySys_SetObject((char*)"stderr", new_stderr);
|
PySys_SetObject((char*)"stderr", new_stderr);
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
|
PySys_SetObject((char*)"stderr", old_stderr);
|
||||||
Py_DECREF(new_stderr);
|
Py_DECREF(new_stderr);
|
||||||
MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
|
MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
|
||||||
SetErrorCode("Can't evaluate the expressions, please check them !!!");
|
SetErrorCode("Can't evaluate the expressions, please check them !!!");
|
||||||
|
@ -295,7 +295,7 @@ def ManageTransactions(theOpeName):
|
|||||||
## Raise an Error, containing the Method_name, if Operation is Failed
|
## Raise an Error, containing the Method_name, if Operation is Failed
|
||||||
## @ingroup l1_geomBuilder_auxiliary
|
## @ingroup l1_geomBuilder_auxiliary
|
||||||
def RaiseIfFailed (Method_name, Operation):
|
def RaiseIfFailed (Method_name, Operation):
|
||||||
if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
|
if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
|
||||||
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
|
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
|
||||||
|
|
||||||
## Return list of variables value from salome notebook
|
## Return list of variables value from salome notebook
|
||||||
@ -2414,7 +2414,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
|||||||
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
|
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
|
||||||
else:
|
else:
|
||||||
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
|
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
|
||||||
RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
|
RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
|
||||||
anObj.SetParameters(Parameters)
|
anObj.SetParameters(Parameters)
|
||||||
self._autoPublish(anObj, theName, "curve")
|
self._autoPublish(anObj, theName, "curve")
|
||||||
return anObj
|
return anObj
|
||||||
|
Loading…
x
Reference in New Issue
Block a user