General-purpose features that may be integrated into VTK library in the future.
Project description
vtk-u3dexporter
vtk-u3dexporter
is a VTK module for exporting a VTK 3D scene to the U3D file format, which can be embedded into PDF files.
It is available as both C++ class and a Python package.
Installation
You can install vtk-u3dexporter
via pip:
pip install vtk-u3dexporter
Usage
Here is a brief example of how to use vtk-u3dexporter
to export a simple cube scene:
import os
import vtk
from vtk import vtkU3DExporter
# Define the cube source
cube = vtk.vtkCubeSource()
# Define the cube mapper
cubeMapper = vtk.vtkPolyDataMapper()
cubeMapper.SetInputConnection(cube.GetOutputPort())
# Define the cube actor
cubeActor = vtk.vtkActor()
cubeActor.SetMapper(cubeMapper)
# Define the render window and renderer
renderWindow = vtk.vtkRenderWindow()
renderWindow.OffScreenRenderingOn()
renderer = vtk.vtkRenderer()
renderWindow.AddRenderer(renderer)
# Add the cube to the renderer
renderer.AddActor(cubeActor)
# Automatically reset the camera
renderer.ResetCamera()
# Fix IFXCore library loading. See https://github.com/ClinicalGraphics/VTKU3DExporter/issues/13
os.environ["U3D_LIBDIR"] = os.path.dirname(vtkU3DExporter.__file__)
# Define the output file name, which will have the ".u3d" extension appended automatically
filePath = "cube"
# Export to U3D
u3dExporter = vtkU3DExporter.vtkU3DExporter()
u3dExporter.SetFileName(filePath)
u3dExporter.SetInput(renderWindow)
u3dExporter.Write()
# Check that the file exists
assert os.path.exists(f"{filePath}.u3d")
In this example, we create a simple cube scene using VTK, add it to a renderer, and then export it to U3D format using vtk-u3dexporter
. We then verify that the output file exists.
License
vtk-u3dexporter
is distributed under the Apache License 2.0. Please see the LICENSE file for details.
Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for vtk_u3dexporter-0.1.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7aa101d4e3e69d7c533238c6e6a53e34a68ffc569d04d5d3f002fae03723e1b |
|
MD5 | 72a22a37ae239ea4cf794f3fdb1388c0 |
|
BLAKE2b-256 | 2719b66f9939b93991b7bd8d9f63fd69c248919fa9c8ac2fc9d3c64d4ea5c006 |
Hashes for vtk_u3dexporter-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e8772231e7ee2e5cb584dab1439f3952555cce255d651eb0a05409663cff870 |
|
MD5 | 11d2a815f98fcca311c86413357a721d |
|
BLAKE2b-256 | 0bff799ad25699371f384def9dea5295f7b257d08927207558eec684e0aa0279 |
Hashes for vtk_u3dexporter-0.1.0-cp311-cp311-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996b8942ae4c7124f7e464be8927efccd24e48fe4c5009703671b0b7f919e747 |
|
MD5 | 5d3d3a2d8a5ddeba06731914ea992aef |
|
BLAKE2b-256 | 40bf8256e8ede842a9656ef87973c9b503149f20507aa4f34be2566b938d2ae7 |
Hashes for vtk_u3dexporter-0.1.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7dc6cd5c91c99303c1528a7c0fd2b9021b5c601cce807f3745e7ca672229e87 |
|
MD5 | b2f1b520e91f4255a2cfe67bb6600933 |
|
BLAKE2b-256 | 84226f0c4c957260f37e2057dbf6d35786d51c427a0203684aa38e9dc4823c9c |
Hashes for vtk_u3dexporter-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb61959518ebb4094a31b7a9ed5ae8f8556cfd84f4b1e773a7c636e9b9e7787 |
|
MD5 | e37e0f79bfe54f5b737cc944951ca976 |
|
BLAKE2b-256 | 717c11eeed104b203de8591ae7f131ef3030b3afcc8b1798c0ac9c1baed90a85 |
Hashes for vtk_u3dexporter-0.1.0-cp310-cp310-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd006c170ac1898cf23ab497684b6dddc7690a203789dfd59e5e795852c2c271 |
|
MD5 | 61dea8bdc5b82673e928b397422e9c0d |
|
BLAKE2b-256 | dc005676da1fbf45c81140fac3167c02bd9f650062456e48219e29c45bc942ef |
Hashes for vtk_u3dexporter-0.1.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ea5e08dc9f5c2429c3f606c71c83c7f7525e14178c58ca3b334ea75bee3680 |
|
MD5 | 0f4ca3e87431415e7a3c5d1a792e2862 |
|
BLAKE2b-256 | 353e3798027b67070e77f4bc6fce949615895ee6ffc638fbc45d2ba7d1d9ddea |
Hashes for vtk_u3dexporter-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0afca55a59e3d50ae6a89569f42f8230b94d718cbd3724f997048e86746c867f |
|
MD5 | 3cd41fae28815c7225ce927621585b44 |
|
BLAKE2b-256 | e5c2e1045c560098c8a5c9633bbc369817d2f658a82093b8c419505330fa7a46 |
Hashes for vtk_u3dexporter-0.1.0-cp39-cp39-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6349c6b54d18846e9ebea4709492b8b1f00277b0ffc68e879477b0869a4ea7b |
|
MD5 | 7bc23d543a1b38678d3ba1e0f1fd5b03 |
|
BLAKE2b-256 | 7f041bb70fc07697427de23a5eb9ec477fbd79f67401a09753ea999914afb06f |
Hashes for vtk_u3dexporter-0.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d1aef3bcdf8e50c85e1ff569e572b7d4701d915e12b40ad5b9bbf9ca10efdb0 |
|
MD5 | df25fdc1a4c92f05550b0ff6cdf5d1de |
|
BLAKE2b-256 | c3f1d83608ec338edf6ee91bac9c5c0f61d3de217d546f0a6f5f2112ca80ba09 |
Hashes for vtk_u3dexporter-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae8ae9ec6d4e5e1c1d898d146ad55c8658568416236c7f776bb4cee018e02340 |
|
MD5 | df3e9b265124532ef415c2a6e3251649 |
|
BLAKE2b-256 | d4e933814f788dec660f14eb1a99acdfce4ddeebc891e462e7d08e4caf991af0 |
Hashes for vtk_u3dexporter-0.1.0-cp38-cp38-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20ed31cd3cc0a7c4fb208fe4024ca56b054848dfd18bf368c9448e4a32ace607 |
|
MD5 | 7bd6302ba53afc4d632497d59fbcace2 |
|
BLAKE2b-256 | d41d6f4dfb6e0c6470d7b6458db02946dbbf5ed186625296e8db85b01fe1e10f |