Skip to content

polydata_builder

PolydataBuilder

add_array(polydata, np_array, name) staticmethod

add_cell_array(polydata, np_array, name) staticmethod

add_polyline(polydata, point_ids) staticmethod

Add polyline to polydata.

Parameters:

Name Type Description Default
polydata vtkPolyData

Input polydata.

required
point_ids list

List of point indexes.

required

Returns:

Name Type Description
vtkPolyData vtkPolyData

Polydata with added polyline.

append(polydata_list) staticmethod

Build signle polydata from list.

Parameters:

Name Type Description Default
polydata_list list

List of vtkPolyData.

required

Returns:

Name Type Description
vtkPolyData vtkPolyData

Single polydata.

as_vtk_array(np_array, name) staticmethod

build(coords, polygons=None) staticmethod

build_polyline(coords, closed=False) staticmethod

Build polyline from sequence of points.

Parameters:

Name Type Description Default
coords ndarray[N, 3]

An array of coordinates.

required
closed bool

If True closed Line will be added. Defaults to False.

False

Returns:

Name Type Description
vtkPolyData vtkPolyData

vtkPolyData object with Lines built from array of coordinates.

clone(polydata) staticmethod

Make deepcopy of polydata.

Parameters:

Name Type Description Default
polydata vtkPolyData

Input polydata.

required

Returns:

Name Type Description
vtkPolyData vtkPolyData

Deepcopy of input polydata.

extract_array(polydata, array_name) staticmethod

extract_cell_array(polydata, array_name) staticmethod

Get cell array from polydata.

Parameters:

Name Type Description Default
polydata vtkPolyData

vtkPolyData object.

required
array_name str

name of vtkPolyData array.

required

Returns:

Name Type Description
ndarray ndarray

numpy array of values.

extract_lines(polydata) staticmethod

Extract lines point indexes.

Parameters:

Name Type Description Default
polydata vtkPolyData

Polydata with lines.

required

Returns:

Name Type Description
list list[int]

List of line indexes.

extract_points(polydata) staticmethod

Get points coordinates from polydata.

Parameters:

Name Type Description Default
polydata vtkPolyData

vtkPolyData object.

required

Returns:

Name Type Description
ndarray ndarray

numpy array of points coordinates.

mask_points(polydata, selected_ids, scalar_name='OriginalPointIds') staticmethod

Select polydata by point indexes.

Parameters:

Name Type Description Default
polydata vtkPolyData

Input polydata.

required
selected_ids list

List of point indexes which will be selected.

required
scalar_name str

New array will be add to the output. Defaults to "OriginalPointIds".

'OriginalPointIds'

Returns:

Name Type Description
vtkPolyData vtkPolyData

Selected polydata.

Note

All Polygons, Triangle strips etc., will be removed from output.

generate_point_ids(func)

Decorate method that require 'OriginalPointIds' generation First argument of the func should be vtkPolyData.