A comprehensive Python library for controlling FlashForge 3D printers
Project description
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4580e2a765d5e1a9465c442057bbda17dc30575e7ca9147178f80831211dc7c7
|
|
| MD5 |
afc0f45049713f8e6089ffd8a4e657f6
|
|
| BLAKE2b-256 |
83ef32fa775bbb4d1652d3531509e4ddd776ac2173902ad122927bf2281012c9
|
File details
Details for the file flashforge_python_api-1.0.1-py3-none-any.whl.
File metadata
- Download URL: flashforge_python_api-1.0.1-py3-none-any.whl
- Upload date:
- Size: 65.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d27b49217832ed22b1081260ab8e7cc6631c6459c8c7126dad55c6bdcdd6fa
|
|
| MD5 |
d3f8773e21b1dac853d2922fcdc42bf6
|
|
| BLAKE2b-256 |
4a9c00c849947557376264fbbb80125c75a4d505fc0ee6be785a61e8ff17b901
|