Hi .
My operating system is Windows 10 Enterprise
My Qcad version is 3.27.8.0 (3.27.
I´m trying to use the simple_modify.js script included at scripts/ with my own :
include("C:/Users/xxx/scripts/simple_modify.js");
var docSource = "C:/xxx/bb.dxf";
var diDestination = "C:/xxx/cc.dxf";
var offset = [0,0]
var scale = 1;
var rotation = 0;
var flipHorizontal = false;
var flipVertical = false;
var toCurrentLayer = true;
var overwriteLayers = false;
var overwriteBlocks = false;
paste(docSource, diDestination, offset, scale, rotation, flipHorizontal, flipVertical, toCurrentLayer, overwriteLayers, overwriteBlocks);
The error shown is :
Script exception in script 'C:/Users/xxx/QCAD/scripts/MyScripts/paste_file.js': Error: -1: RPasteOperation(): no matching constructor found. <native>('C:/Users/xxx/bb.dxf') at -1 paste(docSource = 'C:/Users/xxx/bb.dxf', diDestination = 'C:/Users/xxx/cc.dxf', offset = "RVector(0.000000, 0.000000, 0.000000, 1)", scale = 1, rotation = 0, flipHorizontal = false, flipVertical = false, toCurrentLayer = true, overwriteLayers = false, overwriteBlocks = false) at :/scripts/simple_modify.js:27 paste(docSource = 'C:/Users/xxx/bb.dxf', diDestination = 'C:/Users/xxx/cc.dxf', offset = 0,0, scale = 1, rotationS = 0, flipHorizontal = false, flipVertical = false, toCurrentLayer = true, overwriteLayers = false, overwriteBlocks = false) at :/scripts/simple_modify.js:24 anonymous() at 26 <anonymous>() at :scripts/Misc/MiscDevelopment/RunScript/RunScript.js:120 <eval>() at 1 <native>() at -1 main() at :scripts\autostart.js:846 <global>() at :scripts\autostart.js:859
Could you tell me where is the mistake?
Thanks in advance.
simple_modify.js ---- Pastes the given document
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Registered Member
- Posts: 2
- Joined: Sat Dec 03, 2022 12:30 pm
simple_modify.js ---- Pastes the given document
- Attachments
-
- paste_file.js
- (555 Bytes) Downloaded 210 times
Re: simple_modify.js ---- Pastes the given document
Yes, but there is more to it ...
We usually include simple.js to start with (simple_modify.js Line 38 getDocumentInterface() is declared there)
diDestination is a correct naming but the explanation on line 10 is wrong.
https://github.com/qcad/qcad/blob/maste ... _modify.js
The parameter docDestination is not used.
Filed a BugReport at: https://qcad.org/bugtracker/index.php?d ... sk_id=2438
di usually stands for document interface.
The function doesn't paste a drawing docSource in another drawing on your drive called docDestination.
It paste an already open document into another open document.
That can be the current active drawing in QCAD with diDestination = undefined or a given one defined by its document interface.
In short: It isn't functional with filenames.
You need to supply an existing RDocumentInterface of an open drawing as target and the existing RDocument of an open drawing as source.
https://qcad.org/doc/qcad/3.0/developer ... ument.html
https://qcad.org/doc/qcad/3.0/developer ... rface.html
More in the nature of what you want to accomplish:
To merge drawing files (off-screen) there is also a command line tool called merge.
See: https://www.ribbonsoft.com/en/products/ ... ols/#merge
Regards,
CVH