Solid sphere in ParaView

Asked by Ricardo Pieralisi

Hello all,

I am trying to plot a cross section in ParaView. But I was able just to plot the surface of the spheres and when I made a cross section the spheres were hollow.

There is a way to plot solid spheres?

Thank you,
Ricardo.

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Ricardo,
do you need the section through spheres? if not, one solution is to create
firstly the section and then apply sphere glyph to that section. Then whole
spheres are visible.
cheers
Jan

2013/12/13 Ricardo Pieralisi <email address hidden>

> New question #240738 on Yade:
> https://answers.launchpad.net/yade/+question/240738
>
> Hello all,
>
> I am trying to plot a cross section in ParaView. But I was able just to
> plot the surface of the spheres and when I made a cross section the spheres
> were hollow.
>
> There is a way to plot solid spheres?
>
> Thank you,
> Ricardo.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Ricardo Pieralisi (ricpieralisi) said :
#2

No, I need the section through spheres. For example the cross section of the middle of a sphere.

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#3

My impression is that it is not possible with paraview, but better ask on paraview forum if you need experts answers.

Revision history for this message
Jan Stránský (honzik) said :
#4

Hi Ricardo,

just now I need this feature and found out a workaround. If you make a
"clip" in paraview, you can see inside the cliced spheres. To make them
"solid", do the following by external script/program:
- define a cutting plane
- iterate over spheres and choose spheres that are cut by the plane
- compute projection of the spheres center on the plane
- compute section circles radii (section circles = circles cut by the
cutting plane from the spheres)
- export the projected center, section circle radius and plane normal to a
new vtk file
- in paraview, cut spheres in ordinary way (now you can sse inside them)
- load the new file with circle and create cylinder glyph, defining very
low height (visually equal to planar circles)
- now the section seems as the spheres were solid :-)

do you (or other people) stiil need this feature? if so, I can post my
script (after sme cleanup and documentation) that does the conversion.
cheers
Jan

2013-12-16 20:46 GMT+01:00 Bruno Chareyre <
<email address hidden>>:

> Question #240738 on Yade changed:
> https://answers.launchpad.net/yade/+question/240738
>
> Bruno Chareyre proposed the following answer:
> My impression is that it is not possible with paraview, but better ask
> on paraview forum if you need experts answers.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#5

@Jan
It sounds interesting. I know people who would use that already.

Besides, paraview can be commanded in python it seems. Does anyone have an idea how it works anf if we could generate images that way in yade without actually using paraview's gui?

Revision history for this message
Ricardo Pieralisi (ricpieralisi) said :
#6

@Jan
Nice! I made a little code to draw the cross section (voxelized) in python, but its very time consuming and the results is not so perfect..

So, if you can help with this feature I would be very gratefull!

thank you,
Ricardo.

Revision history for this message
Jan Stránský (honzik) said :
#7

Hi Bruno,

I tried python scripting in Paraview, it is nice feature especially if you
do some sequences of commands regularly or for many simulations the same
commands. Instead of clicking in paraview, you type equivalent commands
into python script. The script is executed from paraview. So you do not
avoid using paraview, but you can avoid time consuming clicking.

I described the way I used python scripts in paraview and don't know if
there are other ways.

cheers
Jan

2014-02-17 11:31 GMT+01:00 Bruno Chareyre <
<email address hidden>>:

> Question #240738 on Yade changed:
> https://answers.launchpad.net/yade/+question/240738
>
> Bruno Chareyre posted a new comment:
> @Jan
> It sounds interesting. I know people who would use that already.
>
> Besides, paraview can be commanded in python it seems. Does anyone have
> an idea how it works anf if we could generate images that way in yade
> without actually using paraview's gui?
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Jan Stránský (honzik) said :
#8

Ok, based on Bruno's and Ricardo's answer, I will post the script. It
should be finished in a few days/weeks
cheers
Jan

2014-02-17 12:16 GMT+01:00 Ricardo Pieralisi <
<email address hidden>>:

