Skip to main content

General-purpose features that may be integrated into VTK library in the future.

Project description

vtk-u3dexporter

Build Wheels PyPI Version License

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()

# 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

vtk_u3dexporter-0.3.0-cp311-cp311-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

vtk_u3dexporter-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

vtk_u3dexporter-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

vtk_u3dexporter-0.3.0-cp311-cp311-macosx_10_10_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.11 macOS 10.10+ x86-64

vtk_u3dexporter-0.3.0-cp310-cp310-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

vtk_u3dexporter-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

vtk_u3dexporter-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

vtk_u3dexporter-0.3.0-cp310-cp310-macosx_10_10_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.10+ x86-64

vtk_u3dexporter-0.3.0-cp39-cp39-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

vtk_u3dexporter-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

vtk_u3dexporter-0.3.0-cp39-cp39-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

vtk_u3dexporter-0.3.0-cp39-cp39-macosx_10_10_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.10+ x86-64

vtk_u3dexporter-0.3.0-cp38-cp38-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

vtk_u3dexporter-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

vtk_u3dexporter-0.3.0-cp38-cp38-macosx_10_10_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.10+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page