本文整理汇总了Python中vtk.vtkExtractEdges函数的典型用法代码示例。如果您正苦于以下问题:Python vtkExtractEdges函数的具体用法?Python vtkExtractEdges怎么用?Python vtkExtractEdges使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkExtractEdges函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: render
def render(self, pointsData, scalarsArray, radiusArray, nspecies, colouringOptions, atomScaleFactor, lut):
"""
Render the given antisites (wire frame).
"""
self._logger.debug("Rendering antisites: colour by '%s'", colouringOptions.colourBy)
# points
points = vtk.vtkPoints()
points.SetData(pointsData.getVTK())
# poly data
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.GetPointData().AddArray(scalarsArray.getVTK())
polydata.GetPointData().SetScalars(radiusArray.getVTK())
# source
cubeSource = vtk.vtkCubeSource()
edges = vtk.vtkExtractEdges()
edges.SetInputConnection(cubeSource.GetOutputPort())
glyphSource = vtk.vtkTubeFilter()
glyphSource.SetInputConnection(edges.GetOutputPort())
glyphSource.SetRadius(0.05)
glyphSource.SetVaryRadius(0)
glyphSource.SetNumberOfSides(5)
glyphSource.UseDefaultNormalOn()
glyphSource.SetDefaultNormal(0.577, 0.577, 0.577)
# glyph
glyph = vtk.vtkGlyph3D()
if vtk.vtkVersion.GetVTKMajorVersion() <= 5:
glyph.SetSource(glyphSource.GetOutput())
glyph.SetInput(polydata)
else:
glyph.SetSourceConnection(glyphSource.GetOutputPort())
glyph.SetInputData(polydata)
glyph.SetScaleFactor(atomScaleFactor * 2.0)
glyph.SetScaleModeToScaleByScalar()
glyph.ClampingOff()
# mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(glyph.GetOutputPort())
mapper.SetLookupTable(lut)
mapper.SetScalarModeToUsePointFieldData()
mapper.SelectColorArray("colours")
utils.setMapperScalarRange(mapper, colouringOptions, nspecies)
# actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# store attributes
self._actor = utils.ActorObject(actor)
self._data["Points"] = pointsData
self._data["Scalars"] = scalarsArray
self._data["Radius"] = radiusArray
self._data["LUT"] = lut
self._data["Scale factor"] = atomScaleFactor
开发者ID:chrisdjscott,项目名称:Atoman,代码行数:60,代码来源:antisiteRenderer.py
示例2: make_sphere
def make_sphere():
global renderer
# ---------------------------------------------------------------
# The following code is identical to render_demo.py...
# ---------------------------------------------------------------
# create a sphere
sphere_src = vtk.vtkSphereSource()
sphere_src.SetRadius(1.0)
sphere_src.SetCenter(0.0, 0.0, 0.0)
sphere_src.SetThetaResolution(20)
sphere_src.SetPhiResolution(20)
# extract the edges
edge_extractor = vtk.vtkExtractEdges()
edge_extractor.SetInputConnection(sphere_src.GetOutputPort())
# map sphere and edges separately
sphere_mapper = vtk.vtkPolyDataMapper()
sphere_mapper.SetInputConnection(sphere_src.GetOutputPort())
edge_mapper = vtk.vtkPolyDataMapper()
edge_mapper.SetInputConnection(edge_extractor.GetOutputPort())
# define different rendering styles for sphere and edges
sphere_actor = vtk.vtkActor()
sphere_actor.SetMapper(sphere_mapper)
sphere_actor.GetProperty().SetColor(1, 0.5, 0)
edge_actor = vtk.vtkActor()
edge_actor.SetMapper(edge_mapper)
edge_actor.GetProperty().SetColor(0, 0.5, 0)
edge_actor.GetProperty().SetLineWidth(3)
# add resulting primitives to renderer
renderer.AddActor(sphere_actor)
renderer.AddActor(edge_actor)
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:30,代码来源:interactor_demo.py
示例3: __init__
def __init__(self, pos, radius, rgb=[0.62, 0, 0.77]):
self.source = vtk.vtkCubeSource()
self.mapper = vtk.vtkPolyDataMapper()
# length of sides
self.source.SetXLength(radius)
self.source.SetYLength(radius)
self.source.SetZLength(radius)
# centre
self.source.SetCenter(pos)
# edges filter
edges = vtk.vtkExtractEdges()
edges.SetInputConnection(self.source.GetOutputPort())
# tube filter
tubes = vtk.vtkTubeFilter()
tubes.SetInputConnection(edges.GetOutputPort())
tubes.SetRadius(0.15)
tubes.SetNumberOfSides(5)
tubes.UseDefaultNormalOn()
tubes.SetDefaultNormal(.577, .577, .577)
# mapper
self.mapper.SetInputConnection(tubes.GetOutputPort())
# actor
self.SetMapper(self.mapper)
self.GetProperty().SetColor(rgb)
开发者ID:brunoduran,项目名称:Atoman,代码行数:30,代码来源:highlight.py
示例4: __init__
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkExtractEdges(), 'Processing.',
('vtkDataSet',), ('vtkPolyData',),
replaceDoc=True,
inputFunctions=None, outputFunctions=None)
开发者ID:fvpolpeta,项目名称:devide,代码行数:7,代码来源:vtkExtractEdges.py
示例5: __init__
def __init__(self, **kwargs):
self.hull = vtk.vtkHull()
self.poly_data = vtk.vtkPolyData()
self.extractor = vtk.vtkExtractEdges()
self.extractor.SetInput(self.poly_data)
self.mapper = vtk.vtkPolyDataMapper()
self.mapper.SetInputConnection(self.extractor.GetOutputPort())
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self._process_kwargs(**kwargs)
开发者ID:gbaydin,项目名称:autodiff,代码行数:10,代码来源:troupe.py
示例6: get_edges
def get_edges(self):
edges = vtk.vtkExtractEdges()
edges.SetInput(self.grid)
self.edgeMapper.SetInput(edges.GetOutput())
self.edgeActor.SetMapper(self.edgeMapper)
self.edgeActor.GetProperty().SetColor(0, 0, 0)
prop = self.edgeActor.GetProperty()
self.edgeActor.SetVisibility(self.is_edges)
self.rend.AddActor(self.edgeActor)
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:11,代码来源:pan.py
示例7: compute_info_mesh
def compute_info_mesh(mesh):
vertices= mesh.GetNumberOfPoints()
triangles= mesh.GetNumberOfCells()
extractEdges = vtk.vtkExtractEdges()
extractEdges.SetInputData(mesh)
extractEdges.Update()
lines=extractEdges.GetOutput()
edges=lines.GetNumberOfCells()
print "triangles: ",triangles
print "vertices: ",vertices
print "edges: ",edges
return vertices,triangles
开发者ID:rogertrullo,项目名称:Surface_Segmentation,代码行数:13,代码来源:Surface_Utilities.py
示例8: vtkpoints
def vtkpoints(points, color=None, radius=None):
# Create a polydata with the points we just created.
profile = vtk.vtkPolyData()
profile.SetPoints(points)
# Perform a 2D Delaunay triangulation on them.
delny = vtk.vtkDelaunay2D()
delny.SetInput(profile)
delny.SetTolerance(0.001)
mapMesh = vtk.vtkPolyDataMapper()
mapMesh.SetInputConnection(delny.GetOutputPort())
meshActor = vtk.vtkActor()
meshActor.SetMapper(mapMesh)
meshActor.GetProperty().SetColor(0.1, 0.2, 0.1)
# We will now create a nice looking mesh by wrapping the edges in tubes,
# and putting fat spheres at the points.
extract = vtk.vtkExtractEdges()
extract.SetInputConnection(delny.GetOutputPort())
ball = vtk.vtkSphereSource()
if radius == None:
rad = 0.002
else:
rad = radius
print rad
ball.SetRadius(rad)
ball.SetThetaResolution(50)
ball.SetPhiResolution(5)
balls = vtk.vtkGlyph3D()
balls.SetInputConnection(delny.GetOutputPort())
balls.SetSourceConnection(ball.GetOutputPort())
mapBalls = vtk.vtkPolyDataMapper()
mapBalls.SetInputConnection(balls.GetOutputPort())
ballActor = vtk.vtkActor()
ballActor.SetMapper(mapBalls)
if color == None:
ballcolor = red
else:
ballcolor = color
print "setting ball color to...", ballcolor
ballActor.GetProperty().SetColor(ballcolor)
ballActor.GetProperty().SetSpecularColor(0, 0, 0)
ballActor.GetProperty().SetSpecular(0.3)
ballActor.GetProperty().SetSpecularPower(500)
ballActor.GetProperty().SetAmbient(0.2)
ballActor.GetProperty().SetDiffuse(0.8)
return ballActor, profile
开发者ID:neurodebian,项目名称:pymeg,代码行数:49,代码来源:plotvtk.py
示例9: CreateWirePolyData
def CreateWirePolyData(self):
'''
@rtype: None
'''
if self.getWirePolyData():
return
if not self.GetPolyData():
return
extractor = vtk.vtkExtractEdges()
extractor.SetInput(self.GetPolyData())
extractor.Update()
self.setWirePolyData(extractor.GetOutput())
# del extractor
self.Modified()
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:16,代码来源:vtkPythonMetaSurfaceMesh.py
示例10: unstructedGridToWireframe
def unstructedGridToWireframe(grid,bkgdColor=[255,255,255],color=[0,0,0],renderer=None):
"""Extracts mesh as wireframe plot from unstructured grid and adds it to renderer.
.. note:: Will create new renderer if none is given.
Keyword Args:
fnVTK (str): Path to input vtk file.
bkgdColor (list): Background color in RGB values.
color (list): Color of mesh in RGB values.
renderer (vtk.vtkRenderer): Some renderer.
Returns:
vtk.vtkRenderer: Renderer object.
"""
#Extract Edges
edges=vtk.vtkExtractEdges()
edges.SetInput(grid)
#Make edges into tubes
tubes = vtk.vtkTubeFilter()
tubes.SetInput(edges.GetOutput())
tubes.SetRadius(0.5)
tubes.SetNumberOfSides(3)
#Genereate wireframe mapper
wireFrameMapper=vtk.vtkPolyDataMapper()
wireFrameMapper.SetInput(tubes.GetOutput())
wireFrameMapper.SetScalarVisibility(0)
#Make Actor
wireFrameActor=vtk.vtkActor()
wireFrameActor.SetMapper(wireFrameMapper)
wireFrameActor.GetProperty().SetColor(color[0],color[1],color[2])
wireFrameActor.SetPickable(0)
#Create the Renderer
if renderer==None:
renderer = vtk.vtkRenderer()
# Add to renderer
renderer.AddActor(wireFrameActor)
renderer.SetBackground(bkgdColor[0], bkgdColor[1], bkgdColor[2])
return renderer
开发者ID:alexblaessle,项目名称:PyFRAP,代码行数:47,代码来源:pyfrp_vtk_module.py
示例11: taubin_smooth
def taubin_smooth(poly, l, m, steps):
edgesfilter = vtk.vtkExtractEdges()
edgesfilter.SetInput(poly)
edgesfilter.Update()
edges = edgesfilter.GetOutput()
new_poly = vtk.vtkPolyData()
new_poly.DeepCopy(poly)
print edges.GetNumberOfPoints()
print poly.GetNumberOfPoints()
points = new_poly.GetPoints()
for s in xrange(steps):
D = {}
for i in xrange(edges.GetNumberOfPoints()):
D[i] = calculate_d(edges, new_poly, i)
for i in xrange(poly.GetNumberOfPoints()):
p = np.array(points.GetPoint(i))
pl = p + l*D[i]
nx, ny, nz = pl
points.SetPoint(i, nx, ny, nz)
D = {}
for i in xrange(edges.GetNumberOfPoints()):
D[i] = calculate_d(edges, new_poly, i)
for i in xrange(poly.GetNumberOfPoints()):
p = np.array(points.GetPoint(i))
pl = p + m*D[i]
nx, ny, nz = pl
points.SetPoint(i, nx, ny, nz)
#D = {}
#for i in xrange(edges.GetNumberOfPoints()):
#D[i] = calculate_d(edges, i)
#for i in xrange(poly.GetNumberOfPoints()):
#x, y, z = points.GetPoint(i)
#nx = x + m*D[i][0]
#ny = y + m*D[i][1]
#nz = z + m*D[i][2]
#points.SetPoint(i, nx, ny, nz)
#new_poly.SetPoints(points)
return new_poly
开发者ID:tfmoraes,项目名称:diffgeom,代码行数:45,代码来源:taubin.py
示例12: getEdges
def getEdges(self):
edges = vtk.vtkExtractEdges()
edges.SetInput(self.grid)
self.edgeMapper = vtk.vtkPolyDataMapper()
self.edgeMapper.SetInput(edges.GetOutput())
#self.edgeMapper.EdgeVisibilityOff()
self.edgeActor = vtk.vtkActor()
self.edgeActor.SetMapper(self.edgeMapper)
self.edgeActor.GetProperty().SetColor(0, 0, 0)
prop = self.edgeActor.GetProperty()
#prop.SetLineWidth(0.0)
if self.isEdges:
prop.EdgeVisibilityOn()
else:
prop.EdgeVisibilityOff()
self.rend.AddActor(self.edgeActor)
vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset()
print "visible = ", prop.GetEdgeVisibility()
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:21,代码来源:demoGui.py
示例13: Edges
def Edges(cm,
cl=khaki):
Edges = vtk.vtkExtractEdges()
Edges.SetInputConnection(cm.GetOutputPort())
Tubes = vtk.vtkTubeFilter()
Tubes.SetInputConnection(Edges.GetOutputPort())
Tubes.SetRadius(.01)
Tubes.SetNumberOfSides(6)
Tubes.UseDefaultNormalOn()
Tubes.SetDefaultNormal(.577, .577, .577)
# Create the mapper and actor to display the cube edges.
TubeMapper = vtk.vtkPolyDataMapper()
TubeMapper.SetInputConnection(Tubes.GetOutputPort())
CubeEdges = vtk.vtkActor()
CubeEdges.SetMapper(TubeMapper)
CubeEdges.GetProperty().SetDiffuseColor(cl)
CubeEdges.GetProperty().SetSpecular(.4)
CubeEdges.GetProperty().SetSpecularPower(10)
return CubeEdges
开发者ID:bnikolic,项目名称:oof,代码行数:21,代码来源:threedimturbulence.py
示例14: getEdges
def getEdges(self):
edges = vtk.vtkExtractEdges()
edges.SetInput(self.grid)
self.edgeMapper = vtk.vtkPolyDataMapper()
self.edgeMapper.SetInput(edges.GetOutput())
#edges.GetOutput().ReleaseDataFlagOn()
#self.edgeMapper.EdgeVisibilityOff()
self.edgeActor = vtk.vtkActor()
self.edgeActor.SetMapper(self.edgeMapper)
self.edgeActor.GetProperty().SetColor(0, 0, 0)
prop = self.edgeActor.GetProperty()
#prop.SetLineWidth(0.0)
if self.isEdges:
prop.EdgeVisibilityOn()
else:
prop.EdgeVisibilityOff()
self.rend.AddActor(self.edgeActor)
print("visible = %s" % (prop.GetEdgeVisibility()))
开发者ID:xirxa,项目名称:pynastran-locr,代码行数:22,代码来源:guiPanel.py
示例15: make_cubeActor
def make_cubeActor (lattice, radius=0.1):
CubeModel = vtk.vtkCubeSource()
CubeModel.SetXLength(lattice[0])
CubeModel.SetYLength(lattice[1])
CubeModel.SetZLength(lattice[2])
CubeModel.SetCenter(.5*lattice[0], .5*lattice[1], .5*lattice[2])
Edges = vtk.vtkExtractEdges()
Edges.SetInput(CubeModel.GetOutput())
Tubes = vtk.vtkTubeFilter()
Tubes.SetInput(Edges.GetOutput())
Tubes.SetRadius(radius)
Tubes.SetNumberOfSides(6)
Tubes.UseDefaultNormalOn()
Tubes.SetDefaultNormal(.577, .577, .577)
# Create the mapper and actor to display the cube edges.
TubeMapper = vtk.vtkPolyDataMapper()
TubeMapper.SetInput(Tubes.GetOutput())
CubeEdges = vtk.vtkActor()
CubeEdges.SetMapper(TubeMapper)
CubeEdges.GetProperty().SetDiffuseColor(khaki)
CubeEdges.GetProperty().SetSpecular(.4)
CubeEdges.GetProperty().SetSpecularPower(10)
#ren.AddActor(CubeEdges)
return(CubeEdges)
开发者ID:kichiki,项目名称:stokes,代码行数:24,代码来源:ryuon_vtk.py
示例16: get_vtk_edges
def get_vtk_edges(vtkdata):
"""
Get mesh edges.
Parameters
----------
vtkdata : VTK object
Mesh, scalar, vector and tensor data.
Returns
-------
edges : VTK object
Mesh, scalar, vector and tensor data.
"""
edges = vtk.vtkExtractEdges()
if vtk_version < 6:
edges.SetInput(vtkdata)
else:
edges.SetInputData(vtkdata)
edges.Update()
return edges.GetOutput()
开发者ID:Gkdnz,项目名称:sfepy,代码行数:24,代码来源:utils_vtk.py
示例17: vtksetup
def vtksetup(points, color=None, radius=None):
# Create a polydata with the points we just created.
profile = vtk.vtkPolyData()
profile.SetPoints(points)
# Perform a 2D Delaunay triangulation on them.
delny = vtk.vtkDelaunay2D()
delny.SetInput(profile)
delny.SetTolerance(0.001)
mapMesh = vtk.vtkPolyDataMapper()
mapMesh.SetInputConnection(delny.GetOutputPort())
meshActor = vtk.vtkActor()
meshActor.SetMapper(mapMesh)
meshActor.GetProperty().SetColor(.1, .2, .1)
# Construct the surface and create isosurface.
#surf = vtk.vtkSurfaceReconstructionFilter()
#surf.SetInput(pointSource.GetPolyDataOutput())
cf = vtk.vtkPolyData()
#cf = vtk.vtkContourFilter()
cf.SetPoints(points)
#cf.SetInput(surf.GetOutput())
#cf.SetValue(0, 0.0)
## map = vtk.vtkPolyDataMapper()
## map.SetInput(reverse.GetOutput())
## map.ScalarVisibilityOff()
surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(map)
surfaceActor.GetProperty().SetDiffuseColor(1.0000, 0.3882, 0.2784)
surfaceActor.GetProperty().SetSpecularColor(1, 1, 1)
surfaceActor.GetProperty().SetSpecular(.4)
surfaceActor.GetProperty().SetSpecularPower(50)
# We will now create a nice looking mesh by wrapping the edges in tubes,
# and putting fat spheres at the points.
extract = vtk.vtkExtractEdges()
extract.SetInputConnection(delny.GetOutputPort())
ball = vtk.vtkSphereSource()
if radius == None:
rad = .002
else:
rad = radius
ball.SetRadius(rad)
ball.SetThetaResolution(5)
ball.SetPhiResolution(5)
balls = vtk.vtkGlyph3D()
balls.SetInputConnection(delny.GetOutputPort())
balls.SetSourceConnection(ball.GetOutputPort())
mapBalls = vtk.vtkPolyDataMapper()
mapBalls.SetInputConnection(balls.GetOutputPort())
ballActor = vtk.vtkActor()
ballActor.SetMapper(mapBalls)
if color == None:
ballcolor = red
else:
ballcolor = color
ballActor.GetProperty().SetColor(ballcolor)
ballActor.GetProperty().SetSpecularColor(0, 0, 0)
ballActor.GetProperty().SetSpecular(0.3)
ballActor.GetProperty().SetSpecularPower(100)
ballActor.GetProperty().SetAmbient(0.2)
ballActor.GetProperty().SetDiffuse(0.8)
return ballActor
开发者ID:badbytes,项目名称:pymeg,代码行数:69,代码来源:plotvtksurface.py
示例18:
import vtk, os, sys
from vtk.test import Testing
ss = vtk.vtkSphereSource() #make mesh to test with
af = vtk.vtkElevationFilter() #add some attributes
af.SetInputConnection(ss.GetOutputPort())
ef = vtk.vtkExtractEdges() #make lines to test
ef.SetInputConnection(af.GetOutputPort())
gf = vtk.vtkGlyph3D() #make verts to test
pts = vtk.vtkPoints()
pts.InsertNextPoint(0,0,0)
verts = vtk.vtkCellArray()
avert = vtk.vtkVertex()
avert.GetPointIds().SetId(0, 0)
verts.InsertNextCell(avert)
onevertglyph = vtk.vtkPolyData()
onevertglyph.SetPoints(pts)
onevertglyph.SetVerts(verts)
gf.SetSourceData(onevertglyph)
gf.SetInputConnection(af.GetOutputPort())
testwrites = ["points","lines","mesh"]
failed = False
for datasetString in testwrites:
if datasetString == "points":
toshow=gf
elif datasetString == "lines":
toshow = ef
开发者ID:timkrentz,项目名称:SunTracker,代码行数:31,代码来源:TestGeoJSONWriter.py
示例19: render_demo
def render_demo():
# Step 1. Data Source
# Create a sphere geometry
sphere_src = vtk.vtkSphereSource()
sphere_src.SetRadius(1.0)
sphere_src.SetCenter(0.0, 0.0, 0.0)
# In reality, vtkSphereSource creates a polygonal approximation (a
# triangulation) of a sphere. Set the resolution.
sphere_src.SetThetaResolution(20)
sphere_src.SetPhiResolution(20)
# Step 2. Data Processing
# We will visualize the edges of the sphere that we just created. For
# that, we must first extract the edges from the sphere triangulation.
# VTK makes that easy.
edge_extractor = vtk.vtkExtractEdges()
# Create a pipeline link between sphere source and edge extractor
edge_extractor.SetInputConnection(sphere_src.GetOutputPort())
# Now our edge extractor acts as a second data source: it supplies the
# geometry of the edges of the sphere
# Step 3. Mappers
# Create a set of graphical primitives to represent the sphere
sphere_mapper = vtk.vtkPolyDataMapper()
# Create a pipeline link between sphere source and mapper
sphere_mapper.SetInputConnection(sphere_src.GetOutputPort())
# Similarly, create a mapper for the edges of the sphere
edge_mapper = vtk.vtkPolyDataMapper()
edge_mapper.SetInputConnection(edge_extractor.GetOutputPort())
# Step 4. Actors
# Insert the graphical primitives into the scene to be rendered
sphere_actor = vtk.vtkActor()
# Assign sphere mapper to actor
sphere_actor.SetMapper(sphere_mapper)
# The actor now controls the graphical properties of the sphere. We can
# access them to change the color of the sphere. The color is set in RGB
# mode using values from 0 to 1 for each of the three color channels.
# Here we set the color to orange.
sphere_actor.GetProperty().SetColor(1, 0.5, 0)
# Same thing for the edges of the sphere
edge_actor = vtk.vtkActor()
edge_actor.SetMapper(edge_mapper)
# We want our edges to be drawn in dark green
edge_actor.GetProperty().SetColor(0, 0.5, 0)
# We also want them to be shown as thick lines
edge_actor.GetProperty().SetLineWidth(3)
# Step 5. Renderer
# Render the scene to form an image that can be displayed
my_renderer = vtk.vtkRenderer()
# Add all our actors to the renderer
my_renderer.AddActor(sphere_actor)
my_renderer.AddActor(edge_actor)
my_renderer.SetBackground(0.1, 0.2, 0.4)
# Step 6. Render Window
# Provides a window in which the rendered image can be displayed on the
# screen
my_window = vtk.vtkRenderWindow()
my_window.AddRenderer(my_renderer)
# The window size controls the resolution of the final image
my_window.SetSize(600, 600)
# Step 7. Interactor
# Create an interactor: the user will be able to control the
# visualization through mouse and keyboard interaction
my_interactor = vtk.vtkRenderWindowInteractor()
my_interactor.SetRenderWindow(my_window)
# IMPORTANT NOTE: always initialize the interactor before doing the
# rendering!
my_interactor.Initialize()
# Step 8. Actual Rendering
# Draw something on the screen (finally!)
my_window.Render()
# Step 9. Interaction Starts
# We are done: entering the interaction loop. The user is in charge
my_interactor.Start()
开发者ID:hurlei,项目名称:pyNastran,代码行数:81,代码来源:extract_edges.py
示例20: vtkGetDataRoot
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
### SetUp the pipeline
FormMesh = vtk.vtkRectilinearGridToTetrahedra()
FormMesh.SetInput(4,2,2,1,1,1,0.001)
FormMesh.RememberVoxelIdOn()
TetraEdges = vtk.vtkExtractEdges()
TetraEdges.SetInputConnection(FormMesh.GetOutputPort())
tubes = vtk.vtkTubeFilter()
tubes.SetInputConnection(TetraEdges.GetOutputPort())
tubes.SetRadius(0.05)
tubes.SetNumberOfSides(6)
### Run the pipeline 3 times, with different conversions to TetMesh
Tubes1 = vtk.vtkPolyData()
FormMesh.SetTetraPerCellTo5()
tubes.Update()
Tubes1.DeepCopy(tubes.GetOutput())
Tubes2 = vtk.vtkPolyData()
FormMesh.SetTetraPerCellTo6()
tubes.Update()
Tubes2.DeepCopy(tubes.GetOutput())
Tubes3 = vtk.vtkPolyData()
FormMesh.SetTetraPerCellTo12()
tubes.Update()
Tubes3.DeepCopy(tubes.GetOutput())
### Run the pipeline once more, this time converting some cells to
### 5 and some data to 12 TetMesh
开发者ID:151706061,项目名称:VTK,代码行数:31,代码来源:TestRectilinearGridToTetrahedra.py
注:本文中的vtk.vtkExtractEdges函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论