> Question #240738 on Yade changed:
> https://answers.launchpad.net/yade/+question/240738
>
> Ricardo Pieralisi posted a new comment:
> @Jan
> Nice! I made a little code to draw the cross section (voxelized) in
> python, but its very time consuming and the results is not so perfect..
>
> So, if you can help with this feature I would be very gratefull!
>
> thank you,
> Ricardo.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Anton Gladky (gladky-anton) said :
#9

Hi Jan,

2014-02-17 12:46 GMT+01:00 Jan Stránský <
<email address hidden>>:

> Ok, based on Bruno's and Ricardo's answer, I will post the script. It
> should be finished in a few days/weeks
>

just a side remark. You want to скуфеу create a Yade-Script and include
paraview-python scopes there?

I think, it will be a good decision.

Anton

Revision history for this message
Jan Stránský (honzik) said :
#10

Hi Anton,

> just a side remark. You want to скуфеу create a Yade-Script and include
> paraview-python scopes there?
>
> I think, it will be a good decision.
>

it could be a solution, but I don't know how to do it :-) my idea is to
save spheres with export.text and use a function to convert this file into
vtk file containing spheres and into vtk file containing section through
spheres. Then user can open those files in paraview. It can be improved in
the future.

Jan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#11

I just tried "save as -> *.py" in paraview. The result looks like a regular python script starting with soome imported paraview lib. My guess is it can be executed without paraview but it will need a bit more efforts (atm I am getting the error below).

>>> execfile('paraview.py')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "paraview.py", line 2, in <module>
    except: from paraview.simple import *
  File "paraview.py", line 2, in <module>
    except: from paraview.simple import *
ImportError: No module named simple

Revision history for this message
Jan Stránský (honzik) said :
#12

Hi Bruno, thanks, save as -> *.py seems to be very useful :-) even if it
needs to be executed from paraview..
Jan

2014-02-17 13:56 GMT+01:00 Bruno Chareyre <
<email address hidden>>:

> Question #240738 on Yade changed:
> https://answers.launchpad.net/yade/+question/240738
>
> Bruno Chareyre posted a new comment:
> I just tried "save as -> *.py" in paraview. The result looks like a
> regular python script starting with soome imported paraview lib. My
> guess is it can be executed without paraview but it will need a bit more
> efforts (atm I am getting the error below).
>
> >>> execfile('paraview.py')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "paraview.py", line 2, in <module>
> except: from paraview.simple import *
> File "paraview.py", line 2, in <module>
> except: from paraview.simple import *
> ImportError: No module named simple
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#13

Good news. "save as -> *.py" works like a charm and generate a 3D image without the gui. The dumb mistake was to save my script with name "paraview.py". Obviously not a good idea since python is trying to import it instead of the system wide paraview lib.

B

Revision history for this message
Jan Stránský (honzik) said :
#14

available in [1], see yade/examples/test/paraview-spheres-solid-section
cheers
Jan

[1]
https://github.com/yade/trunk/commit/dce24d82f52943ac2505ad0535fb15f26e26dfd8

2014-02-17 16:56 GMT+01:00 Bruno Chareyre <
<email address hidden>>:

> Question #240738 on Yade changed:
> https://answers.launchpad.net/yade/+question/240738
>
> Bruno Chareyre proposed the following answer:
> Good news. "save as -> *.py" works like a charm and generate a 3D image
> without the gui. The dumb mistake was to save my script with name
> "paraview.py". Obviously not a good idea since python is trying to
> import it instead of the system wide paraview lib.
>
> B
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Klaus Thoeni (klaus.thoeni) said :
#15

Hi guys,

> Besides, paraview can be commanded in python it seems. Does anyone have
> an idea how it works anf if we could generate images that way in yade
> without actually using paraview's gui?

I tried it once but the python script was rather awful. I used the
"Tools>Start Trace" function to record my activities in Praview as a python
script.

Just another thought, you could use mayavi [1]. I think it could be a quick
alternative to Paraview for this kind of things. It works the same way as
matplotlib so you don't have to deal with the cryptic paraview
names/variables. I used it once for some other stuff and I was really happy
with it.

Cheers
Klaus

[1] http://docs.enthought.com/mayavi/mayavi/index.html

Can you help with this problem?

Provide an answer of your own, or ask Ricardo Pieralisi for more information if necessary.

To post a message you must log in.