[Paraview] Deleting Items in Python
Robert Maynard
RobertJMaynard at gmail.com
Mon Oct 29 09:49:57 EDT 2007
Thanks to everyone that helped me figure out how to delete registered
objects from paraview. The below code is an example on how to properly
delete items from paraview with the python interface. Hopefully this helps
somebody else out, since the current servermanager pdf skipped this problem.
pxm = servermanager.ProxyManager()
view = servermanager.GetRenderView()
object = servermanager.SphereSource(registrationGroup='sources',
registrationName='sphere') #create and register the sphere
display = paraview.servermanager.CreateRepresentation(object, view,
registrationGroup='representations') #register the display of the sphere
pxm.UnRegisterProxy('sources', 'sphere', object) #delete the source
reference to the sphere
pxm.UnRegisterProxy('representations', 'sphere', object) #delete the
representation ref of the sphere (do not pass the display object to this, it
will cause paraview to crash on the next manual source creation)
rep = self.view.Representations #save some typing
size = range(len(rep)) #need to keep track of the length since
.index() is not aviable
#need to delete the view representation copy, or else the sphere will stay
on the render window
for item, index in zip(rep,size):
if (self.display == item):
del rep[index]
del object
del display
On 10/23/07, Milan Frank <milan.frank at gmail.com> wrote:
>
> What would happened if I create the sphere without registration name and
> group?
>
> sphere = servermanager.sources.SphereSource()
>
> What is the correct way to dispose such object?
>
> Thanks,
> Milan.
>
> On 22/10/2007, Robert Maynard <RobertJMaynard at gmail.com> wrote:
> > Where can I find the Displays property, I have been unable to find
> exactly
> > where the property is.
> >
> > On 10/15/07, Utkarsh Ayachit < utkarsh.ayachit at kitware.com> wrote:
> > > Don't forget to unregister the dataDisplay as well, and remove the it
> > > from the view's "Displays" property, otherwise the sphere isn't going
> > > anywhere :).
> > >
> > > Utkarsh
> > >
> > >
> > > Berk Geveci wrote:
> > > > You have to unregister the object from the proxy manager:
> > > >
> > > > pm = servermanager.ProxyManager()
> > > > pm.UnRegisterProxy("sources", "del")
> > > >
> > > > -berk
> > > >
> > > >
> > > > On 10/15/07, *Robert Maynard* < RobertJMaynard at gmail.com
> > > > <mailto:RobertJMaynard at gmail.com>> wrote:
> > > >
> > > > What is the syntax to delete an object that has been created in
> > > > python, and than been registered with ParaView?
> > > >
> > > > For example I create a sphere like this:
> > > > view = servermanager.GetRenderView()
> > > > sphere = servermanager.sources.SphereSource
> > > > (registrationGroup='sources', registrationName='del')
> > > > dataDisplay =
> > servermanager.CreateRepresentation(sphere, view,
> > > > registrationGroup='representations')
> > > >
> > > > Than trying to delete it by using the del command (del sphere,
> etc)
> > > > does not work.
> > > >
> > > > _______________________________________________
> > > > ParaView mailing list
> > > > ParaView at paraview.org <mailto:ParaView at paraview.org>
> > > > http://www.paraview.org/mailman/listinfo/paraview
> > > >
> > > >
> > > >
> > > >
> > ------------------------------------------------------------------------
> > > >
> > > > _______________________________________________
> > > > ParaView mailing list
> > > > ParaView at paraview.org
> > > > http://www.paraview.org/mailman/listinfo/paraview
> > >
> >
> >
> > _______________________________________________
> > ParaView mailing list
> > ParaView at paraview.org
> > http://www.paraview.org/mailman/listinfo/paraview
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20071029/57333d36/attachment.htm
More information about the ParaView
mailing list