Giter Site home page Giter Site logo

rgomezjnr / gcodefilenameformat Goto Github PK

View Code? Open in Web Editor NEW
19.0 6.0 9.0 251 KB

Cura plugin that adds print settings in gcode filenames

Home Page: https://marketplace.ultimaker.com/app/cura/plugins/rgomezjnr/GcodeFilenameFormat

License: GNU Lesser General Public License v3.0

Python 74.56% QML 25.44%
gcode cura cura-plugin 3d-printing slicer gui python qt qml

gcodefilenameformat's Introduction

Gcode Filename Format

Cura plugin for specifying filename format with print settings

Example:

PI3MK3M_paperclip Generic PLA lw 0.4mm lh 0.2mm if 20% ext1 200C bed 60C.gcode

Default filename format:

[base_name] [brand] [material] lw [line_width]mm lh [layer_height]mm if [infill_sparse_density]% ext1 [material_print_temperature]C bed [material_bed_temperature]C

Requirements

Cura 4.4 or later

Installation

Preferred method

Install plugin from Ultimaker Marketplace

Alternatively

  1. Clone repository (or download repository .zip)
git clone https://github.com/rgomezjnr/GcodeFilenameFormat.git
  1. Move GcodeFilenameFormat folder to Cura plugins folder
  • Windows: C:\Users\%USERNAME%\AppData\Roaming\cura\4.4\plugins
  • Mac: $User/Library/Application\ Support/Cura/4.4/plugins
  • Linux: $HOME/.local/share/cura/4.4/plugins
  1. Launch Cura

Usage

  1. Specify filename format using Extensions -> Gcode Filename Format -> Edit Format

    Edit Format Dialog

  2. Slice object

  3. Select Save Gcode button (instead of default Save to File button)

    Edit Format Dialog

  4. Futher modify formatted filename as desired in the save dialog

  5. Select Save

Besides .gcode, the plugin will also work with other file types such as .3mf and .stl. Simply select from the available file types in the save dialog.

Format options

  • base_name - the initial output filename from the object name and Cura's "Add machine prefix to job name" setting
  • job_name - same as base_name
  • printer_name - printer manufacturer and model
  • profile_name - name of the profile used for slicing e.g. Normal, Fine, Draft
  • layer_height - layer height/thickness, vertical resolution (mm)
  • machine_nozzle_size - nozzle diameter e.g. 0.2 mm, 0.4 mm, 0.6 mm
  • line_width - line/nozzle width e.g. 0.2 mm, 0.4 mm, 0.6 mm
  • wall thickness - thickness of shell walls (mm)
  • infill_sparse_density - infill percentage (%)
  • infill_pattern - infill pattern e.g grid, lines, triangles
  • top_bottom_pattern - pattern of the top and bottom layers e.g. lines, concentric, zig zag
  • brand - the brand of the filament e.g. Generic, Prusa, MatterHackers, eSun, etc.
  • material - material type e.g. PLA, PETG, ABS, etc.
  • material_diameter - filament size e.g. 1.75 mm, 3 mm
  • material_print_temperature - material/nozzle temperature (°C)
  • material_bed_temperature - build plate temperature (°C)
  • material_flow - extruded material flow rate (%)
  • material_weight - printed material weight (g)
  • material_length - printed material length (m)
  • material_cost - printed material cost
  • speed_print - print speed (mm/s)
  • retraction_combing - combing mode
  • magic_spiralize - spiralize outer contour, vase mode
  • print_time - total print time in HHMMSS
  • print_time_days - print time in days
  • print_time_hours - print time in hours
  • print_time_hours_all - print_time_days * 24 + print_time_hours
  • print_time_minutes - print time in minutes
  • print_time_seconds - print time in seconds
  • date - current date in YYYY-MM-DD
  • time - current time in HH-MM
  • datetime - current time in YYYY-MM-DDTHHMMSS
  • year - current year in YYYY
  • month - current month in MM
  • day - current day in DD
  • hour - current hour in HH
  • minute - current minute in MM

For the full list please refer to fdmprinter.def.json.pot

Source code

https://github.com/rgomezjnr/GcodeFilenameFormat

Authors

Robert Gomez, Jr.

Michael Chan

License

LGPLv3

gcodefilenameformat's People

Contributors

mchan016 avatar rgomezjnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gcodefilenameformat's Issues

Include Cura version

