🚀 Instantly visualize 3D point clouds from your Python debugger in VS Code!
This extension enhances your debugging workflow by allowing you to preview point cloud variables as .ply files directly from the editor. It supports native Open3D point clouds, NumPy arrays, and PyTorch tensors.
See it on the VS Marketplace: Python PLY Preview
- Set a breakpoint in your Python code.
- Start your program in Debug Mode (F5).
- When execution pauses, open a point cloud in any of these ways:
- Put the cursor on a variable (or select an expression such as
pcd.pointsorbatch[0]) and pick View PLY from the lightbulb / quick fix menu (Ctrl+.). - Right-click a variable in the Variables or Watch panel and pick View as Point Cloud (PLY).
- Right-click in the editor, or run Python PLY Preview: View as Point Cloud (PLY) from the Command Palette.
- Put the cursor on a variable (or select an expression such as
- The point cloud will be rendered in a new editor tab.
The variable is evaluated in the stack frame selected in the Call Stack view, so you can preview variables from any frame or thread.
To test all features, you can use the following Python script. Place a breakpoint on the final print statement and inspect each of the defined variables.
import open3d as o3d
import numpy as np
import torch
# 1. Create a basic NumPy array with XYZ points
points_np = np.random.rand(1000, 3)
# 2. Create a NumPy array with XYZ points and RGB colors
# Points are a spiral, colors transition from red to blue
z = np.linspace(0, 10, 1000)
x = np.sin(z) * 5
y = np.cos(z) * 5
points_spiral = np.vstack((x, y, z)).T
colors_gradient = np.zeros_like(points_spiral)
colors_gradient[:, 0] = np.linspace(0, 1, 1000) # Red channel
colors_gradient[:, 2] = np.linspace(1, 0, 1000) # Blue channel
points_and_colors_np = np.hstack((points_spiral, colors_gradient))
# 3. Create PyTorch Tensors from the NumPy arrays
points_torch = torch.from_numpy(points_np)
points_and_colors_torch = torch.from_numpy(points_and_colors_np)
# 4. Create a native Open3D PointCloud object
pcd_o3d = o3d.geometry.PointCloud()
pcd_o3d.points = o3d.utility.Vector3dVector(points_np)
pcd_o3d.paint_uniform_color([0.5, 0.5, 0.5]) # Gray color
# Set a breakpoint on the line below and hover over the variables to test
print("Breakpoint here: Hover over variables to preview them as PLY.")The extension only needs NumPy in your Python environment (pip install numpy). Open3D objects and PyTorch tensors are converted through NumPy, so open3d and torch are never imported by the extension. You only need them if your own code uses them.
- Open3D:
o3d.geometry.PointCloudand tensor-APIo3d.t.geometry.PointCloudobjects (with colors if present). - NumPy arrays and PyTorch tensors (any device) with shape:
(n, 3): XYZ(n, 4): XYZ + intensity (e.g. LiDAR), shown with a colormap(n, 6): XYZ + RGB, as floats in[0, 1]or values in[0, 255]- Channels-first
(3|4|6, n)and batched(1, n, c)layouts are handled automatically.
- Points with
NaN/infcoordinates are dropped.
This extension handles the saving of the point cloud. You need another extension to view the resulting .ply file. We recommend:
- Files are written by the Python process to
.vscode/ply_previewin your workspace, so the debuggee must be able to write to that path (attaching to a Docker container or remote process with path mappings is not supported yet).
- Preview files left behind when VS Code was closed during a debug session are now removed after a day.
- The PLY file is now written only when you click View PLY, not every time the cursor moves. This makes the debugger much more responsive with large point clouds.
- Files are now saved as binary PLY, which is much faster and smaller than ASCII.
- New entry points: right-click in the Variables / Watch panels, the editor context menu, and the Command Palette.
- You can select an expression such as
pcd.pointsorbatch[0]to preview it. - Uses the stack frame selected in the Call Stack instead of always the top frame of the first thread.
- Added support for
(n, 4)XYZ + intensity, channels-first and(1, n, c)batched layouts, anduint8colors. Also added support for Open3D tensor-API point clouds. - Dropped the
open3drequirement: onlynumpyis needed. Non-finite points are filtered out. - Requires VS Code 1.90 or newer.
- Replaced heavy Open3D dependency with pure NumPy and Python file I/O for array saving.
- Fixed a critical bug causing timeouts (
Cannot evaluate expression) on macOS due to slow library loading. - Improved robustness across different Python versions.
- Modified README.md to include Visual Studio Marketplace badges.
- Removed the requirement to import
open3din the user script beforehand. - Added automatic library check (Open3D, NumPy, PyTorch) and user notification if missing.
- Modified README.md to include Visual Studio Marketplace badges.
- Added support for PyTorch Tensors and NumPy arrays with color
(n, 6). - Changed temporary file location to
.vscode/ply_preview. - Implemented automatic cleanup of temporary files after a debug session.
- Improved logic to avoid activating on variables in comments or strings.
- The
__pycache__folder is now created if it doesn't exist.
- Fixed extension description and name.
- Added marketplace badges to the README.
- Initial release.
This project was inspired by the fantastic work of other developer tool extensions:

