vp.show('data/ring.gmsh', at=3, c=3, wire=1) vp.show('data/images/dog.jpg', at=4) # 2d images can be loaded the same way vp.show('data/shuttle.obj', at=5, c=5) vp.show('data/shapes/man.vtk', at=6, c=6, axes=2) # show negative axes from (0, 0, 0) vp.show('data/teapot.xyz', at=7, c=7, axes=3) # hide negative axes vp.show('data/pulley.vtu', at=8, c=8, interactive=1) ######################################################################################## # Draw the same object with different surface textures # (in vtkplotter/textures, alternatibvely a jpg/png file can be specified) vp = Plotter(shape=(3, 3), verbose=0, axes=0) mat = [ 'aqua', 'gold2', 'metal1', 'ivy', 'paper', 'blue', 'white2', 'wood3', 'wood7' ] for i, mname in enumerate(mat): # mname can be any jpeg file sp = vp.load('data/beethoven.ply', texture=mname) vp.show(sp, at=i, legend=mname) vp.show(interactive=1) ######################################################################################### # Cut a set of shapes with a plane that goes through the # point at x=500 and has normal (0, 0.3, -1). # Wildcards can be used to load multiple files or entire directories: vp = Plotter(title='Cut a surface with a plane') vp.load('data/2*0.vtk', c='orange', bc='aqua') for a in vp.actors: vp.cutPlane(a, origin=(500, 0, 0), normal=(0, 0.3, -1), showcut=True) vp.show()
# Example usage of addTrail() # from vtkplotter import Plotter, sin vp = Plotter(axes=6) s = vp.sphere(c='green', res=24) vp.cutPlane(s, [-0.9, 0, 0], showcut=True) #cut left part of sphere p = vp.point([1, 1, 1], r=12) # add a trail to point p with maximum length 0.5 and 50 segments p.addTrail(c='k', lw=3, maxlength=0.5, n=50) for i in range(200): p.pos([-2 + i / 100., sin(i / 5.) / 15, 0]) vp.render() vp.camera.Azimuth(-0.2) vp.show(resetcam=0)
# Example use of addTrail() and updateTrail() # from vtkplotter import Plotter, sin vp = Plotter(axes=1, interactive=0) c = vp.cube() vp.cutPlane(c, [-0.4, 0, 0]) #cut away the left face s = vp.sphere([1, 1, 1], r=.03, c='db') # add a trail to last created actor with max 50 segments vp.addTrail(c='k', lw=3, maxlength=.5, n=50) for i in range(200): s.pos([-2. + i / 100., sin(i / 5.) / 10., 0]).updateTrail() vp.render() vp.camera.Azimuth(-.3) vp.show(interactive=1)