CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] set slice name with python

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2015, 01:26
Default set slice name with python
  #1
Member
 
sean read
Join Date: Sep 2014
Location: Melbourne, Australia
Posts: 41
Rep Power: 12
seanread is on a distinguished road
So I'm trying to iterate over slices and feature edges, I can do it using

Code:
Sli = Slice( SliceType="Plane" )                                                
                                                                                
Sli.SliceOffsetValues = [0.0]                                                   
                                                                                
Sli.SliceType.Origin = [0, 0, 0]                                                
                                                                                
Sli.SliceType.Normal = [1, 0, 0]                                                
                                                                                
Sli.SliceType = "Plane"                                                         
                                                                                
Sli = FindSource("Slice1")                                                      
                                                                                
SetActiveSource(Sli)                                                            
                                                                                
Integra = IntegrateVariables()                                                  
                                                                                
intData = servermanager.Fetch(Integra)                                          
                                                                                
Area = ns.vtk_to_numpy(intData.GetCellData().GetArray('Area'))[0]               
                                                                                
SetActiveSource(Sli)                                                            
                                                                                
FEdge = FeatureEdges()                                                          
                                                                                
Int = IntegrateVariables()                                                      
                                                                                
InDat = servermanager.Fetch(Int)                                                
                                                                                
Len = ns.vtk_to_numpy(InDat.GetCellData().GetArray('Length'))[0]
setting an iterator for the number in front of Slice in
Code:
Sli = FindSource("Slice1")
But this feels a little clunky, is there a way that I can return and/or alter the name of the slice, for example

Code:
>>>print Sli.returnname()

Slice1
or

Code:
>>> Sli.changename(newname)
or, alternately, to reset the slice counter so that if I have made and deleted say 12 slices already, that I can create a new slice as Slice1

is there such a method that I'm missing somewhere?
seanread is offline   Reply With Quote

Old   October 13, 2015, 05:31
Default
  #2
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi Sean,

To rename a source:
Code:
 RenameSource('TheSlice', Sli)
Regards,
Mikko
Flowkersma is offline   Reply With Quote

Old   October 13, 2015, 08:09
Default
  #3
Member
 
sean read
Join Date: Sep 2014
Location: Melbourne, Australia
Posts: 41
Rep Power: 12
seanread is on a distinguished road
Thanks again Mikko!
seanread is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenVSP: Python API call to set RPM of a disk Brunomrm Main CFD Forum 0 July 30, 2018 14:20
[General] Python Scripting - Set Legend Label Color MTMILLS87 ParaView 0 February 22, 2018 14:20
Ansys Licence Serve on Ubuntu 16.04 LTS david.pasquale ANSYS 2 January 20, 2017 12:52
[OpenFOAM.org] set up python path for python in paraview compiled with openfoam seanread OpenFOAM Installation 7 October 31, 2015 21:20
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06


All times are GMT -4. The time now is 20:05.