Skip to content

JonathanSolvesProblems/SteamPrint-OpenAI-Open-Model-Hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Steam Print

Demo: Steam Print

Steam Print is a portable 3D printing companion that transforms the Steam Deck into a full voice-driven modeling and printing workstation. It lets users load and explore 3D models, issue offline voice commands, and even generate brand-new designs on the fly using AI models like gpt-oss:20b and gpt-oss:120b. With a lightweight viewer on the Steam Deck, a local backend server for AI processing, and OctoPi handling slicing and printer control, the entire processβ€”from idea to printed objectβ€”can be managed without relying on a traditional desktop setup.

Steam Print Backend

The backend server for Steam Print, powering AI-driven 3D model generation from voice commands and managing 3D printing workflows. Runs locally on your PC or a server and communicates with the Steam Deck frontend.


1) Install Ollama and pull models

ollama pull gpt-oss:20b

or

ollama pull gpt-oss:120b
  1. Create Python virtual environment & install dependencies
python -m venv .venv
source .venv/bin/activate       # Windows: ./venv/Scripts/activate
pip install -r requirements.txt
  1. (Optional) Install Vosk model for offline speech-to-text
  • Download a Vosk model (e.g., vosk-model-small-en-us-0.15) from Vosk Models

    If skipped, the backend will accept typed input from the Steam Deck UI.

  1. Add .env file Modify a .env file in the project root accordingly:
# AI Model to use with Ollama
MODEL_NAME=gpt-oss:20b
LLM_SERVER=http://192.168.0.67:5000

# Optional: Path to Vosk STT model folder
VOSK_MODEL_PATH=./vosk-model-small-en-us-0.15

# OCR path (if using text from images)
TESSERACT_PATH=C:\Program Files\Tesseract-OCR\tesseract.exe

# File server for STL transfer
FILE_SERVER=http://192.168.0.67:5000/files/

# Steam Deck connection details
STEAMDECK_USER=deck
STEAMDECK_IP=192.168.0.66
STEAMDECK_CURA_DIR=/home/deck/CuraIncoming

# OpenSCAD path for 3D model processing
OPENSCAD_PATH=C:\Program Files\OpenSCAD\openscad.exe
  1. You can swap MODEL_NAME between gpt-oss:20b and gpt-oss:120b to easily switch LLMs for speed vs. capability.
python -m backend.server
  • The server will listen for voice/text commands from the Steam Deck frontend.
  • It dynamically generates STL models using the selected LLM.
  • Generated models are returned to the Steam Deck app for viewing, slicing, and sending to OctoPi.
  1. Setup Raspberry Pi with OctoPi
  • Install OctoPi on a Raspberry Pi connected to your 3D printer.
  • Ensure your Steam Deck or backend server can reach the Pi via network.
  • Use the Steam Print frontend’s Slice and Send button to send models directly to OctoPi.
  • Optionally, connect a camera module to monitor prints.
  • On the octopi.local webserver, make sure to install the plugin OctoPrint-Slic3r to allow for slicing directly on your raspberrypi. That way you can still game on your steam deck at full performance while the the model is slicing.

Steam Print Frontend

A lightweight STL viewer with AI voice interface, optimized for Steam Deck and Linux desktops.

Features

  • 3D STL Viewing: Interactive 3D viewer with rotate, pan, and zoom controls
  • Voice Commands: Offline speech-to-text using vosk for AI interactions
  • Touch-Friendly UI: Optimized for Steam Deck's touchscreen and controls
  • Lightweight: Minimal dependencies, fast startup
  • Extensible: Modular architecture for future features

Requirements

  • Python 3.8+
  • Linux (tested on Steam Deck/Arch Linux)
  • Audio input device (microphone)
  • OpenGL support

Installation

Option 1: Direct Installation on Steam Deck

# Clone the repository
git clone <repository-url>
cd frontend

# Install dependencies
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Run the application
bash run.sh

Option 2: PyInstaller Bundle (Recommended for Steam Deck)

# Install PyInstaller
pip install pyinstaller

# Create bundled executable
pyinstaller --onefile --windowed \
    --add-data "ui:ui" \
    --add-data "voice:voice" \
    --add-data "utils:utils" \
    --hidden-import trimesh \
    --hidden-import vosk \
    --hidden-import sounddevice \
    main.py

# The executable will be in dist/main
./dist/main

Usage

Basic Operations

  1. Load STL File: Click "πŸ“‚ Load Model" to browse and load STL files
  2. Voice Commands: Click "🎀 Speak" to record voice commands (8 seconds)
  3. 3D Navigation:
    • Mouse drag: Rotate view
    • Mouse wheel: Zoom in/out
    • Press 'R': Reset view

