def ivtk_scene(actors): from tvtk.tools import ivtk # 创建一个带有Crust(Python shell)的窗口 win = ivtk.IVTKWithCrustAndBrowser() win.open() # 将对象实例置入窗口中 win.scene.add_actor(actors)
def ivtk_scene(actors): from tvtk.tools import ivtk win = ivtk.IVTKWithCrustAndBrowser() # 创建crust窗口 win.open() win.scene.add_actor(actors) dialog = win.control.centralWidget().widget(0).widget(0) # 窗口错误修正 from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() return win
def ivtk_scene(actors): from tvtk.tools import ivtk # 创建一个带Crust(Python Shell)的窗口 win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(actors) # 修正窗口错误 dialog = win.control.centralWidget().widget(0).widget(0) from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() return win
def source1(): s = tvtk.CubeSource(x_length=1.0, y_length=2.0, z_length=3.0) m = tvtk.PolyDataMapper(input_connection=s.output_port) a = tvtk.Actor(mapper=m) #创建一个带Crust(Python Shell)的窗口 gui = GUI() win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(a) #开始界面消息循环 gui.start_event_loop()
def ivtk_scene(actors, *actors2): # 方便使用ivtk来检查我们进行管线的过程 from tvtk.tools import ivtk # 创建一个带Crust(python shell)的窗口 win = ivtk.IVTKWithCrustAndBrowser() win.open() if actors2 != None: win.scene.add_actor(actors) for i in range(len(actors2)): win.scene.add_actor(actors2[i]) else: win.scene.add_actor(actors) # 修正错误,显示出来的图形子窗口不在主窗口内 dialog = win.control.centralWidget().widget(0).widget(0) from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() return win
def test4(self): s = tvtk.CubeSource(x_length=1.0, y_length=2.0, z_length=3.0) m = tvtk.PolyDataMapper(input_connection=s.output_port) a = tvtk.Actor(mapper=m) gui = GUI() # win=ivtk.IVTKWithCrust() # win=ivtk.IVTK() win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(a) dialog = win.control.centralWidget().widget(0).widget(0) from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() gui.start_event_loop()
def ivtk_scene(actors): from .tvtk_brower_patch import patch_pipeline_browser from tvtk.tools import ivtk patch_pipeline_browser() window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600)) window.open() depth_peeling(window.scene) window.scene.add_actors(actors) window.scene.background = 1, 1, 1 # fix problem when run in IPython dialog = window.control.centralWidget().widget(0).widget(0) from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() return window
def main(): gui = GUI() # Create and open an application window. window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600)) window.open() f = Figure(window.scene) # Create an outline. o = Outline() f.add(o) # Create some pretty pictures. #test_lines(f) test_surf(f) window.scene.reset_zoom() # Start the GUI event loop! gui.start_event_loop()
def test7(self): s = tvtk.STLReader(file_name="E:/mesh.stl") # 调用stl文件 m = tvtk.PolyDataMapper(input_connection=s.output_port) a = tvtk.Actor(mapper=m) # win=ivtk.IVTKWithCrust() # win=ivtk.IVTK() win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(a) win.scene.isometric_view() dialog = win.control.centralWidget().widget(0).widget(0) from pyface.qt import QtCore dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000)) dialog.show() gui = GUI() gui.start_event_loop()
from tvtk.api import tvtk from tvtk.tools import ivtk from pyface.api import GUI s = tvtk.CellTypeSource() m = tvtk.PolyDataMapper(input_connection = s.output_port) a = tvtk.Actor(mapper = m) gui = GUI() win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(a) gui.start_event_loop()
from tvtk.tools import ivtk # The actors module has a few helper functions that allow one to # create simple shapes easily. These functions return TVTK Actor # instances. We use it here for convenience. from tvtk.pyface import actors # Create a GUI instance. gui = GUI() # Create and open an IVTK application window that has an embedded TVTK # pipeline browser and an interactive Python interpreter shell via # PyCrust. If you don't want all these you can choose between the # following classes in ivtk -- IVTK, IVTKWithCrust, IVTKWithBrowser # and IVTKWithCrustAndBrowser. window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600)) # Size is optional. # Open the window. window.open() class EarthActor(HasTraits): position = Tuple def __init__(self): earth = actors.earth_actor() earth.property.color = actors.colors.green sphere = actors.sphere_actor(color=actors.colors.blue, opacity=0.65) self.earth, self.sphere = earth, sphere def _position_changed(self, val):
def ivtk_scene(actors): win = ivtk.IVTKWithCrustAndBrowser() win.open() win.scene.add_actor(actors) return win