示例#1
0
    def init_plot(self):
        # create a window with 14 plots (7 rows x 2 columns)
        ## create a window with 8 plots (4 rows x 2 columns)

        reader = tvtk.OBJReader()
        reader.file_name = self.mayavi_view.filename
        mapper = tvtk.PolyDataMapper()
        mapper.input = reader.output
        actor = tvtk.Actor()
        mapper.color_mode = 0x000000
        actor.mapper = mapper
        actor.orientation = (180,0,90)
        self.scene.add_actor(actor)

        mlab.points3d(11.5, -1.3, -14)
        mlab.points3d(-6.6, -1.3, -13.5)
        mlab.points3d(3,-2,2)
        mlab.points3d(2, 9.5, -9.5)
        self.arrows = mlab.quiver3d(self.tail_data[:,0], self.tail_data[:,1], self.tail_data[:,2],
                        self.head_data[:,0], self.head_data[:,1], self.head_data[:,2], scale_mode='vector', scale_factor=1.0)
        self.dots = mlab.points3d(self.tail_data[:,0], self.tail_data[:,1], self.tail_data[:,2],
        color=(1,1,0),opacity=0.5,scale_mode='vector', scale_factor=1.0)
        self.ar = self.arrows.mlab_source
        self.dot_source = self.dots.mlab_source
        '''
示例#2
0
 def __init__(self):
     HasTraits.__init__(self)
     # Create some data, and plot it using the embedded scene's engine
     reader = tvtk.OBJReader()
     reader.file_name = "C:\\Users\\amcmorl\\Desktop\\Head\\Head.obj"
     mapper = tvtk.PolyDataMapper()
     mapper.input = reader.output
     actor = tvtk.Actor()
     actor.mapper = mapper
     self.scene.add_actor(actor)
示例#3
0
 def __reader_dict_default(self):
     """Default value for reader dict."""
     rd = {'stl':tvtk.STLReader(),
          'stla':tvtk.STLReader(),
          'stlb':tvtk.STLReader(),
          'txt':tvtk.SimplePointsReader(),
          'raw':tvtk.ParticleReader(),
          'ply':tvtk.PLYReader(),
          'pdb':tvtk.PDBReader(),
          'slc':tvtk.SLCReader(),
          'xyz':tvtk.XYZMolReader(),
          'obj':tvtk.OBJReader(),
          'facet':tvtk.FacetReader(),
          'cube':tvtk.GaussianCubeReader(),
          'g':tvtk.BYUReader(),
         }
     return rd
示例#4
0
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 19 21:13:18 2020

@author: lenovouser
"""

from tvtk.api import tvtk
from tvtkfunc import ivtk_scene, event_loop
s = tvtk.OBJReader(file_name='arm.obj')
m = tvtk.PolyDataMapper(input_connection=s.output_port)
a = tvtk.Actor(mapper=m)
win = ivtk_scene(a)
win.scene.isometric_view()
event_loop()