Voice Commands (Planned)

  • "Load model" - Open file dialog
  • "Rotate left/right" - Rotate current model
  • "Scale up/down" - Resize model
  • "Export model" - Save current model
  • "Send to printer" - Forward to OctoPrint

Architecture

Project Structure

stl-viewer-ai/
β”œβ”€β”€ main.py              # Application entry point
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ setup.py            # Package configuration
β”œβ”€β”€ ui/                 # User interface modules
β”‚   β”œβ”€β”€ main_window.py  # Main application window
β”‚   β”œβ”€β”€ control_panel.py # Left control panel
β”‚   └── stl_viewer.py   # 3D STL viewer widget
β”œβ”€β”€ voice/              # Voice input handling
β”‚   └── voice_handler.py # Speech-to-text processing
└── utils/              # Utility modules
    β”œβ”€β”€ config.py       # Configuration constants
    └── stl_utils.py    # STL file operations

Key Components

  • PySide6: Cross-platform GUI framework
  • trimesh: 3D mesh processing and loading
  • OpenGL: Hardware-accelerated 3D rendering
  • vosk: Offline speech recognition
  • SoundDevice: Audio input/output

Configuration

The application uses utils/config.py to manage its configuration. Key settings include:

Directories

  • HOME_DIR: User home directory
  • TEMP_DIR: Temporary working directory for STL Viewer
  • MODELS_DIR: Folder for downloaded 3D models
  • CACHE_DIR: Cache for application data

Voice Settings

  • VOICE_RECORD_DURATION: Default recording duration (seconds)
  • VOICE_SAMPLE_RATE: Sample rate for audio input
  • VOICE_CHANNELS: Number of audio channels (1 = mono)
  • VOSK_MODEL_SIZE: Name/size of the offline speech-to-text model

LLM Server

  • LLM_SERVER: URL of the backend server handling AI model requests
  • FILE_SERVER: URL to send/receive STL files
  • LOCAL_STL_DIR: Directory on Steam Deck where STL files are stored

OctoPi Settings

  • OCTOPI_URL: Address of OctoPi server connected to your 3D printer
  • OCTOPI_API_KEY: API key for authenticating with OctoPi

User Interface (UI)

  • WINDOW_MIN_WIDTH / WINDOW_MIN_HEIGHT: Minimum application window size
  • PANEL_MIN_WIDTH: Minimum width of control panel
  • DEFAULT_BACKGROUND_COLOR: Background color of the 3D viewer (RGBA)
  • DEFAULT_MESH_COLOR: Default color for loaded meshes (RGBA)

These constants control the behavior of the STL Viewer AI application, including audio capture, 3D rendering, file handling, server connections, and printer integration.

Troubleshooting

Audio Issues

If voice input doesn't work:

# Check audio devices
arecord -l

# Test microphone
arecord -d 5 test.wav
aplay test.wav

Missing Dependencies

# Install system packages (Arch Linux/Steam Deck)
sudo pacman -S portaudio python-sounddevice

# Ubuntu/Debian
sudo apt-get install portaudio19-dev python3-sounddevice

OpenGL Issues

# Check OpenGL support
glxinfo | grep "OpenGL version"

# Install OpenGL libraries if needed
sudo pacman -S mesa mesa-utils  # Arch Linux
sudo apt-get install mesa-utils # Ubuntu/Debian

Future Features

Planned Enhancements

  • OctoPrint Integration: Send models directly to 3D printer
  • Basic Slicing: Preview layer cross-sections
  • Model Editing: Scale, rotate, repair operations
  • Cloud Integration: Fetch models from online repositories
  • Print Settings: Configure slicing parameters
  • Multiple File Formats: Support OBJ, PLY, 3MF

Server Integration

The app is designed to integrate with a Flask server for AI-powered model generation:

def send_to_server(voice_text: str) -> str:
    """Send voice command to AI server"""
    response = requests.post("http://localhost:5000/generate",
                           json={"prompt": voice_text})
    return response.json()["stl_path"]

Development

Running Tests

# Install test dependencies
pip install pytest pytest-qt

# Run tests
pytest tests/

Contributing

  1. Fork the repository
  2. Create feature branch
  3. Make changes with tests
  4. Submit pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • trimesh for 3D mesh processing
  • vosk for offline speech recognition
  • PySide6 for cross-platform GUI
  • Steam Deck community for testing and feedback

Demo Models (STL Sources)

The following STL files were used in the demo video. Please replace with actual links and creators:

  1. Abandoned House with Broken Windows β€” Created by Ilham3D
  2. Old Classic Pokeball β€” Created by Feyzii
  3. Toy Monkey β€” Created by SPolyModeler
  4. Octopus β€” Created by omrfrkcndn54
  5. Medieval Barrel β€” Created by dimension Dazzle

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published