[Paraview] SplineSource and python script

Jérôme jerome.velut at gmail.com
Fri Feb 18 11:50:02 EST 2011


Hi,

It works like a charm! Thank you very much. You are right: I get the
expected error message, but the spline is correctly initialized.

Jerome

2011/2/18 pat marion <pat.marion at kitware.com>:
> Hi Jerome,
>
> It looks like the ParametricFunction property of the SplineSource is not
> python friendly.  I can confirm this bug.  As a workaround, you can do this:
>
> s.ParametricFunction.SetPropertyWithName("Closed", 1)
> s.ParametricFunction.SetPropertyWithName("Points", [x,y,z, x2,y2,z2])
>
> I think paraview will print an error message when you said the Points
> property even though it works.  You'll see an error message that the spline
> must contain at least 1 point.  My guess is that it clears the Points
> property before setting the new value.
>
> Pat
>
> On Fri, Feb 18, 2011 at 5:30 AM, Jérôme <jerome.velut at gmail.com> wrote:
>>
>> Hi,
>> I have some difficulties to have the SplineSource working properly
>> through a python script. First, I created a spline by hand and saved
>> the state as a python file. I simplified it in order to keep only the
>> SplineSource settings (file attached). When I execute this script
>> (ParaView-3.10-RC1), I get the following error :
>>
>> Traceback (most recent call last):
>>  File "<string>", line 6, in <module>
>>  File
>> "/usr/local/lib/paraview-3.10/site-packages/paraview/servermanager.py",
>> line 207, in __setattr__
>>    "to add this attribute.")
>> AttributeError: Attribute Closed does not exist.  This class does not
>> allow addition of new attributes to avoid mistakes due to typos. Use
>> add_attribute() if you really want to add this attribute.
>>
>> When I access the object through python shell, the "Closed" attribute
>> appears in a protected list (which seems to be the right case) :
>> >>>> FindSource("RCA").ParametricFunction.__dict__
>> {'SMProxy': (vtkSMProxy)0x48e25d0, '_Proxy__LastAttrName':
>> 'NewPropertyIterator', '_Proxy__Properties': {'Points': <weakref at
>> 0x4ce6ec0; dead>, 'Closed': <weakref at 0x4ce6158; dead>},
>> 'ObserverTag': -1, 'Observed': None, 'Port': 0}
>>
>> The same error occurs with the "Points" attribute, thus I cannot add
>> points by script : this is what I want to do.
>>
>> Thanks !
>> Jerome
>> _______________________________________________
>> 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