New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fast-gcode-analyzer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-gcode-analyzer

Libreria per analizzare file G-code di stampe 3D, calcolare layer, filamento e spreco

latest
npmnpm
Version
1.3.8
Version published
Weekly downloads
7
600%
Maintainers
1
Weekly downloads
 
Created
Source

📊 fast-gcode-analyzer

Libreria per analizzare file G-code di stampe 3D e calcolare statistiche come layer, filamento, tempo di stampa e costi stimati.

🧩 Slicer Supportati

  • 🐼 Bambu Studio / Bambu Lab
  • 🐋 OrcaSlicer
  • 🏗️ Creality Print
  • ⚙️ Anycubic

✨ Caratteristiche

  • Estrazione Dati Essenziali: Legge tempo di stampa, lunghezza del filamento, numero di layer, altezza layer, ecc.
  • Calcolo Costi: Stima il peso e il costo del materiale anche se non sono specificati nel G-code.
  • Progettata per l'Integrazione: Usabile come libreria Node.js in progetti propri o CLI tool.
  • Leggera: Nessuna dipendenza esterna.

📦 Installazione

Installa il pacchetto nel tuo progetto tramite npm:

npm install fast-gcode-analyzer

🚀 Utilizzo
🔹 CommonJS (predefinito in Node.js)

✅ Metodo consigliato se non hai "type": "module" nel tuo package.json.
const { parseGCode } = require("fast-gcode-analyzer");

(async () => {
  const filePath = "./esempi/test_bambu.gcode";
  const pricePerKg = 20; // €/kg (opzionale)

  try {
    console.log(`\n🔬 Analizzando il file: ${filePath}...`);
    const stats = await parseGCode(filePath, pricePerKg);
    console.log("\n📊 Risultato Analisi G-code:");
    console.log(stats);
  } catch (error) {
    console.error("❌ Errore:", error.message);
  }
})();

🔹 ES Module (ESM)

Usa questo formato se nel tuo package.json è presente "type": "module".
import { parseGCode } from "fast-gcode-analyzer";

(async () => {
  const filePath = "./esempi/test_bambu.gcode";
  const stats = await parseGCode(filePath, 15); // 15 €/kg
  console.log(stats);
})();

⚙️ API Reference
parseGCode(filePath, pricePerKg?)
Parametro	Tipo	Descrizione
filePath	String	Obbligatorio. Percorso del file .gcode da analizzare.
pricePerKg	Number	Opzionale. Prezzo del filamento in €/kg per il calcolo del costo.
Oggetto Restituito

Restituisce una Promise che risolve in un oggetto con le seguenti proprietà:

Proprietà	Tipo	Descrizione
slicer	String	Nome dello slicer rilevato.
filamentType	String	Tipo di filamento (es. "PLA", "PETG", "1" per multi-material).
filamentLengthM	Number	Lunghezza del filamento in metri.
filamentWeight	Number	Peso stimato del filamento in grammi (g).
filamentCost	Number	Costo stimato del filamento in euro (€).
printTimeFormatted	String	Tempo di stampa stimato in formato leggibile.
printTimeSeconds	Number	Tempo di stampa stimato in secondi.
totalLayers	Number	Numero totale di layer.
layerHeight	Number	Altezza del layer in millimetri (mm).
🖥️ Esempi di Output
🔸 Bambu Studio / Bambu Lab
{
  "slicer": "Bambu Studio",
  "filamentType": "1",
  "filamentLengthM": 71.05,
  "filamentWeight": 211.9,
  "filamentCost": 4.24,
  "printTimeFormatted": "5h 19m 28s",
  "printTimeSeconds": 19168,
  "totalLayers": 350,
  "layerHeight": 70.2
}

🔸 OrcaSlicer
{
  "slicer": "OrcaSlicer",
  "filamentType": "PLA",
  "filamentLengthM": 120.5,
  "filamentWeight": 358.1,
  "filamentCost": 5.37,
  "printTimeFormatted": "3h 45m",
  "printTimeSeconds": 13500,
  "totalLayers": 150,
  "layerHeight": 0.2
}

📌 Note

Se il file G-code non contiene informazioni su peso o costo, la libreria li stima automaticamente.

Il calcolo del peso assume filamento PLA 1.75 mm (~2.97 g/m).

Compatibile con file G-code generati da slicer multipli, anche misti.

📜 Licenza

Rilasciato sotto licenza MIT.
Copyright © 2025
Gabriele Dell'Aquila (Spongix)

Keywords

3dprint

FAQs

Package last updated on 27 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts