Bee-Slicer-CLI Documentation
Table of Contents
- Project Overview
- Features
- Requirements
- Installation
- Usage
- Project Structure
- How It Works
- Technical Details
- Troubleshooting
- Comparison with Docker Version
- Source Code
Project Overview
Bee-Slicer-CLI is a standalone command-line interface tool for managing BEETHEFIRST and BEETHEFIRST+ 3D printers. Unlike the original Docker-based version, this tool runs directly on your system using Python 2.7, making it much simpler to set up and use.
The tool provides a complete solution for 3D printing workflows including file transfer, temperature management, and printer calibration, all without requiring Docker containers.
Features
- Print from G-code file - Transfer and print G-code files directly to SD card
- Load filament - Heat nozzle to 215°C and extrude 50mm of filament
- Unload filament - Heat nozzle to 215°C and retract 50mm of filament
- Calibrate Printer - Interactive wizard for bed leveling (Z-offset and screw adjustments)
- Monitor print progress - Passive monitoring of ongoing prints
- Automatic environment setup - Sets up Python 2.7 environment with required dependencies on first run
- Cross-platform support - Works on x86_64 (Miniconda) and ARM64/Raspberry Pi (virtualenv)
Requirements
- BEETHEFIRST or BEETHEFIRST+ printer connected via USB
- Linux operating system (tested on Arch Linux)
- USB permissions configured (see setup instructions below)
- Internet connection (first run only, to download Miniconda if needed)
Installation
No complex installation required! Simply clone the repository and make the script executable:
git clone https://github.com/CMDR-Shrine/Bee-Slicer-CLI.git
cd Bee-Slicer-CLI
chmod +x print.sh
The first run will automatically set up the Python environment and install required dependencies.
Usage
Interactive Menu
Run the script without arguments to access the interactive menu:
./print.sh
This displays:
BEETHEFIRST STANDALONE PRINTER CLI
Select an option:
1) Print from G-code file
2) Load filament (heat + extrude)
3) Unload filament (heat + retract)
4) Monitor print progress (passive)
5) Calibrate Printer (Bed Leveling)
6) Exit
Direct Commands
You can also run commands directly:
# Print a G-code file
./print.sh /path/to/your/print.gcode
# Load filament
./print.sh load
# Unload filament
./print.sh unload
# Monitor print progress
./print.sh monitor
# Start calibration
./print.sh calibrate
USB Permissions Setup
Configure USB permissions for your user:
Arch Linux:
sudo usermod -a -G uucp $USER
Ubuntu/Debian:
sudo usermod -a -G dialout $USER
Install udev rules:
sudo cp config/99-beeverycreative.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
Verify printer detection:
lsusb | grep BEEVERYCREATIVE
Project Structure
Bee-Slicer-CLI/
├── print.sh # Main CLI wrapper script
├── config/ # Configuration files
│ └── 99-beeverycreative.rules # udev rules for USB permissions
├── src/ # Python source code
│ ├── print.py # Print G-code files
│ ├── load.py # Load filament utility
│ ├── unload.py # Unload filament utility
│ ├── calibrate.py # Printer calibration wizard
│ ├── monitor.py # Print progress monitor
│ └── beedriver/ # USB printer driver library
├── API.md # beedriver API documentation
├── README.md # Project README
├── LICENSE # License file
└── CRITICAL_FIXES.md # Critical fixes documentation
How It Works
Print Workflow
- Connect to BEETHEFIRST printer via USB
- Analyze G-code file (read temperature commands, count lines)
- Transfer file to SD card as “ABCDE” (prevents file accumulation)
- Heat nozzle to target temperature (from M104/M109 commands)
- Initialize SD card with M21 command
- Select file with M23 abcde (lowercase filename)
- Start print with M33 (BEETHEFIRST-specific command)
- Monitor print status with M32 command
BEETHEFIRST-Specific Commands
The BEETHEFIRST firmware uses custom G-code commands:
- M21 - Initialize SD card
- M23 - Select SD file (must be lowercase!)
- M33 - Start SD print (replaces standard M24)
- M32 - Query print session variables (progress monitoring)
Important: Unlike standard Marlin firmware, BEETHEFIRST uses M33 to start SD prints instead of the standard M24 command.
Technical Details
Platform Support
- x86_64: Uses Miniconda Python 2.7 environment
- ARM64/aarch64 (Raspberry Pi): Uses system Python 2.7 + virtualenv
Dependencies
Automatically installed on first run:
- Python 2.7
- pyusb==1.0.2 (USB communication)
- pyserial==2.7 (serial communication)
Architecture Detection
The script automatically detects your system architecture and uses the appropriate Python setup:
# x86_64 systems
# Uses: ~/miniconda3/envs/beethefirst (Miniconda)
# ARM64 systems (Raspberry Pi)
# Uses: .venv_py27 (virtualenv)
Troubleshooting
“No printer found”
- Check USB connection:
lsusb | grep BEEVERYCREATIVE - Verify USB permissions:
ls -l /dev/bus/usb/001/* - Ensure you’re in the correct group (
uucpordialout) - Try unplugging and replugging the USB cable
“Resource busy”
Another program is using the printer:
# Check what's using the printer
sudo lsof /dev/bus/usb/001/* 2>/dev/null
# Stop BEEweb if running
docker stop beeweb-server
Print doesn’t start
- Verify G-code has M104/M109 heating commands
- Check file transfer completed successfully (100% in output)
- Wait for heating phase to complete
- Confirm M23 returned “File opened: ABCDE”
- Check M33 response returns “ok”
- Monitor M32 output for print session variables (A, B, C, D values)
“Command not found: conda”
Delete ~/miniconda3 and run again - the script will reinstall Miniconda2.
Comparison with Docker Version
| Feature | Docker Version | Standalone CLI |
|---|---|---|
| Setup complexity | High (Docker required) | Low (automatic) |
| First run time | 5-10 min (build image) | 2-3 min (download) |
| Subsequent runs | Instant | Instant |
| Disk space | ~500MB | ~300MB |
| Dependencies | Docker | wget |
| Updates | Rebuild image | Update scripts |
Source Code
Main CLI Script (print.sh)
#!/bin/bash
#
# BEETHEFIRST Standalone Printer CLI
# No Docker required - uses Miniconda Python 2.7 environment (x86_64)
# or system Python 2.7 + virtualenv (ARM64/Raspberry Pi)
#
# ... (full script content shown above)
Python Print Module (src/print.py)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Print G-code file to BEETHEFIRST printer
#
import sys
import os
import time
import re
# Add beedriver to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'beedriver'))
from beedriver import beecommand
def print_gcode(filename):
"""Print a G-code file to the printer"""
# Implementation details...
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python print.py <gcode_file>")
sys.exit(1)
print_gcode(sys.argv[1])
For complete source code and API documentation, visit the Bee-Slicer-CLI GitHub repository.