Files
klipper-voron/printer_data/config/CUSTOM/set_material.cfg
T

670 lines
37 KiB
INI
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[gcode_macro SET_MATERIAL]
description: Dynamically adjust chamber temps, fans, and behavior based on material
# === OVERVIEW ===
# This macro sets print parameters based on the selected filament type.
# It includes logic for fan control, pressure advance tuning, and chamber temperature management.
# Each material is uniquely handled with comments, proper defaults, and warnings where applicable.
#
# === WHY USE THIS ===
# - Ensures consistent print settings per material
# - Automatically adjusts temperature and environment conditions
# - Reduces manual tuning between material changes
# - Helps enforce safety (drying warnings, chamber heat warnings, etc.)
#
# === HOW TO USE ===
# Call the macro with:
# SET_MATERIAL MATERIAL=<your_material>
#
# Example:
# SET_MATERIAL MATERIAL=ABS
#
# === SETUP REQUIREMENTS ===
# You MUST configure:
# - A chamber temperature sensor (e.g., temperature_sensor chamber_combined_mean)
# - A bed heater (e.g., heater_bed)
# - Optionally, a chamber heater (e.g., heater_generic chamber_heater)
# - A chamber circulation fan (e.g., nevermore_fan)
#
# === PARAMETERS ===
# MATERIAL: Name of the filament material preset to apply
# Supported: PLA, ABS, PETG, ASA, PC, PA, PEEK, PEK, TPU, etc.
# Extended support for exotic blends like ESD-ABS, PVDF, MetalFill, Foam PLA
#
# === NOTES ===
# - Each material includes chamber temp, fan speed, PA, and smoothing settings
# - Some materials apply Z offset compensation or recommend special nozzle/hardware
# - Certain blocks include warnings (e.g., "dry before use" or "use hardened nozzle")
# - If you do not have a chamber heater, set `ACTIVE_CHAMBER_HEATING = False`
# - You can expand this macro to include more materials as needed
# - Unknown materials fall back to a safe PLA-like default
#
# === ADVANCED ===
# This macro can be tied into slicer startup G-code or multi-material toolchanging macros.
# You can also use it in combination with filament sensors or manual menu macros.
gcode:
{% set CHAMBER_SENSOR = "temperature_sensor chamber_combined_mean" %}
{% set BED_HEATER = "heater_bed" %}
{% set BED_FAN = "nevermore_fan" %}
{% set ACTIVE_CHAMBER_HEATING = False %} # Set to True if you have a dedicated chamber heater configured
{% set CHAMBER_HEATER = "chamber_heater" if ACTIVE_CHAMBER_HEATING else "" %}
{% set MATERIAL = params.MATERIAL|default("PLA")|string %}
# --- Chamber-less Materials ---
{% if MATERIAL in ['PLA', 'PLA-CF', 'PE', 'PE-CF'] %}
# PLA: Easy to print, low warping, no chamber needed. CF = carbon fiber, stiffer and more abrasive.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.035 | Chamber: 25°C" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PLA+', 'SILK-PLA'] %}
# PLA+: Stronger, tougher PLA. Silk PLA has glossy finish but may string more.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.038 | Chamber: 25°C" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['PVDF', 'PVDF-CF', 'PVDF-GF'] %}
# PVDF: Chemical-resistant and strong. Requires high chamber temps and dry storage.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: 90°C | ⚠️ Moisture-sensitive. Dry before use." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET=90 SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL in ['ESD-PLA', 'ESD-ABS', 'ESD-PC', 'ESD-PEEK'] %}
# ESD-safe filaments for sensitive electronics. Can be brittle, dry before use.
{% set chamber_temp = 60 if 'PLA' in MATERIAL else 80 %}
{% set pa_val = 0.04 if 'PLA' in MATERIAL else 0.05 %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: " ~ pa_val|string ~ " | Chamber: " ~ chamber_temp|string ~ "°C | ⚠️ Dry before use for best performance." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={chamber_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA={pa_val} SMOOTH=0.045
{% elif MATERIAL == 'LW-PLA' %}
# LW-PLA: Lightweight PLA expands with heat. MUST reduce flow to ~65% manually.
{% set message = "Material: LW-PLA | PA: 0.03 | Chamber: 25°C | Reminder: Set flow to ~65%" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.2
SET_PA PA=0.03 SMOOTH=0.04
{% elif MATERIAL == 'PLA-FOAM' %}
# PLA-FOAM: Similar to LW-PLA, foams up at extrusion temps. Lower flow ~60%.
{% set message = "Material: PLA-FOAM | PA: 0.03 | Chamber: 25°C | Reminder: Set flow to ~60%" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.03 SMOOTH=0.04
{% elif MATERIAL in ['PETG', 'PETG-GF', 'PETG-CF', 'PET-CF'] %}
# PETG: Good strength/flexibility, more durable than PLA. May string. CF/GF are abrasive.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.03 | Chamber: 40°C" %}
RESPOND MSG="{message}"
M141 S40
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.03 SMOOTH=0.05
SET_GCODE_OFFSET Z=0.02 # PETG can be sticky; lift Z slightly to prevent nozzle drag
{% elif MATERIAL in ['ABS', 'ABS+', 'ABS-GF', 'ABS-CF'] %}
# ABS: Tough and heat-resistant, good for functional parts. Warps easily—requires enclosed chamber.
# CF (Carbon Fiber) / GF (Glass Fiber) versions are more rigid and very abrasive.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL in ['ASA', 'ASA+', 'ASA-GF', 'ASA-CF', 'ASA-Aero'] %}
# ASA: UV-resistant alternative to ABS. Great for outdoor parts. Needs similar chamber temps to ABS.
# ASA-GF and ASA-CF are even more rigid and more abrasive.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL == 'HIPS' %}
# HIPS: Used primarily as a dissolvable support for ABS. Requires similar chamber temps.
# ⚠️ Requires limonene bath for dissolution. Keep dry. May warp without chamber.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: HIPS | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dissolves in limonene. Keep dry." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'BVOH' %}
# BVOH: Superior water-soluble support material. Less stringy than PVA but still moisture sensitive.
# ⚠️ Store in drybox. Dissolves faster in warm water. Do not overcool during print.
{% set message = "Material: BVOH | PA: 0.035 | Chamber: 25°C | ⚠️ Store dry. Dissolves in water." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.2
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL == 'PP' %}
# PP: Light and chemical-resistant. Warps easily and has poor adhesion. Needs chamber and special bed surface.
# ⚠️ Use PP-specific bed surface. Avoid cooling drafts. May require brim or raft.
{% set target_temp = 55 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PP | PA: 0.04 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Warps easily. PP bed surface recommended." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL == 'PPSU' %}
# PPSU: High-performance thermoplastic. Chemical and heat-resistant. Needs very hot chamber and drying.
# ⚠️ Print with hardened nozzle. Needs chamber and high temps. Store dry.
{% set target_temp = 100 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PPSU | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Needs high temp & dry storage" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'ULTEM' or MATERIAL == 'PEI' %}
# ULTEM / PEI: Extremely strong. High temp aerospace/engineering plastic. Needs chamber + hardened nozzle.
# ⚠️ Only for high-end printers. Dry thoroughly. Print hot.
{% set target_temp = 120 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: ULTEM/PEI | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Industrial use only. Dry & hot." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL == 'POLYMAX-PC' %}
# Polymaker PolyMax PC: Easier-to-print Polycarbonate blend. Good strength and clarity. Less prone to warping.
# ⚠️ Still requires chamber and hardened nozzle for long-term use.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PolyMax PC | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Tough and clear. Handle like PC." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL == 'ULTRAFUSE-PAHT-CF15' %}
# BASF Ultrafuse PAHT CF15: High-temp nylon, 15% carbon fiber. Stiff, light, durable.
# ⚠️ Dry thoroughly. Use hardened nozzle. Requires chamber.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: Ultrafuse PAHT CF15 | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ High strength & very abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL == 'PRUSAMENT-PETG-CF' %}
# Prusament PETG CF: Stiffer than normal PETG, reduced warping, excellent layer adhesion.
# ⚠️ Abrasive. Use hardened nozzle. Watch for brittle breakages if overcooled.
{% set message = "Material: Prusament PETG-CF | PA: 0.04 | Chamber: 45°C | ⚠️ Abrasive. Great dimensional stability." %}
RESPOND MSG="{message}"
M141 S45
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.4
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL == 'PRUSAMENT-PLA-TOUGH' %}
# Prusament PLA Tough: Improved impact resistance vs. standard PLA. Still easy to print.
{% set message = "Material: Prusament PLA Tough | PA: 0.038 | Chamber: 25°C | Tougher than normal PLA." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['TPU-SOFT', 'TPU-85A'] %}
# TPU-Soft: Ultra-flexible variant. Requires extremely slow printing and short retractions.
# ⚠️ Direct drive required. Reduce speed to <20mm/s. Keep dry to avoid stringing.
{% set message = "Material: TPU-SOFT | PA: 0.055 | Chamber: 30°C | ⚠️ Print very slowly. Direct drive only." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.055 SMOOTH=0.035
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL == 'PA12-GF' %}
# PA12-GF: Glass-fiber filled Nylon 12. High strength, dimensional stability, very abrasive.
# ⚠️ Requires dry storage. Use hardened nozzle. Enclosure strongly recommended.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PA12-GF | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dry thoroughly, very abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL == 'BREAKAWAY' %}
# Breakaway: Rigid support material that peels away instead of dissolving. Great with ABS, ASA, PETG.
# ⚠️ Store dry. Avoid excessive cooling. Easy to print, good layer adhesion.
{% set message = "Material: Breakaway | PA: 0.035 | Chamber: 35°C | ⚠️ Peel-away support. Store dry." %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.035 SMOOTH=0.045
{% elif MATERIAL == 'NGEN' %}
# ColorFabb nGen: Easy-to-print PETG-like with smoother finish and less stringing. Based on Amphora AM3300.
{% set message = "Material: nGen | PA: 0.035 | Chamber: 30°C | Smoother than PETG, low stringing." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.045
{% elif MATERIAL == 'COLORFABB-HT' %}
# ColorFabb HT: High-temp, semi-crystalline Amphora-based copolyester. Tough and heat-resistant.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: ColorFabb HT | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | Tough and heat-tolerant. Dry before use." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'PPS' %}
# PPS: Exceptional chemical resistance, dimensional stability, and flame retardance. Used in automotive/aerospace.
{% set target_temp = 95 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PPS | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Industrial. Dry thoroughly. Print hot." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL in ['PVDF-BLEND', 'KYNAR', 'SOLEF'] %}
# PVDF Blend: Enhanced versions of PVDF for strength/flexibility. Used in semiconductors, chemical labs.
{% set target_temp = 85 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PVDF Blend | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Chemical resistant. Dry required." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'CARBONX-PC' %}
# CarbonX CFR-PC+: Carbon fiber-reinforced PC with excellent stiffness and heat performance.
# ⚠️ Use hardened nozzle. Dry before use. Requires enclosure.
{% set target_temp = 65 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: CarbonX PC+ | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ High stiffness, abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'ESUN-ABS+' %}
# eSun ABS+: Modified ABS with lower warping and easier layer adhesion. Still benefits from chamber heat.
{% set target_temp = 55 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: eSun ABS+ | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | Easier than regular ABS." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'RAISE3D-PLA+' %}
# Raise3D PLA+: Tougher PLA variant optimized for layer adhesion and strength.
{% set message = "Material: Raise3D PLA+ | PA: 0.038 | Chamber: 25°C | Tougher PLA with good printability." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['PA', 'PA-GF', 'PA-CF', 'PAHT-CF', 'PA12-CF'] %}
# Nylon (PA): Strong, flexible, and wear-resistant. Extremely moisture-sensitive — dry before printing!
# CF = Carbon Fiber, GF = Glass Fiber, PAHT = high-temp nylon. Abrasive: use a hardened nozzle.
{% set target_temp = 65 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dry thoroughly before use" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL in ['PC', 'PC-CF', 'PCTG'] %}
# PC (Polycarbonate): Very strong and heat resistant. Needs hot chamber. Tends to warp and absorb moisture.
# PC-CF is stiffer and more rigid. PCTG is a more forgiving blend.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL in ['PC-ABS', 'PCABS'] %}
# PC-ABS: Blend of PC and ABS. Easier to print than pure PC. Still wants a hot chamber and enclosure.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'PEEK' %}
# PEEK: Ultra high-performance. Requires extremely hot chamber (110°C+). Dry thoroughly before use.
# Used in aerospace, medical, and industrial applications. Hardened nozzle & all-metal hotend required.
{% set target_temp = 110 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PEEK | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL == 'PEK' %}
# PEK: Slightly lower-temp cousin of PEEK. Still high performance and needs special hardware.
{% set target_temp = 90 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PEK | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.05
{% elif MATERIAL == 'TPU' %}
# TPU: Flexible filament. Needs slow print speed. Watch for oozing. Can stretch during retraction.
# ⚠️ Tips: Print very slowly (15-30mm/s). Use direct drive. Avoid long Bowden tubes. Dry before use if soft or stringy.
{% set message = "Material: TPU | PA: 0.055 | Chamber: 35°C | ⚠️ Go slow, direct drive recommended" %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.055 SMOOTH=0.04
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL == 'TPE' %}
# TPE: Very soft rubber-like filament. Print slowly. Use direct drive extruder.
# ⚠️ Tips: Reduce retraction. Very flexible – print <25mm/s. May require increased nozzle temp. Dry before use.
{% set message = "Material: TPE | PA: 0.05 | Chamber: 30°C | ⚠️ Slow speed, direct drive only" %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.05 SMOOTH=0.04
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL in ['NINJAFLEX', 'NINJA-FLEX'] %}
# NinjaFlex: Ultra-flexible. Print extremely slow. Hard to control extrusion. Direct drive required.
# ⚠️ Tips: Dry well. No retraction if possible. Tight filament path. Print 10–20mm/s.
{% set message = "Material: Ninjaflex | PA: 0.045 | Chamber: 30°C | ⚠️ Print <20mm/s. No Bowden setups." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.045 SMOOTH=0.035
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL in ['METALFILL', 'BRONZEFILL', 'COPPERFILL'] %}
# MetalFill: PLA blended with metal powder. Heavy, beautiful finish. Extremely abrasive—use hardened nozzle.
# ⚠️ Tips: Slower speed, hardened nozzle, check for settling in filament spool.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.04 | Chamber: 35°C | ⚠️ Abrasive – use hardened nozzle" %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL in ['IRONFILL', 'MAGNETICFILL'] %}
# Magnetic/iron PLA: Similar to MetalFill but can rust. Very abrasive. Hardened steel nozzle recommended.
# ⚠️ Store dry to avoid rust. May interfere with inductive sensors.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.04 | Chamber: 35°C | ⚠️ Abrasive. Keep dry." %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL in ['WOODFILL', 'CARBONFILL', 'KEVLARFILL'] %}
# Filled composites: Can clog if retracted too much. Lower print speeds. Use wider nozzle (0.6mm+) and hardened tip.
# ⚠️ Avoid retraction-heavy prints. Watch for clogs. WoodFill can scorch – keep nozzle temp moderate.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.045 | Chamber: 40°C | ⚠️ Composite: Use 0.6mm+ hardened nozzle" %}
RESPOND MSG="{message}"
M141 S40
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL in ['MOLDLAY', 'CASTFIL', 'CASTING'] %}
# MoldLay: Used for casting. Can be melted out like wax. Brittle and needs low chamber temps.
# ⚠️ Avoid excessive cooling. Brittle at room temp. Supports should be minimal.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.035 | Chamber: 25°C | ⚠️ Brittle – handle gently post-print" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PVA', 'SUPPORT-PVA'] %}
# PVA: Water-soluble support material. Store in airtight container. Extremely moisture-sensitive.
{% set message = "Material: PVA | PA: 0.035 | Chamber: 25°C | ⚠️ Water Soluble & Moisture Sensitive" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.0 # No fan to avoid drafts/drying out
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PMMA', 'ACRYLIC'] %}
# PMMA: Transparent, acrylic-like. Shrinks a lot—needs chamber. Often cracks if too cold. Store dry.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PMMA | PA: 0.04 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Brittle when moist, dry thoroughly" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.04 SMOOTH=0.045
{% else %}
# Default fallback for unknown materials
RESPOND MSG="Material: Unknown | Default PA: 0.04 | Chamber: 25°C"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% endif %}
[gcode_macro SET_PA]
description: Set Pressure Advance for the printer
variable_pa: 0.04
# === OVERVIEW ===
# This macro sets the Pressure Advance (PA) and smoothing values for your printer.
# Pressure Advance compensates for pressure build-up in the nozzle, improving corners and extrusion consistency.
# The smoothing value reduces sudden changes by blending movement transitions.
#
# This macro is useful when tuning PA per-material or per-print, and can be used dynamically during a print or via your slicer.
#
# === HOW TO USE ===
# Call the macro with:
# SET_PA PA=<advance_value> [SMOOTH=<smoothing_value>]
#
# Example:
# SET_PA PA=0.045
# SET_PA PA=0.050 SMOOTH=0.04
#
# === PARAMETERS ===
# PA: The desired pressure advance value (required)
# SMOOTH: Optional smoothing value (default: 0.045)
#
# === NOTES ===
# - Pressure Advance tuning is material- and setup-dependent.
# - You can call this from your slicer as a custom G-code before the print starts.
# - The value is stored in a macro variable (variable_pa) so it can be referenced or reset easily.
gcode:
{% set pa = params.PA|float %}
{% set smooth = params.SMOOTH|default(0.045)|float %}
# Apply Pressure Advance and smoothing time
SET_PRESSURE_ADVANCE ADVANCE={pa} SMOOTH_TIME={smooth}
# Store the value for reference
SET_GCODE_VARIABLE MACRO=SET_PA VARIABLE=pa VALUE={pa}
# Optional: echo back confirmation (uncomment if desired)
# {% set message = "Pressure Advance set to " ~ pa|string ~ " | Smoothing: " ~ smooth|string %}
# RESPOND MSG="{message}"
[gcode_macro SET_CHAMBER_HEAT]
description: Modular chamber heating logic with active/passive support, includes safety checks and debug output
# === OVERVIEW ===
# This macro heats the chamber to a target temperature using either:
# 1. An active heater (like a dedicated chamber heater), or
# 2. Passive heating (using the bed heater).
# It controls the bed heater, an optional chamber heater, and a circulation fan.
# It will block until the target temperature is reached.
# === SAFETY WARNINGS ===
# - Ensure your chamber temperature sensor is correctly installed and reporting.
# - Watch your printer during the first few uses of this macro.
# - Passive mode may take a long time to reach temperature.
# - Don't overheat your enclosure — check max safe temps for your printer!
# === PARAMETERS ===
# TARGET : (required) Target chamber temperature in °C.
# SENSOR : (optional) Temperature sensor name (default: temperature_sensor chamber_combined_mean).
# HEATER : (optional) Chamber heater name (used only if ACTIVE=True).
# BED_HEATER : (optional) Bed heater name (default: heater_bed).
# FAN : (optional) Circulation fan name (default: nevermore_fan).
# ACTIVE : (optional) If True, uses a dedicated heater; otherwise uses passive heating.
# === USAGE ===
# SET_CHAMBER_HEAT TARGET=60 ACTIVE=True HEATER="heater_generic chamber_heater"
# SET_CHAMBER_HEAT TARGET=60 ACTIVE=False
gcode:
# === Parse Parameters ===
{% set target = params.TARGET|int %} # Desired chamber temperature
{% set sensor = params.SENSOR|default('temperature_sensor chamber_combined_mean') %} # Sensor to read chamber temp
{% set heater = params.HEATER|default('') %} # Optional active chamber heater
{% set bed_heater = params.BED_HEATER|default('heater_bed') %} # Bed heater
{% set bed_fan = params.FAN|default('nevermore_fan') %} # Circulation fan
# Normalize ACTIVE to a proper boolean
{% set active = params.ACTIVE|default("false")|lower == 'true' %} # True = use chamber heater, False = use bed only
# Calculate the temperature to wait for — passive mode waits for less (25°C below target)
{% set wait_temp = target if active else target - 25 %}
# === Initial Message ===
{% set message = "[CHAMBER HEAT] Starting chamber heat routine (Target: " ~ target|string ~ "°C, Wait: " ~ wait_temp|string ~ "°C, Mode: " ~ ("Active" if active else "Passive") ~ ")" %}
RESPOND MSG="{message}"
# Set M141 for visual tools (slicer/monitor) to track chamber temperature
M141 S{target}
# === ACTIVE MODE ===
{% if active %}
{% set message = "[CHAMBER HEAT] Activating chamber heater and bed heater to " ~ target|string ~ "°C" %}
RESPOND MSG="{message}"
# Set chamber heater temp (if provided)
{% if heater|length > 0 %}
SET_HEATER_TEMPERATURE HEATER={heater} TARGET={target}
{% endif %}
# Set bed heater to the same target (helps speed up heating)
SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET={target}
# Turn circulation fan on full to spread heat
SET_FAN_SPEED FAN={bed_fan} SPEED=1
# === PASSIVE MODE ===
{% else %}
# If the chamber is below the passive-mode target threshold
{% if printer[sensor].temperature < wait_temp %}
{% set message = "[CHAMBER HEAT] Chamber below " ~ wait_temp|string ~ "°C — passively heating via bed" %}
RESPOND MSG="{message}"
# Turn on fan at half speed (gentle circulation)
SET_FAN_SPEED FAN={bed_fan} SPEED=0.5
# Set bed heater to a high temp (120°C) to warm chamber indirectly
SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET=120
# Wait until bed reaches temperature
TEMPERATURE_WAIT SENSOR="{bed_heater}" MINIMUM=120
{% else %}
# Chamber is already close enough to the desired temperature
{% set message = "[CHAMBER HEAT] Chamber already warm enough for passive mode (" ~ printer[sensor].temperature|round(1)|string ~ "°C)" %}
RESPOND MSG="{message}"
{% endif %}
# Once warmed, run the circulation fan at full speed
SET_FAN_SPEED FAN={bed_fan} SPEED=1
{% endif %}
# === FINAL BLOCKING WAIT ===
{% set message = "[CHAMBER HEAT] Waiting for chamber to reach " ~ wait_temp|string ~ "°C..." %}
RESPOND MSG="{message}"
# Block until the chamber temp sensor reads the required temp
TEMPERATURE_WAIT SENSOR="{sensor}" MINIMUM={wait_temp}
# Confirm chamber is ready
{% set message = "[CHAMBER HEAT] Chamber ready at " ~ printer[sensor].temperature|round(1)|string ~ "°C" %}
RESPOND MSG="{message}"
[gcode_macro M106]
rename_existing: G106
description: Compresses fan speeds into 10–30% range if bed temp ≥ 70°C
# === OVERVIEW ===
# This macro overrides the default M106 behavior to apply a thermal-aware fan speed limiter.
# When the bed temperature is at or above 70°C, it compresses the part cooling fan speed range
# into a safer 10–30% range (i.e., 26–76 PWM) to reduce warping or delamination in high-temp materials.
#
# === WHY USE THIS ===
# - Prevents excessive part cooling when printing materials like ABS, ASA, or PC.
# - Helps maintain stable chamber temperatures and reduce thermal shock.
# - Minimizes curling or layer splitting due to sudden cooling on hot beds.
#
# === HOW TO USE ===
# Simply use M106 S<value> as usual in your G-code or slicer.
# The macro will automatically adjust the fan speed if needed based on bed temperature.
#
# === NOTES ===
# - This logic only applies when the bed temperature is 70°C or higher.
# - Below 70°C, full-range fan control is allowed.
# - You can customize the input/output compression range if needed.
# === PARAMETERS ===
# S: Standard fan speed in 0–255 (required by M106)
# Internal constants:
# min_input = 26 (10% of 255)
# max_input = 255 (100%)
# min_output = 26 (10%)
# max_output = 76 (30%)
gcode:
{% set fan_speed = params.S|default(0)|int %}
{% set bed_temp = printer["heater_bed"].temperature %}
{% set min_input = 26 %}
{% set max_input = 255 %}
{% set min_output = 26 %}
{% set max_output = 76 %}
{% if bed_temp >= 70 %}
# If below threshold, limit fan to the lower compressed range (10–30%)
{% if fan_speed < min_input %}
{% set compressed_speed = min_output %}
{% else %}
{% set compressed_speed = (min_output + ((fan_speed - min_input) * (max_output - min_output) / (max_input - min_input)))|int %}
{% endif %}
G106 S{compressed_speed}
{% else %}
# Below threshold, allow full fan speed as requested
G106 S{fan_speed}
{% endif %}