You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 🔧 A robust, cross-platform API for FlashForge 3D printers, created through reverse-engineering of the communication between the printer(s) and FlashForge software.
4
-
5
-
## 🌟 About
6
-
7
-
Built upon the foundation of my previous [C# API](https://github.com/GhostTypes/ff-5mp-api), this TypeScript implementation is designed for **easier cross-platform usage and development**.
This guide will walk you through using the API with different generations of FlashForge printers.
41
-
42
-
### Legacy Printers (Adventurer 3/4, etc.)
43
-
44
-
Older FlashForge printers use a "legacy" TCP-based API. This API is more limited but still provides core functionality like job control and status monitoring.
45
-
46
-
To connect to a legacy printer, you only need its IP address.
1
+
<divalign="center">
2
+
<h1>FlashForge TypeScript API</h1>
3
+
<p>
4
+
A robust, cross-platform API for FlashForge 3D printers, created through
5
+
reverse-engineering the communication between the printers and FlashForge software.
This section covers how to use the API with both legacy FlashForge printers and
123
+
newer models such as the Adventurer 5M / 5M Pro and AD5X.
124
+
</p>
125
+
</div>
126
+
127
+
<br>
128
+
129
+
<divalign="center">
130
+
<h3>Legacy Printers (Adventurer 3 / 4)</h3>
131
+
<p>
132
+
Legacy FlashForge printers use a TCP-based protocol which provides basic job control,
133
+
printer information, and status monitoring. Connecting only requires the printer’s IP address.
134
+
</p>
135
+
</div>
47
136
48
137
```typescript
49
138
import { FlashForgeClient } from'ff-api';
@@ -65,7 +154,6 @@ async function main() {
65
154
console.log(`Firmware: ${info.FirmwareVersion}`);
66
155
}
67
156
68
-
// Remember to dispose of the client when done
69
157
awaitclient.dispose();
70
158
} else {
71
159
console.log("Failed to connect to printer.");
@@ -74,20 +162,11 @@ async function main() {
74
162
75
163
main();
76
164
```
77
-
78
-
**Functionality Notes:**
79
-
-**Basic Control:** Full control over starting, stopping, and pausing jobs.
80
-
-**Status Monitoring:** Get basic printer info, temperature, and job progress.
81
-
-**No File Uploads:** The legacy API does not support uploading files. You must print files already on the printer.
82
-
-**Slower Thumbnails:** Retrieving model preview images can be slow.
83
-
84
-
---
85
-
86
-
### Adventurer 5M / 5M Pro
87
-
88
-
The Adventurer 5 series introduced a new, more powerful HTTP-based API, while retaining the legacy TCP API for specific features like direct G-code control. This hybrid approach offers the best of both worlds.
89
-
90
-
To connect, you'll need the printer's IP address, serial number, and a "check code". These can be found in the printer's network settings.
165
+
<br>
166
+
<divalign="center">
167
+
<h3>Adventurer 5M / 5M Pro</h3>
168
+
<p> The Adventurer 5 series uses an improved HTTP API for fast, modern communication, while still supporting legacy TCP-based G-code control. You will need the printer’s <strong>IP address</strong>, <strong>serial number</strong>, and <strong>check code</strong></p>
169
+
</div>
91
170
92
171
```typescript
93
172
import { FiveMClient } from'ff-api';
@@ -126,25 +205,11 @@ async function main() {
126
205
main();
127
206
```
128
207
129
-
**Functionality Notes:**
130
-
-**All Legacy Features:** Includes all capabilities of the legacy API.
131
-
-**File Uploads:** Easily upload G-code files directly to the printer.
132
-
-**Rich Information:** Access detailed information about the printer, job status, and print time estimates.
133
-
-**Fast Thumbnails:** Model previews are retrieved quickly over the HTTP API.
134
-
135
-
---
136
-
137
-
### Adventurer 5X (AD5X)
138
-
139
-
The AD5X uses the same powerful HTTP API as the 5M series but adds specialized support for its **Intelligent Filament Station (IFS)**, enabling multi-color and multi-material printing. The API provides dedicated methods and data models to manage this functionality.
140
-
141
-
Connecting to an AD5X is identical to a standard 5M.
142
-
143
-
#### Checking the Material Station (IFS)
144
-
145
-
After connecting, you can get detailed information about the Intelligent Filament Station. The `FFMachineInfo` object, accessible via `client.info.machineInfo` after a successful connection, contains all the details.
146
-
147
-
The `MatlStationInfo` property provides a comprehensive status of the IFS, including the state of each slot.
208
+
<divalign="center">
209
+
<h3>Adventurer 5X (AD5X)</h3>
210
+
<p>The AD5X uses the same powerful HTTP API as the 5M series but adds specialized support for its <strong>Intelligent Filament Station (IFS)</strong>, enabling multi-color and multi-material printing. The API provides dedicated methods and data models to manage this functionality.</p>
211
+
<p> Connecting to an AD5X is identical to a standard 5M. </p>
212
+
</div>
148
213
149
214
```typescript
150
215
import { FiveMClient } from'ff-api';
@@ -183,12 +248,10 @@ async function checkIFS() {
183
248
checkIFS();
184
249
```
185
250
186
-
#### Starting a Multi-Color Print
251
+
<divalign="center"> <h4>Starting a Multi-Color Print</h4> <p> To start a multi-color print, you need to provide <code>materialMappings</code>. This array links the tool ID from your G-code file to a specific slot in the material station. </p> <p> - <code>toolId</code>: The tool index from your slicing software (0-3).
187
252
188
-
To start a multi-color print, you need to provide `materialMappings`. This array links the tool ID from your G-code file to a specific slot in the material station.
189
253
190
-
-`toolId`: The tool index from your slicing software (0-3).
191
-
-`slotId`: The physical slot on the material station (1-4).
254
+
- <code>slotId</code>: The physical slot on the material station (1-4). </p> </div>
@@ -219,9 +282,7 @@ async function startMultiColor() {
219
282
}
220
283
```
221
284
222
-
#### Starting a Single-Color Print
223
-
224
-
For single-color prints, you can use a simpler method that doesn't require material mappings. The printer will use the currently loaded filament.
285
+
<divalign="center"> <h4>Starting a Single-Color Print</h4> <p> For single-color prints, you can use a simpler method that doesn't require material mappings. The printer will use the currently loaded filament. </p> </div>
@@ -246,13 +307,5 @@ async function startSingleColor() {
246
307
}
247
308
```
248
309
249
-
#### Uploading Files for AD5X
250
-
251
-
You can also upload files with material mappings directly using `uploadFileAD5X`. The `materialMappings` are Base64-encoded and sent in the headers automatically.
310
+
<divalign="center"> <h4>Uploading Files for AD5X</h4> <p> You can also upload files with material mappings directly using <code>uploadFileAD5X</code>. The material mappings are Base64-encoded and sent in the headers automatically. </p> </div>
252
311
253
-
**Functionality Notes:**
254
-
-**All 5M/Pro Features:** Inherits all functionality from the standard 5M series.
255
-
-**Intelligent Filament Station (IFS):** Provides detailed status and control over the multi-material station.
256
-
-**Material Mapping:** Allows precise control over which filament is used for each part of a multi-material print.
257
-
-**Dedicated Job Methods:** Separate, validated methods for starting single-color and multi-color jobs simplify development.
0 commit comments