当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkAppendPolyData方法代码示例

本文整理汇总了Python中vtk.vtkAppendPolyData方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkAppendPolyData方法的具体用法?Python vtk.vtkAppendPolyData怎么用?Python vtk.vtkAppendPolyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vtk的用法示例。


在下文中一共展示了vtk.vtkAppendPolyData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stl2actor

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkAppendPolyData [as 别名]
def stl2actor(ageometry_path, ageometry_name, ageometry_color):

    appendfilter = vtk.vtkAppendPolyData()
    render_lib = vtk.vtkSTLReader()
    polydata = vtk.vtkPolyData()
    render_lib.SetFileName(os.path.join(ageometry_path, ageometry_name+".stl"))
    render_lib.Update()
    polydata.ShallowCopy(render_lib.GetOutput())
    appendfilter.AddInputConnection(polydata.GetProducerPort())
    appendfilter.Update()

    #  Remove any duplicate points.
    cleanfilter = vtk.vtkCleanPolyData()
    cleanfilter.SetInputConnection(appendfilter.GetOutputPort())
    cleanfilter.Update()
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(cleanfilter.GetOutputPort())

    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    actor.GetProperty().SetColor(ageometry_color)

    return actor, polydata 
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:25,代码来源:visualization.py

示例2: boolean_add

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkAppendPolyData [as 别名]
def boolean_add(poly_data, mesh, inplace=False):
        """Add a mesh to the current mesh.

        Does not attempt to "join" the meshes.

        Parameters
        ----------
        mesh : pyvista.PolyData
            The mesh to add.

        inplace : bool, optional
            Updates mesh in-place while returning nothing.

        Return
        ------
        joinedmesh : pyvista.PolyData
            Initial mesh and the new mesh when inplace=False.

        """
        if not isinstance(mesh, pyvista.PolyData):
            raise TypeError("Input mesh must be PolyData.")

        vtkappend = vtk.vtkAppendPolyData()
        vtkappend.AddInputData(poly_data)
        vtkappend.AddInputData(mesh)
        vtkappend.Update()

        mesh = _get_output(vtkappend)
        if inplace:
            poly_data.overwrite(mesh)
        else:
            return mesh 
开发者ID:pyvista,项目名称:pyvista,代码行数:34,代码来源:filters.py

示例3: test_cell_types

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkAppendPolyData [as 别名]
def test_cell_types():
    ss = vtk.vtkSphereSource()
    ss.Update()
    st = wrap_vtk(ss.GetOutput())
    sl = mc.to_lines(st)
    sv = mc.to_vertex(st)

    assert checks.get_cell_types(st) == np.array([VTK_TRIANGLE])
    assert checks.get_cell_types(st.VTKObject) == np.array([VTK_TRIANGLE])
    assert checks.get_cell_types(sl) == np.array([VTK_LINE])
    assert checks.get_cell_types(sv) == np.array([VTK_VERTEX])

    assert checks.get_number_of_cell_types(st) == 1
    assert checks.get_number_of_cell_types(st.VTKObject) == 1
    assert checks.get_number_of_cell_types(sl) == 1
    assert checks.get_number_of_cell_types(sv) == 1

    assert checks.has_unique_cell_type(st)
    assert checks.has_unique_cell_type(st.VTKObject)
    assert checks.has_unique_cell_type(sl)
    assert checks.has_unique_cell_type(sv)

    assert checks.has_only_triangle(st)
    assert checks.has_only_triangle(st.VTKObject)
    assert checks.has_only_line(sl)
    assert checks.has_only_vertex(sv)

    ss2 = vtk.vtkSphereSource()
    ss2.SetRadius(3)
    ss2.Update()
    s2 = ss2.GetOutput()

    app = vtk.vtkAppendPolyData()
    app.AddInputData(sl.VTKObject)
    app.AddInputData(s2)
    app.Update()
    spl = wrap_vtk(app.GetOutput())

    cell_types = np.sort([VTK_TRIANGLE, VTK_LINE])
    assert np.all(checks.get_cell_types(spl) == cell_types)
    assert checks.get_number_of_cell_types(spl) == cell_types.size
    assert checks.has_unique_cell_type(spl) is False
    assert checks.has_only_triangle(spl) is False
    assert checks.has_only_line(spl) is False
    assert checks.has_only_vertex(spl) is False 
开发者ID:MICA-MNI,项目名称:BrainSpace,代码行数:47,代码来源:test_wrapping.py


注:本文中的vtk.vtkAppendPolyData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。