BambuProjectSettings
Package: Libraries.Fabrication.Printing.Bambu · Inherits from: Libraries.Language.Object, Libraries.Data.Formats.JavaScriptObjectNotationTemplate
The BambuProjectSettings class is a Bambu Studio project_settings.config open for editing. Bambu Studio needs the complete set of about 580 settings in exactly the shape its own version writes, so the file is never rebuilt: it is read from one that Bambu Studio exported for the same printer, nozzle and filament, and only the values that are changed are rewritten (see JavaScriptObjectNotationTemplate).
Example Code
use Libraries.Fabrication.Printing.Bambu.BambuProjectSettings
class Main
action Main
BambuProjectSettings settings
settings:LoadFile("Templates/bambu-p2s/p2s_project_settings.json")
settings:Fill("layer_height", "0.16")
settings:Check()
output settings:ToText()
end
end
Actions
Check()
The checks Bambu Studio's PresetBundle::load_config_file_config makes when it opens the file: it must be a project_settings file for a single filament, with matching filament extruder lists.
Example
use Libraries.Fabrication.Printing.Bambu.BambuProjectSettings
BambuProjectSettings settings
settings:LoadFile("Templates/bambu-p2s/p2s_project_settings.json")
settings:Fill("layer_height", "0.16")
settings:Check() // stops with an alert if Bambu Studio would reject it
LoadFile(text path)
Reads the settings from a project_settings JSON file, or from the Metadata/project_settings.config inside a .3mf / .gcode.3mf that Bambu Studio exported. Stops with an error naming the file if it is missing or isn't one of those.
Parameters
pathtext: The JSON file or 3MF archive.
Example
use Libraries.Fabrication.Printing.Bambu.BambuProjectSettings
BambuProjectSettings settings
settings:LoadFile("Templates/bambu-p2s/p2s_project_settings.json")
output settings:GetText("layer_height", "")
LoadFile(Libraries.System.File file)
Reads the settings from a project_settings JSON file, or from the project_settings inside a .gcode.3mf exported by Bambu Studio.
Parameters
fileLibraries.System.File: The project_settings JSON or .gcode.3mf.
Example
use Libraries.System.File
use Libraries.Fabrication.Printing.Bambu.BambuProjectSettings
File file
file:SetPath("Templates/bambu-p2s/p2s_project_settings.json")
BambuProjectSettings settings
settings:LoadFile(file)