Issues with a headless script to a) join curves b) save
Posted: Fri May 28, 2021 4:31 pm
Hi!
Looking to get QCAD professional implemented in our vector processing server (Debian in Docker).
What I am aiming to do is this;
a) import an SVG
b) join all lines by selecting all, then doing polylinesfromselection
c) saving as a DXF
I am having some issues, and I feel like I am doing this slightly wrong, and I am currently stuck with this error;
Warning: EAction.prototype.showUiOptions: no options toolbar
Warning: RScriptHandlerEcma::eval: script engine exception: "TypeError: Result of expression 'EAction.getDocumentInterface()' [undefined] is not an object
I believe this is due to the fact that I don't have a "window"/toolbar available for the script. I got it working in the interpreter window on the desktop version, but headless it's another story. Any help or nudges in the right direction would be hugely appreciated!
Looking to get QCAD professional implemented in our vector processing server (Debian in Docker).
What I am aiming to do is this;
a) import an SVG
b) join all lines by selecting all, then doing polylinesfromselection
c) saving as a DXF
I am having some issues, and I feel like I am doing this slightly wrong, and I am currently stuck with this error;
Warning: EAction.prototype.showUiOptions: no options toolbar
Warning: RScriptHandlerEcma::eval: script engine exception: "TypeError: Result of expression 'EAction.getDocumentInterface()' [undefined] is not an object
I believe this is due to the fact that I don't have a "window"/toolbar available for the script. I got it working in the interpreter window on the desktop version, but headless it's another story. Any help or nudges in the right direction would be hugely appreciated!
Code: Select all
./qcad -platform offscreen -allow-multiple-instances testscript.js infile.svg outfile.dxf
Code: Select all
include("scripts/ImportExport/SvgImporter/SvgImporter.js")
include("scripts/Select/SelectAll/SelectAll.js");
include("scripts/File/Save/Save.js");
const document = new RDocument(new RMemoryStorage(), new RSpatialIndexSimple());
const importer = new SvgImporter(document);
importer.importFile(args[1]);
const select = new SelectAll();
select.beginEvent();
RGuiAction.triggerByCommand("polylinefromselection");
const save = new Save();
s.save(args[2])