Was just playing with this and think it would be useful to include the version of Cura the gcode is sliced in. Sometimes people test different models in different versions (I'm doing that now actually).

What do you think?

Object count

Would it be possible to add an option for the number of objects to be printed? I regularly modify my file names to add in the count when I have many objects being printed.

Print Time in filename

Hello,
Do you have a way to add the print time to the filename?
I read the documentation, but nothing.

I know it is possible, the "custom printjob prefix" plugin can do it, but I believe is more logic to have it after the filename.

Thanks for any feedback

Multi extrusion naming

Me again! We really like this plugin.

Currently it only recognises an active extruder in the naming scheme.
In the case of a multi extrusion job it would be good if it could include all the loaded material types.

I've attached a project file as an example. I've loaded Ultimaker Black ABS and Ultimaker Tough PLA.
If I export using your plugin it will only recognise 'Ultimaker ABS' in the filename.

gcodefilenameformatmutiextrusion.zip

Cura can do up to 8 extruders, so there may be a situation where someone even has more than 2!

What do you think?

[datetime] not working?

Hello,

Am trying to add a timestamp to the gcode file names, but adding [datetime] merely adds 'None'

Using Cura 4.8.0

Add octoprint support

First of all let me start by saying I love your plugin!

Only thing I'd love to see implement is octoprint support. I barely every export .gcode nowadays and print straight to octoprint. It's a shame we can't have the custom name + octoprint support :(

Feature Request - Tie format to printer

I'm baaa-aaaackkkk..... :)

Can you add an option to tie the format to specific printer profile? I'd like to add something automatically into the format [not at the beginning, as the "prefix machine name" or whatever that option is] to identify for which printer it was sliced.

So I could do this (for example, with two of my printers, "Yellow" and "Blue", just by changing profiles, so I would not have to squint at the names to see that one is set up for one of my direct drive printers, the other for one of my Bowden tube printers):

Druid - Threaded PLA [Yellow] skirt|Infill 15%,cubic|Noz 0.4|LH 0.1|LW 0.4|Temps 230.0°,60°|Speed 50|RT 1,45|Support tree,63°|Coast-True

Druid - Threaded PLA [Blue] skirt|Infill 15%,cubic|Noz 0.4|LH 0.1|LW 0.4|Temps 230.0°,60°|Speed 50|RT 5,55|Support tree,63°|Coast-True

I can manually add the name into the file as I am saving it, but I sometimes forget.

Feature Request: Per printer gcode save location

Great plugin! I was thinking something that might be helpful is to add an option to add a directory to save in. I have several printers and constantly switching around in cura. The file save dialog always seems to stick to the last folder something was saved in. It would be handy to be able to specify say a printer name as a directory and then have the Gcode saved there. I hope I am explaining that correctly. It might also be handy to specify a default project directory as well so you have something like

x:\myprojects\

as a project directory and then adding a "printer directory option" would automatically save to

"x:\myprojects\myprintername\MyGcodeFilename.gcode"

Feature request: replace symbols

Hi. I'm using espwebdav for file upload and it buggy with non ascii and some other chars. Marlin may not like them too. Renaming every time annoying.

Would it possible to implement simple character replace table? And length limiting will be nice too.

Name of profile

I seem to not be able to find the string for the name of the profile that was used to create the gcode.

Datetime does not work, shows "None"

This is on Cura 4.5, Windows 10, plugin version 1.4.1

Template:

[base_name] [layer_height]mm [speed_print]mms - [datetime] - [date] - [time]

image

Exported file name

image

Feature request: job duration and amount of material

Hello,
thanks for making this nice plugin!
I typically enter manually the job duration and the amount of filament used.
Is there a way to include this information in the file name? I could not find it in the README.
If not, please consider adding it.

Thanks!

None of date/time placeholder is working on Linux

Hi!

On Ultimaker Cura 4.8, Linux 64 Bits (Kubuntu 21.04) version, all the place holders for date and time aren't working.

Steps to reproduce:

  1. On extension menu, choose "Gcode Filename Format" -> "Edit Format".
  2. Put any date/time placeholder on the text input, beside brackets, for example "[date][time]" or "[year][month][day]"
  3. Slice and select to "save gcode".
  4. The replaced text is "none" on each placeholder related to date/time.

Thanks for the attention!

[base_name] create duplicate text if after saving you will reslice and save again

Hi,
I have experimented that if you use [base_name] in the template you can get duplicate text in your file name.
Try it :

  1. load stl file
  2. slice it
  3. save it having [base_name] in the template
  4. change samething in the print settings
  5. slice again
  6. save again and you will get all the template duplicated.

I have fixed it changing in this way the file ParseFileFormat.py but I'm not expert of Cure and Python too, so I think that will be a better way to do it.

import re
from UM.Logger import Logger #Adding messages to the log.

Substitute print setting values in filename format

def parseFilenameFormat(print_settings, filename_format):
base_name = print_settings["base_name"]
job_name = print_settings["job_name"]
Logger.log("d", "base_name %s", base_name)
Logger.log("d", "job_name %s", job_name)
no_base_name_format = filename_format
no_base_name_format = no_base_name_format.replace("[base_name]", "")
no_base_name_format = no_base_name_format.replace("[job_name]", "")

for setting, value in print_settings.items():
    filename_format = filename_format.replace("[" + setting + "]", str(value))
    no_base_name_format = no_base_name_format.replace("[" + setting + "]", str(value))            

no_base_name_format = re.sub('[^A-Za-z0-9.,_\-%°$£€#\[\]\(\)\|\+\'\" ]+', '', no_base_name_format)
filename = re.sub('[^A-Za-z0-9.,_\-%°$£€#\[\]\(\)\|\+\'\" ]+', '', filename_format)

Logger.log("d", "no_base_name_format %s", no_base_name_format)
Logger.log("d", "filename %s", filename)
if no_base_name_format in base_name:
    filename = base_name

return filename   

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.