Common functions for *2tvtk.py
def rendertvtk.blobs |
( |
|
blobs | ) |
|
Given a data structure which is a list of blobs, each blob is a dict:
{
points=[[x1,y1,z1], [x2,y2,z2],...],
values=dict(name1=val1, name2=val2),
thickness=1.0, # optional
}
return an unstructured grid
Definition at line 55 of file rendertvtk.py.
57 Given a data structure which is a list of blobs, each blob is a dict: 60 points=[[x1,y1,z1], [x2,y2,z2],...], 61 values=dict(name1=val1, name2=val2), 62 thickness=1.0, # optional 65 return an unstructured grid 71 myvalnames = list(blob[
'values'].
keys())
72 datasetnames = datasetnames.union(myvalnames)
74 pts,cells =
extrude(pts, blob.get(
'thickness', 1.0))
76 blob_cells.append((len(pts),cells))
78 ugrid = tvtk.UnstructuredGrid(points=all_points)
80 ptype = tvtk.Polyhedron().cell_type
83 for npts,cells
in blob_cells:
84 cell_ids = [len(cells)]
86 cell_ids.append(len(cell))
87 cell_ids += [offset+cid
for cid
in cell]
88 ugrid.insert_next_cell(ptype, cell_ids)
91 ugrid.cell_data.scalars = list(range(len(blobs)))
92 ugrid.cell_data.scalars.name =
"indices" 96 for datasetname
in sorted(datasetnames):
97 arr = [b[
"values"].
get(datasetname, 0.0)
for b
in blobs]
98 ugrid.cell_data.add_array(arr)
99 ugrid.cell_data.get_array(narrays).name = datasetname
def orderpoints(pointset)
auto const & get(AssnsNode< L, R, D > const &r)