Skip to main content

A comprehensive Python library for controlling FlashForge 3D printers

Project description

FlashForge Python API

A comprehensive Python library for controlling FlashForge 3D printers.

PyPI Python License

Features & Capabilities

Feature Description
Printer Discovery Automatic UDP broadcast discovery of printers on the network
Full Control Movement (G1), Homing (G28), Temperature (M104/M140), Fans, LED
Real-time Monitoring Live status (M119), Temperatures (M105), Print Progress (M27)
Job Management Start, Pause, Resume, Cancel, File Upload & Listing
Advanced Parsing Thumbnail extraction (M662), Endstop monitoring, Machine state
Dual Protocol Modern HTTP API + Legacy TCP G-code support
Async Support Native async/await implementation for all operations
Type Safety Full type hints and Pydantic models for robust development

Supported Hardware

Model Support Level Connection Type
FlashForge Adventurer 5M / 5M Pro Full Support HTTP + TCP
FlashForge Adventurer 5X Full Support HTTP + TCP
FlashForge Adventurer 3 / 4 Partial Support TCP (Legacy)
Other Networked FlashForge Printers Experimental TCP (Generic)

Compatible Slicers

Slicer Compatibility Notes
OrcaSlicer High Recommended for Adventurer 5M series
FlashPrint Full Official FlashForge slicer
Orca-FlashForge High Optimized for FlashForge printers
Cura / PrusaSlicer Basic Requires correct G-code flavor

Installation

Command
pip install flashforge-python-api

Usage Examples

Printer Discovery

Discover printers on your local network automatically.
from flashforge import FlashForgePrinterDiscovery
import asyncio

async def discover():
    discovery = FlashForgePrinterDiscovery()
    printers = await discovery.discover_printers_async()
    for printer in printers:
        print(f"Found: {printer.name} at {printer.ip_address}")

asyncio.run(discover())

Basic Control

Connect to a printer and perform basic operations like setting temperature and homing.
from flashforge import FlashForgeClient
import asyncio

async def control_printer():
    # Initialize client with printer details
    client = FlashForgeClient("192.168.1.100", "SERIAL_NUMBER", "CHECK_CODE")

    if await client.initialize():
        print(f"Connected to {client.printer_name}")

        # Set bed temperature to 60°C
        await client.temp_control.set_bed_temp(60)

        # Home all axes
        await client.control.home_xyz()

        await client.dispose()

asyncio.run(control_printer())

Real-time Status Monitoring

Monitor printer status, temperatures, and print progress.
from flashforge import FlashForgeClient
import asyncio

async def monitor_printer():
    async with FlashForgeClient("192.168.1.100", "SERIAL", "CODE") as client:
        # Get comprehensive status
        status = await client.get_printer_status()
        print(f"Machine State: {status.machine_state}")

        # Get temperatures via TCP
        temps = await client.tcp_client.get_temp_info()
        if temps:
            bed = temps.get_bed_temp()
            extruder = temps.get_extruder_temp()
            print(f"Bed: {bed.get_current()}°C / {bed.get_target()}°C")
            print(f"Extruder: {extruder.get_current()}°C / {extruder.get_target()}°C")

        # Check print progress
        layer_p, sd_p, current_layer = await client.tcp_client.get_print_progress()
        print(f"Progress: {layer_p}% (Layer {current_layer})")

asyncio.run(monitor_printer())

File Operations & Thumbnails

List files on the printer and extract thumbnails.
from flashforge import FlashForgeClient
import asyncio

async def file_ops():
    async with FlashForgeClient("192.168.1.100", "SERIAL", "CODE") as client:
        # List files
        files = await client.files.get_file_list()
        for filename in files:
            print(f"File: {filename}")

            # Get thumbnail
            thumb = await client.tcp_client.get_thumbnail(filename)
            if thumb and thumb.has_image_data():
                print(f"Thumbnail found: {len(thumb.get_image_bytes())} bytes")
                # thumb.save_to_file_sync(f"{filename}.png")

asyncio.run(file_ops())

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

flashforge_python_api-1.0.1.tar.gz (97.3 kB view details)

Uploaded Source

Built Distribution

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

flashforge_python_api-1.0.1-py3-none-any.whl (65.4 kB view details)

Uploaded Python 3

File details

Details for the file flashforge_python_api-1.0.1.tar.gz.

File metadata

  • Download URL: flashforge_python_api-1.0.1.tar.gz
  • Upload date:
  • Size: 97.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for flashforge_python_api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4580e2a765d5e1a9465c442057bbda17dc30575e7ca9147178f80831211dc7c7
MD5 afc0f45049713f8e6089ffd8a4e657f6
BLAKE2b-256 83ef32fa775bbb4d1652d3531509e4ddd776ac2173902ad122927bf2281012c9

See more details on using hashes here.

File details

Details for the file flashforge_python_api-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flashforge_python_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5d27b49217832ed22b1081260ab8e7cc6631c6459c8c7126dad55c6bdcdd6fa
MD5 d3f8773e21b1dac853d2922fcdc42bf6
BLAKE2b-256 4a9c00c849947557376264fbbb80125c75a4d505fc0ee6be785a61e8ff17b901

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