A reusable PyQt6 QWidget for viewing 3D models with PyVista.
Project description
fry-qt6-3d-widget
fry-qt6-3d-widget 是一个可复用的 PyQt6 3D 模型显示控件。它把 PyVista / VTK 的 3D 渲染能力封装成一个独立 QWidget,可以直接嵌入你的 PyQt6 应用。
组件本身不封装成 QDockWidget。如果业务应用需要 dock,只要把 FryCore3DViewer 放进 QDockWidget 即可,见 examples/dock_viewer.py。
安装
从 PyPI 安装:
pip install fry-qt6-3d-widget
本仓库开发安装:
python -m pip install -e ".[dev]"
最小使用
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow
from fry_qt6_3d_widget import FryCore3DViewer
app = QApplication(sys.argv)
window = QMainWindow()
viewer = FryCore3DViewer()
window.setCentralWidget(viewer)
viewer.load_model("path/to/model.stl")
window.resize(1200, 800)
window.show()
sys.exit(app.exec())
也可以直接运行安装后的 demo:
fry-qt6-3d-viewer path/to/model.stl
支持格式
.glb/.gltf.ply.obj.stl.vtk/.vtp/.vtu.xyz/.pts文本点云
.xyz / .pts 至少包含 X Y Z 三列;如果包含 R G B 三列,会按点颜色显示。
常用能力
- 拖拽加载模型文件
- 视角切换:等轴、正面、背面、左面、右面、顶部、底部
- 渲染模式:表面、线框、点云、表面+边
- 坐标轴、网格、地面参考开关
- 深色/浅色背景
- Y-up 输入到 Z-up 业务坐标系转换
- 点云体素 glyph 显示
- Qt 信号:加载成功、加载失败、视角变化、渲染模式变化
更多设计细节见 docs/CORE_CONCEPTS.md。
示例
python examples/basic_viewer.py path/to/model.stl
python examples/dock_viewer.py path/to/model.stl
python examples/load_xyz_points.py
测试
python -m pytest
构建与发布
python -m build
python -m twine check dist/*
python -m twine upload dist/*
第一次发布建议先用 TestPyPI:
python -m twine upload --repository testpypi dist/*
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fry_qt6_3d_widget-0.1.0.tar.gz.
File metadata
- Download URL: fry_qt6_3d_widget-0.1.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05aee88dc3ca3b002e0ce9dba9c88136b479869c51334ef978f37c5ca1d4ba26
|
|
| MD5 |
92fb09c9e501e2d907069237f9321466
|
|
| BLAKE2b-256 |
ca1072ee2fd56b6a46b94fe53b6e290da528bc3fb8276fde41d5f13393ea64d7
|
File details
Details for the file fry_qt6_3d_widget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fry_qt6_3d_widget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d94aaee85d9eff9d4b0259e724e1813dfe6eaa7dc42981235df1d9de363465c
|
|
| MD5 |
b9be45db9ee844704a037b8f6b735e5c
|
|
| BLAKE2b-256 |
419829d6f5323b217a4f735df2a9bbc53405677df0c87b52b5fc5274e972a04e
|