<html><head></head><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:16px"><div id="yui_3_16_0_ym18_1_1459239767518_18414"><span>Hey Cory,</span></div><div id="yui_3_16_0_ym18_1_1459239767518_18414"><span><br></span></div><div id="yui_3_16_0_ym18_1_1459239767518_18414">Thank you for your email. I used volume(input) expression for my case and for the sphere from the the sources but again I got an error in both of cases which is AttributeError: 'builtin_function_or_method' object has no attribute 'NewInstance'. See picture attached.</div><div id="yui_3_16_0_ym18_1_1459239767518_18414"><br></div><div id="yui_3_16_0_ym18_1_1459239767518_18414">Regards,</div><div id="yui_3_16_0_ym18_1_1459239767518_18414">Islem </div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: verdana, helvetica, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Le Mardi 29 mars 2016 2h54, Cory Quammen <cory.quammen@kitware.com> a écrit :<br></font></div> <br><br> <div class="y_msg_container">On Sun, Mar 27, 2016 at 7:30 AM, Megdich Islem <<a shape="rect" ymailto="mailto:megdich_islem@yahoo.fr" href="mailto:megdich_islem@yahoo.fr">megdich_islem@yahoo.fr</a>> wrote:<br clear="none">> Hey Cory,<br clear="none">><br clear="none">> Thank you for your email. I tried using the python calculator with the<br clear="none">> expression you gave me but I got error saying that name ''volumes'' doesn't<br clear="none">> exist<br clear="none"><br clear="none">Oops. Try 'volume' instead. Sorry about that.<br clear="none"><br clear="none"> I also used the python annotation filter to calculate the volume of<br clear="none">> oil in a region that I can estimate the real volume but instead of getting<br clear="none">> a scalar, I got a VTK array. I attached pictures that illustrate every<br clear="none">> thing, I also attached a picture of the mesh that I created with salome<br clear="none">> platform.<br clear="none"><br clear="none">Looks like you forgot to sum() the results of alphaoil*volume(input).<br clear="none"><br clear="none">><br clear="none">> Regards,<br clear="none">> Islem<br clear="none">><br clear="none">><br clear="none">> Le Jeudi 24 mars 2016 15h48, Cory Quammen <<a shape="rect" ymailto="mailto:cory.quammen@kitware.com" href="mailto:cory.quammen@kitware.com">cory.quammen@kitware.com</a>> a écrit<br clear="none">> :<br clear="none">><br clear="none">><br clear="none">> Islem,<br clear="none">><br clear="none">> One possibility is that the order of vertices in your grid is somehow<br clear="none">> different than what VTK expects and gives you inverted cells that have<br clear="none">> negative volume. I don't know if this is the case because your<br clear="none">> negative volume is much different from the expected positive volume.<br clear="none">><br clear="none">> Could you try using the Python Calculator to compute the volumes of<br clear="none">> each cell and see if they are all negative? The expression should be<br clear="none">> something like<br clear="none">><br clear="none">> volumes(input)<br clear="none">><br clear="none">> (haven't tested this). This would at least be a first step in<br clear="none">> debugging the problem.<br clear="none">><br clear="none">> HTH,<br clear="none">> Cory<br clear="none">><br clear="none">><br clear="none">> On Mon, Mar 21, 2016 at 8:21 AM, Megdich Islem <<a shape="rect" ymailto="mailto:megdich_islem@yahoo.fr" href="mailto:megdich_islem@yahoo.fr">megdich_islem@yahoo.fr</a>><br clear="none">> wrote:<br clear="none">>> Hi,<br clear="none">>><br clear="none">>> Thank you for your email, I tried this expression<br clear="none">>> sum(alphawater*volume(input)) and it worked fine and gave me some logical<br clear="none">>> results for some shapes that I know their volumes, but for the problem<br clear="none">>> that<br clear="none">>> I am working on, it gave me negative value for the volume. I am supposed<br clear="none">>> to<br clear="none">>> calculate the volume of a quarter of a cylinder with height 0.6 m and<br clear="none">>> radius<br clear="none">>> 0.3 m, so the volume should be V=(0.3*0.3*3.14*0.6)/4=0.04239 cubic meter,<br clear="none">>> but the annotation filter gave me this value -2639.95829243. I attached<br clear="none">>> here two pictures that illustrate the dimensions of the cylinder and the<br clear="none">>> value I got, I couldn't what is wrong.<br clear="none">>><br clear="none">>> Regards,<br clear="none">>> Islem Megdiche<br clear="none">>><br clear="none">>><br clear="none">>> Le Dimanche 20 mars 2016 10h57, Cory Quammen <<a shape="rect" ymailto="mailto:cory.quammen@kitware.com" href="mailto:cory.quammen@kitware.com">cory.quammen@kitware.com</a>> a<br clear="none">>> écrit :<br clear="none">>><br clear="none">>><br clear="none">>> Thanks, Utkarsh.<br clear="none">>><br clear="none">>> Indeed, replacing "alpha.water" with "alphawater" appears to work just<br clear="none">>> fine.<br clear="none">>><br clear="none">>> - Cory<br clear="none">>><br clear="none">>> On Sat, Mar 19, 2016 at 7:23 PM, Utkarsh Ayachit<br clear="none">>> <<a shape="rect" ymailto="mailto:utkarsh.ayachit@kitware.com" href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>> wrote:<br clear="none">>>>> The dot "." in the array name is causing problems. Because it is a<br clear="none">>>>> Python<br clear="none">>>>> expression, the interpreter thinks you are asking for an attribute<br clear="none">>>>> "water"<br clear="none">>>>> from a class or module.<br clear="none">>>><br clear="none">>>> FYI, ParaView uses paraview.make_name_valid()[1] function to sanitize<br clear="none">>>> array names in Python. Any character not a "_" or ASCII letter or<br clear="none">>>> number is simply dropped and if the name beings with a number, then a<br clear="none">>>> 'a' is prefixed.<br clear="none">>>><br clear="none">>>> [1]<br clear="none">>>><br clear="none">>>> <a shape="rect" href="http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/_modules/paraview/__init__.html#make_name_valid" target="_blank">http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/_modules/paraview/__init__.html#make_name_valid</a><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> --<br clear="none">>> Cory Quammen<br clear="none">>> R&D Engineer<br clear="none">>> Kitware, Inc.<div class="yqt7238558116" id="yqtfd80066"><br clear="none">><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">><br clear="none">><br clear="none">><br clear="none">> --<br clear="none">> Cory Quammen<br clear="none">> R&D Engineer<br clear="none">> Kitware, Inc.<br clear="none">><br clear="none">><br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Cory Quammen<br clear="none">R&D Engineer<br clear="none">Kitware, Inc.</div><br><br></div> </div> </div> </div></div></body></html>