Page 1 of 1
load default template
Posted: Mon Mar 05, 2012 12:42 pm
by J-J
I need some help with scripting: I have made a drawing with a number of predefined layers that I use as a template for a new drawing. How can I replace the default drawing that is opened upon QCAD start-up with this template?
Posted: Mon Mar 05, 2012 3:38 pm
by andrew
There's no preference for the default template (at this point).
A possible script solution would be:
template.js:
Code: Select all
var mainWindow = RMainWindowQt.getMainWindow();
var doc = mainWindow.getDocument();
var di = mainWindow.getDocumentInterface();
di.importFile("template.dxf");
di.regenerateScenes();
di.autoZoom();
doc.setFileName("");
template.dxf: The template drawing
Starting QCAD:
start up template
Posted: Mon Mar 05, 2012 10:14 pm
by J-J
Thanks for your quick reply. When I type the start up code in the command line, it is ver2.2.2 that gets launched, not 3.0
Is it possible to make a short cut in the traditional Windows way?
(Win 7 -64)
Posted: Tue Mar 06, 2012 9:42 am
by andrew
Under Windows you'd probably have to write a batch file that changes into the correct QCAD directory and then launches QCAD with the necessary parameters.
I'm not much help with this since I've never done anything with Windows batch files..
default template
Posted: Wed Mar 07, 2012 8:43 am
by J-J
I got some positive results with this batch file:
@echo off
path C:\Program Files (x86)\QCAD-3\qcad-3.0.0-rc3-prof-win32
qcad -exec ./template.js
Windows did not like the "./" before qcad
To get the cmd file to work I had to locate the file "template.js" on the desktop...I am not an expert with Windows!
Thanks for your help.
Re: load default template
Posted: Tue Nov 20, 2012 7:57 pm
by uwezi
Under Windows 7 I placed the
template.dxf and the script
startup.js in the program directory of QCad.
In order to start QCad with these settings, just right-click on the shortcut in the start-menu, choose
Properties and change the
Target. In my case the correct setting is
Code: Select all
"C:\Program Files\QCAD Professional3\qcad.exe" -exec .\startup.js
Uwe.