Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
Utkarsh, Thanks for that information - I have figured it out now. A few notes for others who are or will in the future follow this subject: The object of this exercise is to write a Programmable Filter that will put up a list of your Cell or Point variables and allow the user to select which ones to process at runtime. Say you wrote a Volume-Average filter which calculates volume-averaged values of variables. Now you can let your user select which variables to average at runtime- this could be helpful in a number of scenarios. 1. You need to include at least one property in your .py file, otherwise the translator is unhappy - you can delete it from your .xml file, though, if you don't really want it (I did!) 2. Make a pretty standard xml plugin .py file and run it through the python_filter_generator to turn your python into an xml plugin 3. The python_filter_generator knows nothing about the variable arrays so it is strictly a manual mod to the .xml file. In order to illustrate this, I have included both the .xml originally produced by the python_filter_generator (test.xml.orig), and the hand edited version where I implemented the Cell variable list and deleted the property which I included only to make the translator happy (test.xml). You can tkdiff these to see exactly what changes were made 3. The original python_filter_generator had a typo of vtkMultiblockDataSet, while this newest revision correctly has vtkMultiBlockDataSet - use the one in your .py file that matches the version of the generator you are using I have run this test filter on can2.exo, a good, simple multi-block dataset that is available to everyone. Screenshots attached Hopefully this will help the next guy. Dennis -Original Message- From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] Sent: Thursday, October 05, 2017 11:59 AM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> Subject: Re: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays Dennis, Here's a example. You need manually modify the XML generated using [1]. I've attached script.xml with my modifications to add a new property for "Arrays". Also attached a state file that demos this filter (load state after lading the script.xml as plugin). Hope that helps. Utkarsh [1] `python python_filter_generator.py script.py script.xml` On Wed, Oct 4, 2017 at 10:11 AM, Utkarsh Ayachit <utkarsh.ayac...@kitware.com> wrote: > Dennis, > > Oops sorry, it slipped my mind you were doing this for programmable > filter. It should be doable, but I'll need to dig -- don't remember of > the top of my head. I'll put it on my plate to put together a small > example for you. > > Utkarsh > > On Wed, Oct 4, 2017 at 7:59 AM, Dennis Conklin > <dennis_conk...@goodyear.com> wrote: >> Utkarsh, >> >> I think you have me confused with a real programmer! ;- ) >> >> I am just trying to write a Programmable Filter in python and I'm lost. >> >> I want to write an xml plugin that will put up a list of all the cell >> variables and let the user select from then and then have the names of those >> variables available in my python script within the Programmable Filter. >> I'm hoping this can be similar to plugins I have written with hardcoded >> variable names where I've used something like: >> >> Properties = dict( >> Sector_Angle = True) >> >> >> def RequestData(): >> >> >>def process_block(block): >> # >> # >> if (Sector_Angle): >> >> Maybe this isn't possible at this low level, but how would I put up the list >> and then what would I have in my RequestData script that I could branch on. >> >> Thanks for your patience. >> >> Dennis >> >> >> -----Original Message- >> From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] >> Sent: Tuesday, October 03, 2017 4:07 PM >> To: Dennis Conklin <dennis_conk...@goodyear.com> >> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> >> Subject: Re: [EXT] Re: [Paraview] Details of XML filter with lists of >> input arrays >> >>> So, after the user chooses some variables, are the chosen variable names in >>> "input_array"? >>> Or does "input_array" contain True or False based on which he chose, in >>> which case where are the corresponding names of the variables? >> >> When user selects variables, he's doing it on the "VolumeArrays" >> property. Thus the selection is provided to the VTK filter via calling the >> command specified on the "VolumeArrays" property. In the case
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
Dennis, Oops sorry, it slipped my mind you were doing this for programmable filter. It should be doable, but I'll need to dig -- don't remember of the top of my head. I'll put it on my plate to put together a small example for you. Utkarsh On Wed, Oct 4, 2017 at 7:59 AM, Dennis Conklin <dennis_conk...@goodyear.com> wrote: > Utkarsh, > > I think you have me confused with a real programmer! ;- ) > > I am just trying to write a Programmable Filter in python and I'm lost. > > I want to write an xml plugin that will put up a list of all the cell > variables and let the user select from then and then have the names of those > variables available in my python script within the Programmable Filter. > I'm hoping this can be similar to plugins I have written with hardcoded > variable names where I've used something like: > > Properties = dict( > Sector_Angle = True) > > > def RequestData(): > > >def process_block(block): > # > # > if (Sector_Angle): > > Maybe this isn't possible at this low level, but how would I put up the list > and then what would I have in my RequestData script that I could branch on. > > Thanks for your patience. > > Dennis > > > -Original Message- > From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] > Sent: Tuesday, October 03, 2017 4:07 PM > To: Dennis Conklin <dennis_conk...@goodyear.com> > Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> > Subject: Re: [EXT] Re: [Paraview] Details of XML filter with lists of input > arrays > >> So, after the user chooses some variables, are the chosen variable names in >> "input_array"? >> Or does "input_array" contain True or False based on which he chose, in >> which case where are the corresponding names of the variables? > > When user selects variables, he's doing it on the "VolumeArrays" > property. Thus the selection is provided to the VTK filter via calling the > command specified on the "VolumeArrays" property. In the case of the > ExtractCTHParts files, this is done via `AddVolumeArrayName` and > `RemoveVolumeArrayNames` API. ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
Utkarsh, I think you have me confused with a real programmer! ;- ) I am just trying to write a Programmable Filter in python and I'm lost. I want to write an xml plugin that will put up a list of all the cell variables and let the user select from then and then have the names of those variables available in my python script within the Programmable Filter.I'm hoping this can be similar to plugins I have written with hardcoded variable names where I've used something like: Properties = dict( Sector_Angle = True) def RequestData(): def process_block(block): # # if (Sector_Angle): Maybe this isn't possible at this low level, but how would I put up the list and then what would I have in my RequestData script that I could branch on. Thanks for your patience. Dennis -Original Message- From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] Sent: Tuesday, October 03, 2017 4:07 PM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> Subject: Re: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays > So, after the user chooses some variables, are the chosen variable names in > "input_array"? > Or does "input_array" contain True or False based on which he chose, in > which case where are the corresponding names of the variables? When user selects variables, he's doing it on the "VolumeArrays" property. Thus the selection is provided to the VTK filter via calling the command specified on the "VolumeArrays" property. In the case of the ExtractCTHParts files, this is done via `AddVolumeArrayName` and `RemoveVolumeArrayNames` API. ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
> So, after the user chooses some variables, are the chosen variable names in > "input_array"? > Or does "input_array" contain True or False based on which he chose, in > which case where are the corresponding names of the variables? When user selects variables, he's doing it on the "VolumeArrays" property. Thus the selection is provided to the VTK filter via calling the command specified on the "VolumeArrays" property. In the case of the ExtractCTHParts files, this is done via `AddVolumeArrayName` and `RemoveVolumeArrayNames` API. ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
Utkarsh, So, for the first example we have: <<<<<<<<<<<<<<<<<<<< I get that the InputTypeDomain links it to cell arrays! - thanks for that. So, after the user chooses some variables, are the chosen variable names in "input_array"? Or does "input_array" contain True or False based on which he chose, in which case where are the corresponding names of the variables? Thanks Dennis -Original Message- From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] Sent: Tuesday, October 03, 2017 2:08 PM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> Subject: Re: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays > To be more exact, I wrote a routine here that does an area-weighted average > of some variables.Now the users are asking if I can give them a list of > variables in the model and they can choose which ones to calculate a weighted > average. There are many filters you can base this on. Here are a few examples: 1. https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fparaview%2Fparaview%2Fblob%2Fmaster%2FParaViewCore%2FServerManager%2FSMApplication%2FResources%2Ffilters.xml%23L2026-2041=01%7C01%7Cdennis_conklin%40goodyear.com%7C2d092bbd37874ba5a79208d50a89a1b9%7C939e896692854a9a9f040887efe8aae0%7C0=QEPymOcagk%2B2VVfYRhBkt1ujub7DJqalAo9cA7YFX%2BU%3D=0 Here the arrays to list is determined by the "InputArrayDomain" element defined on the InputProperty and fixed to cell data. 2. https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fparaview%2Fparaview%2Fblob%2Fmaster%2FParaViewCore%2FServerManager%2FSMApplication%2FResources%2Ffilters.xml%23L13865-13881=01%7C01%7Cdennis_conklin%40goodyear.com%7C2d092bbd37874ba5a79208d50a89a1b9%7C939e896692854a9a9f040887efe8aae0%7C0=YLFBNug7u6HJZo87izm6muSvpMJCzKaFDIYnwcBAp%2B8%3D=0 Here the user can separately select which attribute he/she is interested in using a separate "AttributeMode" property. Utkarsh ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
> To be more exact, I wrote a routine here that does an area-weighted average > of some variables.Now the users are asking if I can give them a list of > variables in the model and they can choose which ones to calculate a weighted > average. There are many filters you can base this on. Here are a few examples: 1. https://gitlab.kitware.com/paraview/paraview/blob/master/ParaViewCore/ServerManager/SMApplication/Resources/filters.xml#L2026-2041 Here the arrays to list is determined by the "InputArrayDomain" element defined on the InputProperty and fixed to cell data. 2. https://gitlab.kitware.com/paraview/paraview/blob/master/ParaViewCore/ServerManager/SMApplication/Resources/filters.xml#L13865-13881 Here the user can separately select which attribute he/she is interested in using a separate "AttributeMode" property. Utkarsh ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
All, To be more exact, I wrote a routine here that does an area-weighted average of some variables.Now the users are asking if I can give them a list of variables in the model and they can choose which ones to calculate a weighted average.I can envision a Custom filter where I have a Programmable filter which processes everything, preceded by a Pass Arrays filter - I could bundle them together and expose the Pass Arrays filter to let them choose which variables they want, but I think the self-contained plug-in which I can add to the site Plugin directory and get automagically loaded at startup is a better way to go if I can just figure out how to do it! Dennis From: Dennis Conklin Sent: Tuesday, October 03, 2017 1:27 PM To: 'Utkarsh Ayachit' <utkarsh.ayac...@kitware.com> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> Subject: RE: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays Utkarsh, I am adding this property on a filter, so it’s input – I want to process some variables and let the user choose which of his variables to process! Thanks Dennis From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] Sent: Tuesday, October 03, 2017 1:24 PM To: Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> Cc: Paraview (paraview@paraview.org<mailto:paraview@paraview.org>) <paraview@paraview.org<mailto:paraview@paraview.org>> Subject: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays WARNING - External email; exercise caution. Dennis, Before I answer the question, I need to know what are you adding this property on? Is this a filter or a reader? The difference is that for a reader, the information about arrays available is provided by the reader itself; while for filter, that information is obtained from its input. Utkarsh On Tue, Oct 3, 2017 at 8:17 AM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: All, I’m confused about how to write an XML plugin that lets the user select input variables for processing. Say I want to put up a list of cell variables and let the user select which ones to process: I see this: https://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Drop_down_list_with_values_from_input_arrays<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.paraview.org%2FWiki%2FParaView%2FPlugin_HowTo%23Drop_down_list_with_values_from_input_arrays=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=LHBX%2FpUEkCJwub%2B4fM8GwOhpy1ScZpK3YlhCarhGgI0%3D=0> but it is not clear to me. My questions include: 1. How do I get Cell variables, point variables or field variables – which is the example, or do we always get all 3? 2. Within my code, how do I know what variables have been selected by the user from the list? Thanks for all for any help. Dennis ___ Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=6Hhfmtf1URd%2BPI9lMQRGucy4NvMpdEBEq7xSsQ9RLh4%3D=0> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=Uw%2BxjRMF3Tr2Ggl6jd2%2BA35Q1u2EAaew3LssSzdJrF8%3D=0> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fparaview.org%2FWiki%2FParaView=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=66kBtB1Yksy2jDf39AjgMmzJJr9aBrvsvdd2O1J4cl4%3D=0> Search the list archives at: http://markmail.org/search/?q=ParaView<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3DParaView=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=RwlSTKL8Vdr2jBzXlJx65NExMP8ZQLCwuAK4L1CWJIM%3D=0> Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fparaview=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=x7Oe6Cg27R6R5sFYo92%2FP9crIibCHvTlmHMXCowAvv0%3D=0> ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on
Re: [Paraview] [EXT] Re: Details of XML filter with lists of input arrays
Utkarsh, I am adding this property on a filter, so it’s input – I want to process some variables and let the user choose which of his variables to process! Thanks Dennis From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] Sent: Tuesday, October 03, 2017 1:24 PM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (paraview@paraview.org) <paraview@paraview.org> Subject: [EXT] Re: [Paraview] Details of XML filter with lists of input arrays WARNING - External email; exercise caution. Dennis, Before I answer the question, I need to know what are you adding this property on? Is this a filter or a reader? The difference is that for a reader, the information about arrays available is provided by the reader itself; while for filter, that information is obtained from its input. Utkarsh On Tue, Oct 3, 2017 at 8:17 AM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: All, I’m confused about how to write an XML plugin that lets the user select input variables for processing. Say I want to put up a list of cell variables and let the user select which ones to process: I see this: https://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Drop_down_list_with_values_from_input_arrays<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.paraview.org%2FWiki%2FParaView%2FPlugin_HowTo%23Drop_down_list_with_values_from_input_arrays=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=LHBX%2FpUEkCJwub%2B4fM8GwOhpy1ScZpK3YlhCarhGgI0%3D=0> but it is not clear to me. My questions include: 1. How do I get Cell variables, point variables or field variables – which is the example, or do we always get all 3? 2. Within my code, how do I know what variables have been selected by the user from the list? Thanks for all for any help. Dennis ___ Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=6Hhfmtf1URd%2BPI9lMQRGucy4NvMpdEBEq7xSsQ9RLh4%3D=0> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=Uw%2BxjRMF3Tr2Ggl6jd2%2BA35Q1u2EAaew3LssSzdJrF8%3D=0> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fparaview.org%2FWiki%2FParaView=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=66kBtB1Yksy2jDf39AjgMmzJJr9aBrvsvdd2O1J4cl4%3D=0> Search the list archives at: http://markmail.org/search/?q=ParaView<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3DParaView=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=RwlSTKL8Vdr2jBzXlJx65NExMP8ZQLCwuAK4L1CWJIM%3D=0> Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fparaview=01%7C01%7Cdennis_conklin%40goodyear.com%7C233074047aa04dd5050e08d50a839b26%7C939e896692854a9a9f040887efe8aae0%7C0=x7Oe6Cg27R6R5sFYo92%2FP9crIibCHvTlmHMXCowAvv0%3D=0> ___ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview