Skip to main content

Standalone viewer for COMPAS 2 based on PyOpenGL and PyQt6.

Project description

COMPAS VIEWER

A standalone, high-performance 3D viewer for COMPAS 2.0, built with PySide6 and OpenGL.

Version Documentation License

More information is available in the docs: https://compas.dev/compas_viewer/

Features

Core Functionality

  • High-Performance Rendering: Modern OpenGL 3.3 Core Profile with optimized buffer management and instanced rendering
  • Complete COMPAS Integration: Full support for all COMPAS objects based on the compas.scene architecture
  • Multiple Rendering Modes: Shaded, ghosted, lighted, and wireframe rendering with configurable opacity
  • Interactive Navigation: Smooth camera controls with perspective, orthographic, and preset views (top, front, right)
  • Advanced Selection: Object selection with window/box selection, multi-selection, and selection highlighting

User Interface

  • Customizable UI: Fully configurable interface with dockable panels, toolbars, and sidebars
  • Scene Management: Hierarchical scene tree with show/hide controls and object settings
  • Real-time Controls: Dynamic sliders, buttons, and form controls for interactive parameter adjustment
  • Property Editing: Built-in object property dialogs for colors, line widths, point sizes, and transformations

Supported Geometry Types

  • Primitives: Point, Line, Vector, Plane, Frame
  • Curves: Polyline, Circle, Ellipse, NurbsCurve
  • Surfaces: Polygon, NurbsSurface, BRep (via compas_occ)
  • Solids: Box, Sphere, Cylinder, Cone, Torus, Capsule, Polyhedron
  • Data Structures: Mesh, Graph, Pointcloud, Collection
  • Special: Text tags, Grid, Custom buffer objects

Advanced Features

  • Dynamic Animations: Built-in animation system with @viewer.on() decorator for time-based updates
  • Multi-Unit Support: Automatic scaling for meters, centimeters, and millimeters
  • Command System: Extensive keyboard and mouse shortcuts with customizable bindings
  • File I/O: Load/save scenes in JSON format, drag and drop COMPAS scene, geometries and data structures
  • Command Line Interface: Direct launching with python -m compas_viewer -f filename.json
  • Extensible Architecture: Plugin system for custom scene objects and UI components

Installation

Requirements

  • Python >= 3.9
  • COMPAS >= 2.2.0

Quick Install

pip install compas_viewer

Development Install

git clone https://github.com/compas-dev/compas_viewer.git
cd compas_viewer
pip install -e .

See the Getting Started instructions in the docs for detailed installation guidelines.

Quick Start

Basic Usage

from compas_viewer import Viewer
from compas.geometry import Box, Sphere

# Create viewer
viewer = Viewer()

# Add geometry
box = Box(1, 2, 3)
sphere = Sphere(0.5)

viewer.scene.add(box, name="My Box")
viewer.scene.add(sphere, name="My Sphere")

# Show viewer
viewer.show()

Command Line Usage

# Launch with a empty scene
python -m compas_viewer

# Launch with a specific file
python -m compas_viewer -f path/to/geometry.json

# Launch with multiple files from a directory
python -m compas_viewer --files path/to/directory/

Dynamic Animations

from compas_viewer import Viewer
from compas.geometry import Box, Translation

viewer = Viewer()
box = viewer.scene.add(Box(1, 1, 1))

@viewer.on(interval=50)  # Update every 50ms
def animate(frame):
    T = Translation.from_vector([0.01 * frame, 0, 0])
    box.transformation = T

viewer.show()

Key Controls

Action Shortcut
Rotate Right-click + drag
Pan Right-click + shift + drag
Zoom Mouse wheel
Select object Left-click
Select multiple Left-click + shift + drag
Delete selected Delete key
Zoom to selected F key (with selection)
Zoom to All F key (without selection)

Documentation

  • Tutorial: Basic concepts, configuration, and software architecture
  • Examples: Comprehensive examples covering all features
  • API Reference: Complete API documentation

Contributing

We welcome contributions! Please see our Contributing Guidelines for:

  • Bug reports and feature requests
  • Code contributions and pull requests
  • Documentation improvements
  • Community guidelines

Dependencies

License

The code in this repo is licensed under the MIT License.

Known Issues

Please check the Issue Tracker for known issues and their solutions.

Changelog

See CHANGELOG.md for version history and release notes.

Project details


Download files

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

Source Distribution

compas_viewer-2.0.2.tar.gz (444.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compas_viewer-2.0.2-py3-none-any.whl (469.3 kB view details)

Uploaded Python 3

File details

Details for the file compas_viewer-2.0.2.tar.gz.

File metadata

  • Download URL: compas_viewer-2.0.2.tar.gz
  • Upload date:
  • Size: 444.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for compas_viewer-2.0.2.tar.gz
Algorithm Hash digest
SHA256 555161293ddc760a8abe0aff505d55b55d4a94261013f957277fccb6acdf22b7
MD5 2b53338798e326c11ffef2024d9b9c12
BLAKE2b-256 7ba6417bb8e954b0c96dc1325f3573aefac41bec1d14e5438ebe988bc26f7343

See more details on using hashes here.

File details

Details for the file compas_viewer-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: compas_viewer-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 469.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for compas_viewer-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2b52f68f6cb314a493f4b0b19a89097f44aa86c31b386b9565647e3afd8ca7c
MD5 741060cc70c52bd628bd74c50bc5d16d
BLAKE2b-256 b3fd3699712139ab4788821c1995c8dafd3987d62282f5c7adad31c34cf1c15f

See more details on using hashes here.

Supported by

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