rgomezjnr / GcodeFilenameFormatPlus

Cura plugin for controlling output filename format, now with multi-extruder and OctoPrint support
https://marketplace.ultimaker.com/app/cura/plugins/rgomezjnr/GcodeFilenameFormatPlus
GNU Lesser General Public License v3.0
30 stars 4 forks source link

Filename format problem with symbol ~ #13

Open pavolNovak opened 1 year ago

pavolNovak commented 1 year ago

Love the possibility to use custom filename format, but Im missing possibility to pass Wave dash symbol. Example I put this into filename format : [objectcount]x[job_name]°[print_time_days]d-t〜PA6-c〜BLACK-m〜PRUSA-0,4.gcode this is what Im getting: 1x_Shape-Cylinder-30mm°0d-tPA6-cBLACK-mPRUSA-0,4.gcode.gcode As you see the symbol "〜" or "~" in not present in the gcode filename.

Need it because I use it later in other software for tracking.

Thank you.

rgomezjnr commented 1 year ago

Can you try adding the ~ character in line 8 of ParseFilenameFormat.py as follows:

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

You can open the Cura configuration folder that contains the GFF+ plugin files by selecting Help -> Show Configuration Folder while Cura is running.

rgomezjnr commented 1 year ago

Hello @pavolNovak were you able to try my suggestion? Did it work for you?

pavolNovak commented 1 year ago

Hello @rgomezjnr , your solution worked flawlessly and now Im able to fully use it. Thank you.

fskelly commented 1 year ago

Would it be possible to show me how to add / - Needed as part of my folder structure. /[machine_nozzle_size]/[machine_nozzle_size]mm-[abbr_machine]-[base_name]-[material]-[infill_sparse_density]%infill-[material_print_temperature]C-[material_bed_temperature]C

This removes "/" and becomes [machine_nozzle_size][machine_nozzle_size]mm-[abbr_machine]-[base_name]-[material]-[infill_sparse_density]%infill-[material_print_temperature]C-[material_bed_temperature]C

Can you please help, love this plugin!

rgomezjnr commented 1 year ago

Try this:

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

What OS are you using? Characters like / and ~ can be invalid filename characters depending on OS and filesystem type, and are best usually avoided, which is why I'm hesitant to implement these changes in GFF+. I could add checks for the OS type to allow different characters, but that is more maintenance, and I'd rather keep the codebase cross-platform since Cura is cross-platform.