akaszynski
(Alex Kaszynski)
July 6, 2019, 10:15pm
1
Hello,
I’m trying to serialize a vtk scene using:
### ----------------------------------------------------------------------- ###
### Configure output location ###
###
### A top-level export directory will be created (if necessary) and used to
### store all exported scenes. Use the EXPORT_DIRECTORY pattern below to
### customize where this directory should be. Automatic replacement will
### be done on the following variables if they appear in the pattern:
###
### ${USER_HOME} : Will be replaced by the current user's home directory
### ----------------------------------------------------------------------- ###
EXPORT_DIRECTORY = '${USER_HOME}/vtkJsExport'
FILENAME_EXTENSION = '.vtkjs'
### ----------------------------------------------------------------------- ###
### Convenience methods and definitions ###
### ----------------------------------------------------------------------- ###
import sys, os, re, time, errno, json, math, gzip, shutil, argparse, hashlib
This file has been truncated. show original
And it’s, in general, quite buggy. I noticed that there was some work done in VTK on improving this. Specifically:
from __future__ import absolute_import, division, print_function
import json, time, re
from vtk.vtkFiltersGeometry import vtkCompositeDataGeometryFilter
from vtk.vtkCommonCore import vtkTypeUInt32Array
from vtk.vtkWebCore import vtkWebApplication
from vtk.web import hashDataArray, getJSArrayType
from vtk.web import buffer, base64Encode
# -----------------------------------------------------------------------------
# Convenience class for caching data arrays, storing computed sha sums, keeping
# track of valid actors, etc...
# -----------------------------------------------------------------------------
class SynchronizationContext():
def __init__(self, debug=False):
self.dataArrayCache = {}
self.lastDependenciesMapping = {}
This file has been truncated. show original
Is there any documentation on the use of this new serializer?
1 Like
Those are quite different. The macro was a proof of concept showing how to serialize a scene and render it using an application like this .
The second approach is used to dynamically synchronize the render window over the network. It is used in ParaView Visualizer .
Also the macro was replaced by a C++ implementation in VTK where a Python helper is here to zip the directory and also bundle the Glance viewer along with the data.
The new implementation is available in ParaView/master or 5.7 as a web export.
akaszynski
(Alex Kaszynski)
July 9, 2019, 7:23pm
3
Thanks for your helpful response!
I look forward to using the latest C++ implementation in the next release of VTK.