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.2.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f284b3a9971ead54ea829c99be590c63d361d8d0082f71d524f3ff831143851 |
|
MD5 | 894842a6cf1d09c7b5a2d01a5d35708d |
|
BLAKE2b-256 | 7a586e7b0a56f7695373217b04d93508b9f0bae785efde32b00b0069779c3cd4 |
Hashes for vtk_u3dexporter-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18ab880faffc845e4d96c78a8fa37e761ebfc163d0016e34bd8eb16a3343adc |
|
MD5 | ba59b3329bc2aba40d95fe1ef9aff11b |
|
BLAKE2b-256 | c21e55374ea6b1e0b8be57d8e0b11624f896b86ad8058c25f8d8306b0cd10943 |
Hashes for vtk_u3dexporter-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 823ab99e2c2140f6c4b102dd4ed27387de64a6162a486b91265dd12fc81d9d70 |
|
MD5 | bc6e942c7f92a92984b5e68e44d590a5 |
|
BLAKE2b-256 | a2bff666fb4adefee7c00105824b720642a98f153826a2496cb5eb53f85cf3a7 |
Hashes for vtk_u3dexporter-0.2.0-cp311-cp311-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb55a296958c6602e757dc5248325330ba9582f6823d4c8552b8ba98b797631b |
|
MD5 | 9f897ce774654e33e900cdf63638d89e |
|
BLAKE2b-256 | cd61408dc71548b9def1d7f9625ea6a24e30118b582e681a4a395d1c39ed2a09 |
Hashes for vtk_u3dexporter-0.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e03f99dcebfb90f5befc712b390eaa535c0563207a208c9c89fe76a0a93bc26 |
|
MD5 | 0ff64e82e3168cc22423b277bde4cb35 |
|
BLAKE2b-256 | dae41be9d5f1538fff9bd667d004e6584ba0765371a63df7d2e94d042f0158c1 |
Hashes for vtk_u3dexporter-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77e671eef5af4b378e756caf3b13eb137b64729dec2f5141e200f1bdae5c3cc7 |
|
MD5 | 54573f7108c71535e5e18aa966122215 |
|
BLAKE2b-256 | 740c30b45934a0b24d590f7fccd12f40a63875cd19db89a1b722d1206c40cd67 |
Hashes for vtk_u3dexporter-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f830f1caabd120282892e8cdcdbe9ab20c3dfa351dd8fa9855b8ef4b438b0966 |
|
MD5 | c678a4683ee30908c341f73e5be65d90 |
|
BLAKE2b-256 | 13e65ee33fc8693a726a25f3e7d9f64a4947df3787f03b80b82568f9e8e98a08 |
Hashes for vtk_u3dexporter-0.2.0-cp310-cp310-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60c45bf20d2e5927d897234b70d50b1186ad02a78ab4f8f3faa98c4e92ed983d |
|
MD5 | 65535f6837522be30dac0102a681ec6c |
|
BLAKE2b-256 | a856d4d44d92761f650f767934e228f670157745c3c6371b2fbb35f10081e519 |
Hashes for vtk_u3dexporter-0.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bac493f27f66e5054fccda48badc49c7ae0ccb2bcd23d216deea9b3a06bb7c63 |
|
MD5 | d30fbaa354bc82acac4d919d38cbd074 |
|
BLAKE2b-256 | f70733acd8186b11c7440b0c3271945e4fb58a98e01933bf94e19d0ac727503d |
Hashes for vtk_u3dexporter-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1477f0906274802d190933055c63dd1c2f22f94a44d8fb9b1b0cea70f80741a |
|
MD5 | 71bafdbf483bfc6eb8ded6712b891132 |
|
BLAKE2b-256 | bf4c1d771b02bccf293207c1c533ee51fe51bfcde3623711805fba01604c0b8d |
Hashes for vtk_u3dexporter-0.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5958a5a2e53abe62d61bbcfb2ee1ad7d2088bd6ab087cfc57c918324e7e0b0b |
|
MD5 | c3a4584798f1e2ae739eabca2f3e491c |
|
BLAKE2b-256 | 6a7c6f62b9853d1755182eee6a6c192883d0c038ae8e15b0a7f3d852fd93040b |
Hashes for vtk_u3dexporter-0.2.0-cp39-cp39-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e17da383e919bcb3fefddd5e0d1f902713fa91214d6ded9f6ce953dcbc3b18 |
|
MD5 | 20d038d506b63f85c5b8fd0647fac984 |
|
BLAKE2b-256 | 51fed10fbaf63e86888664c42f133fbf683facc419c0f6dca96f7b271ad01b20 |
Hashes for vtk_u3dexporter-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b07cbb6951bb50d19098879a87e7ee8c2d4dbd35c8733009ccb9b748b0fe9b2 |
|
MD5 | 24593b9f6d1e632dde162eba071766cd |
|
BLAKE2b-256 | 51a5ba09a01dd83fda46bfdf2f4cfd1402e1821a58b1646cdcbedce22fa694bd |
Hashes for vtk_u3dexporter-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fff1c9bf7cb7bd005975c537562f14ba71b0737f8e1a384bdd7ddda6c98826e4 |
|
MD5 | 294e3308f261bd0a2d80b8006244e36b |
|
BLAKE2b-256 | 86c502c14bfa28336d6b4e8ac9affe7a0e1fac92e436bdc8baa94bcab3436393 |
Hashes for vtk_u3dexporter-0.2.0-cp38-cp38-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de199ceedf33a5496494dccfd1bdb2ca2d85978ab40ae47af296cf820a08e004 |
|
MD5 | 7faccb4697d1b5900d4b03be9d6af296 |
|
BLAKE2b-256 | e7323feee7146e8975ee07854f205d62b88e6df5aeab22e429dc21929934ee0a |