VTK rendering 2D mesh

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

VTK rendering 2D mesh

mafiaskafia
This post was updated on .
Hello, so i'm trying to render a 2D mesh using vtk (in python). I have a list
of tuples containing all the points and also a list of tuples containing the
points of each cell. Just to experiment, I tried to create a polydata object
of a square with 4 elements and render it, but i ended up with this:

<http://vtk.1045678.n5.nabble.com/file/t342418/helpp.png

I would like it to show the lines connecting the nodes (like a wireframe)
instead of solid square..
This is the code to produce the image above:  code example
<https://pastebin.com/uik9uDQk

I would also like to know if it's possible to have a gridline as the
background of the render window, instead of a black color, just like this:

<http://vtk.1045678.n5.nabble.com/file/t342418/helpaa.png

Thanks in advance!






--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: VTK rendering 2D mesh

kenichiro yoshimi
Hello mafiaskafia,

You can render the wireframe edges of the mesh and set color of them
in the following way.
---
    colors = vtk.vtkNamedColors()

    #Create an actor
    MeshActor = vtk.vtkActor()
    MeshActor.SetMapper(MeshMapper)
    MeshActor.GetProperty().EdgeVisibilityOn()
    MeshActor.GetProperty().SetEdgeColor(colors.GetColor3d("White"))
---

Best

2018-06-18 7:41 GMT+09:00 mafiaskafia <[hidden email]>:

> Hello, so i'm trying to render a 2D mesh using vtk (in python). I have a list
> of tuples containing all the points and also a list of tuples containing the
> points of each cell. Just to experiment, I tried to create a polydata object
> of a square with 4 elements and render it, but i ended up with this:
>
> <http://vtk.1045678.n5.nabble.com/file/t342418/helpp.png>
>
> I would like it to show the lines connecting the nodes (like a wireframe)
> instead of solid square..
> This is the code to produce the image above:  code example
> <https://pastebin.com/uik9uDQk>
>
> I would also like to know if it's possible to have a gridline as the
> background of the render window, instead of a black color, just like this:
>
> <http://vtk.1045678.n5.nabble.com/file/t342418/helpaa.png>
>
>
>
>
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: VTK rendering 2D mesh

mafiaskafia
Thank you, it worked like a charm! Can you also help me render a gridline
behind the mesh like this:

<http://vtk.1045678.n5.nabble.com/file/t342418/halpaa.png>
 I tried looking up on google but couldn't find anything about it..

Cheers



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers