This page was generated from appendix-webgui/webgui.ipynb.


Webgui is a jupyter-widget for visualizing mesh data, available from project page. It can be easily installed using

pip install webgui_jupyter_widgets

Webgui contains a rendering area, and a simple user interface (which can be opened by clicking on the black rectangle showing 'Open Controls').

You can rotate, move and zoom the object in the rendering area, and click to query properties.

Drawing geometry, meshes and fields:

from netgen.occ import *
from ngsolve import *
from ngsolve.webgui import Draw

Drawing on OCC-shape:

shape = Box( (0,0,0), (5,3,2) )
Draw (shape);

Drawing an NGSolve-mesh:

mesh = Mesh( OCCGeometry(shape).GenerateMesh(maxh=0.5))
Draw (mesh);

Drawing a scalar function on the mesh:

func = x*y*z
Draw (func, mesh);

Setting min-max values:

Draw (x*y*z, mesh, min=5, max=10);


deform = CF( (-0.05*z*x,0,0.05*x*x) )
Draw (mesh, deformation=deform);

print ("use deformation slider:")
Draw (deform, mesh);
use deformation slider:

Clipping planes:

clipping = { "function" : True,  "pnt" : (2.5,1.5,1), "vec" : (0,1,-1) }
Draw (func, mesh, clipping=clipping);

Vector plots

todo ….

Setting gui parameters

all parameters from the gui can be set by their displayed names, for example:

Draw (func, mesh, settings = { "subdivision" : 1, "Colormap" : { "ncolors" : 3 } });
[ ]: