meshmagick.MMviewer module

This module implements a viewer based on VTK.

class meshmagick.MMviewer.MMViewer[source]

Bases: object

This class implements a viewer based on VTK

add_line(p0, p1, color=(0, 0, 0))[source]

Add a line to the viewer

Parameters
  • p0 (array_like) – position of one end point of the line

  • p1 (array_like) – position of a second end point of the line

  • color (array_like, optional) – RGB color of the line. Default is black (0, 0, 0)

Returns

Return type

vtkPolyData

add_plane(center, normal)[source]

Add a plane to the viewer

Parameters
  • center (array_like) – The origin of the plane

  • normal (array_like) – The normal of the plane

add_point(pos, color=(0, 0, 0))[source]

Add a point to the viewer

Parameters
  • pos (array_like) – The point’s position

  • color (array_like, optional) – The RGB color required for the point. Default is (0, 0, 0) corresponding to black.

Returns

Return type

vtkPolyData

add_polydata(polydata, color=(1, 1, 0), representation='surface')[source]

Add a polydata object to the viewer

Parameters
  • polydata (vtkPolyData) – the object to be added

  • color (array_like, optional) – the color of the object. Default is yellow (1, 1, 0)

  • representation (str) – the representation mode of the object (‘surface’ or ‘wireframe’). Default is ‘surface’.

add_vector(point, value, scale=1, color=(0, 0, 0))[source]

Add a vector to the viewer

Parameters
  • point (array_like) – starting point position of the vector

  • value (float) – the magnitude of the vector

  • scale (float, optional) – the scaling to apply to the vector for better visualization. Default is 1.

  • color (array_like) – The color of the vector. Default is black (0, 0, 0)

axes_planes_on()[source]

Displays the Oxy plane

finalize()[source]

Cleanly close the viewer

hide(index)[source]
normals_off()[source]

Hide the normals

normals_on()[source]

Displays the normals

on_key_press(obj, event)[source]

Event trig at keystroke

plane_on()[source]

Displays the Oxy plane

save()[source]

Saves the main object in a ‘mmviewer_save.vtp’ vtp file is the current folder

screenshot()[source]

Saves a screeshot of the current window in a file screenshot.png

show()[source]

Show the viewer

show_axes()[source]

Shows the axes around the main object

show_normals()[source]

Shows the normals of the current objects