Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commandline interface for setting mapping #704

Open
valkyriesavage opened this issue Feb 29, 2024 · 2 comments
Open

Add commandline interface for setting mapping #704

valkyriesavage opened this issue Feb 29, 2024 · 2 comments

Comments

@valkyriesavage
Copy link

valkyriesavage commented Feb 29, 2024

$ ./VisiCut.MacOS --help

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)
Usage: visicut [-h|--help|-v|--version]
	 visicut [options] [<filename>]
	 visicut [options] --execute filename
Options are:
 --add (do not replace old file if VisiCut is already running)
 --material <materialname e.g. "Acrylic Glass 2mm">
 --laserdevice <laserdevice e.g. "Epilog ZING @ Miltons Office">
 --mapping <mapping e.g. "Cut">
 --total-height <Height in mm e.g. "2.5"> (only valid with --execute)
 --singleinstanceport <port> (Set port to check for running instances -- 0 to disable)
 --basepath <path> 	 Sets VisiCuts settings directory (default is $HOME/.visicut)
 --gtkfilechooser (experimental)

However,

$ ./VisiCut.MacOS --mapping "Cut"

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)
Unknown command line option: --mapping
Use -h or --help for help

Is it possible to call specific mappings from the commandline? And, if so, can it support something more complicated than "Cut"? (e.g., I am interested in mapping red strokes to Cut and blue strokes to Mark)

@mgmax mgmax added the Bug label Mar 2, 2024
mgmax added a commit that referenced this issue Mar 3, 2024
- Show error explaining that --mapping is not yet implemented
- Rename --total-height to --thickness
- Improve error message and handling when no laser settings are available for this material-speed combination

Related: #704
@mgmax
Copy link
Collaborator

mgmax commented Mar 3, 2024

This is currently not implemented. I added an error message and some small improvements in Version 2.0-3. Due to issues with the build server it may take some days until you can download the version on download.visicut.org.

Workaround:
The code for --execute supports .PLF files. You can create these files with VisiCut - just load a file you want to cut, set up everything, and then use "File Save". You can later modify this file from some outside script. Basically these are renamed ZIP files containing both the SVG file for lasercutting and a XML file with the material/mapping/... settings. So you can, e.g., build a Python script that unzips the .PLF, replaces the SVG file with the content you want and optionally makes other changes.

Long term solution:
Unfortunately, setting the mapping (especially, loading existing saved mappings) is the one part where the VisicutModel class is not cleanly separated from the GUI PropertyPanel. So some restructuring of the code is needed :-(

@mgmax mgmax added Enhancement and removed Bug labels Mar 3, 2024
@mgmax mgmax changed the title Mapping in commandline? Add commandline interface for setting mapping Mar 3, 2024
@valkyriesavage
Copy link
Author

Thanks! The workaround supports what I need for the moment, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants