Bee-Slicer-CLI: Standalone 3D Printer CLI Tool

Bee-Slicer-CLI Documentation

Table of Contents

  1. Project Overview
  2. Features
  3. Requirements
  4. Installation
  5. Usage
  6. Project Structure
  7. How It Works
  8. Technical Details
  9. Troubleshooting
  10. Comparison with Docker Version
  11. 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

  1. Print from G-code file - Transfer and print G-code files directly to SD card
  2. Load filament - Heat nozzle to 215°C and extrude 50mm of filament
  3. Unload filament - Heat nozzle to 215°C and retract 50mm of filament
  4. Calibrate Printer - Interactive wizard for bed leveling (Z-offset and screw adjustments)
  5. Monitor print progress - Passive monitoring of ongoing prints
  6. Automatic environment setup - Sets up Python 2.7 environment with required dependencies on first run
  7. Cross-platform support - Works on x86_64 (Miniconda) and ARM64/Raspberry Pi (virtualenv)

Requirements

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

  1. Connect to BEETHEFIRST printer via USB
  2. Analyze G-code file (read temperature commands, count lines)
  3. Transfer file to SD card as “ABCDE” (prevents file accumulation)
  4. Heat nozzle to target temperature (from M104/M109 commands)
  5. Initialize SD card with M21 command
  6. Select file with M23 abcde (lowercase filename)
  7. Start print with M33 (BEETHEFIRST-specific command)
  8. Monitor print status with M32 command

BEETHEFIRST-Specific Commands

The BEETHEFIRST firmware uses custom G-code commands:

Important: Unlike standard Marlin firmware, BEETHEFIRST uses M33 to start SD prints instead of the standard M24 command.

Technical Details

Platform Support

Dependencies

Automatically installed on first run:

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”

  1. Check USB connection: lsusb | grep BEEVERYCREATIVE
  2. Verify USB permissions: ls -l /dev/bus/usb/001/*
  3. Ensure you’re in the correct group (uucp or dialout)
  4. 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
  1. Verify G-code has M104/M109 heating commands
  2. Check file transfer completed successfully (100% in output)
  3. Wait for heating phase to complete
  4. Confirm M23 returned “File opened: ABCDE”
  5. Check M33 response returns “ok”
  6. 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.

Related
Software · 3D Printing · CLI · Python