[Paraview] pythonnurbs inside ProgrammableFilter

Oliver Borm oli.borm at web.de
Fri Jan 8 10:52:46 EST 2010


Ok, here the test code:

from pythonnurbs import NurbsPoint

point = NurbsPoint.Point3Dd(100.0,0.0,0.0)

print(point)

print point.getx()


first time output:

<pythonnurbs.NurbsPoint.Point3Dd; proxy of <Swig Object of type
'PlPoint3Dd *' at 0x2d37710> >

100.0


second time output:

<pythonnurbs.NurbsPoint.Point3Dd; proxy of <Swig Object of type
'PlPoint3Dd *' at 0x2d37710> >


Traceback (most recent call last):

File "<string>", line 23, in <module>

File "<string>", line 5, in RequestData

File "/usr/lib64/python2.6/site-packages/pythonnurbs/NurbsPoint.py",
line 104, in getx

def getx(*args): return _NurbsPoint.Point3Dd_getx(*args)

TypeError: in method 'Point3Dd_getx', argument 1 of type
'PLib::Point_nD< double,3 > *'


Well if I do not access the point object, then it seems that all went
fine. But if I want to get any data from the point object, then I get
the error.

Berk Geveci schrieb:
> Sorry, I assumed that you had more than those few lines. OK, this is
> very weird. Can you simply print what
> NurbsPoint.Point3Dd(0.0,0.0,0.0)
> returns the first time and the second time?
>
>
> On Fri, Jan 8, 2010 at 9:49 AM, Oliver Borm <oli.borm at web.de> wrote:
>   
>> Do you mean the source code of pythonnurbs or my test code? Pythonnurbs itself is a python binding of the NURBS++ library using SWIG. This is the whole python code I'm using inside the ProgrammableFilter:
>>
>> from pythonnurbs import NurbsCurve, NurbsPoint
>>
>> curve=NurbsCurve.NurbsCurved()
>> curve.makeCircle(NurbsPoint.Point3Dd(0.0,0.0,0.0), 100.0)
>> u = 0.5
>> print curve.pointAt(u).getx(), curve.pointAt(u).gety(), curve.pointAt(u).getz()
>>
>>
>>
>> Berk Geveci schrieb:
>>     
>>> I am guessing somehow the arguments passed to makeCircle are getting
>>> clobbered. Can you post you Python code?
>>>
>>> -berk
>>>
>>> On Fri, Jan 8, 2010 at 4:12 AM, Oliver Borm <oli.borm at web.de> wrote:
>>>
>>>       
>>>> Hello,
>>>>
>>>> I am using pythonnurbs from http://pypi.python.org/pypi/PythonNURBS in
>>>> conjunction with the python bindings from vtk. As a standalone script it
>>>> works perfectly, but if I want to use it inside paraview with the
>>>> ProgrammableFilter it just works once a time. After that some errors
>>>> occur. Here is a simple python test code:
>>>>
>>>> from pythonnurbs import NurbsCurve, NurbsPoint
>>>> curve=NurbsCurve.NurbsCurved()
>>>> curve.makeCircle(NurbsPoint.Point3Dd(0.0,0.0,0.0), 100.0)
>>>> u = 0.5
>>>> print curve.pointAt(u).getx(), curve.pointAt(u).gety(),
>>>> curve.pointAt(u).getz()
>>>>
>>>> The following output is printed:
>>>>
>>>> -100.0 0.0 0.0
>>>>
>>>>
>>>> If one changes for example:
>>>> u = 0.25
>>>>
>>>> and want to re-execute the ProgrammableFilter again, the following error
>>>> occured
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>> File "<string>", line 23, in <module>
>>>>
>>>> File "<string>", line 5, in RequestData
>>>>
>>>> File "/usr/lib64/python2.6/site-packages/pythonnurbs/NurbsCurve.py",
>>>> line 277, in makeCircle
>>>>
>>>> def makeCircle(*args): return _NurbsCurve.NurbsCurved_makeCircle(*args)
>>>>
>>>> NotImplementedError: Wrong number of arguments for overloaded function
>>>> 'NurbsCurved_makeCircle'.
>>>>
>>>> Possible C/C++ prototypes are:
>>>>
>>>> makeCircle(PLib::NurbsCurve< double,3 > *,PLib::Point_nD< double,3 >
>>>> const &,PLib::Point_nD< double,3 > const &,PLib::Point_nD< double,3 >
>>>> const &,double,double,double)
>>>>
>>>> makeCircle(PLib::NurbsCurve< double,3 > *,PLib::Point_nD< double,3 >
>>>> const &,double,double,double)
>>>>
>>>> makeCircle(PLib::NurbsCurve< double,3 > *,PLib::Point_nD< double,3 >
>>>> const &,double)
>>>>
>>>>
>>>> while running the same code a second time in a normal python shell, the
>>>> output looks like the following:
>>>> 0.0 100.0 0.0
>>>>
>>>> One has to restart paraview and the python code in the
>>>> ProgrammableFilter works as expected (once a time). The error message is
>>>> not very helpful, as it says that this method is not implemented in the
>>>> way I'm using it. But that is not correct. Does anybody has an idea
>>>> what's the real problem? At first one could expect the problem is in
>>>> pythonnurbs (maybe it is, but not in the way the error message says),
>>>> but as the code works once a time, why does it not works twice?
>>>>
>>>> Best regards,
>>>> Oliver Borm
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>>
>>>>         


More information about the ParaView mailing list