Pour traduire ce texte en français, s'il vous plaît
utilisez
http://translate.google.com, merci.
You might want to have a look at the script examples that come with QCAD 3, for example scripts/Examples/MathExamples/Spiral/Spiral.js which draws a spiral from line segments.
You can duplicate the 'Spiral' script as a starting point:
1. Copy directory scripts/Examples/MathExamples/Spiral to scripts/Examples/MathExamples/MyScript.
2. Rename scripts/Examples/MathExamples/MyScript/Spiral.js to scripts/Examples/MathExamples/MyScript/MyScript.js.
3. Rename the ECMAScript class 'Spiral' in MyScript.js to 'MyScript'.
4. Adjust the titles (strings) in MyScript.js in method MyScript.init
You have now an exact copy of the Spiral script. To launch your script, choose menu Examples -> Mathematics -> Your menu title
For generic, non-CAD specific functions, you can use almost the entire Qt API:
http://doc.qt.nokia.com/4.7/classes.html
- Code: Select all
var filename = QFileDialog.getOpenFileName(null, qsTr("Open a File..."),
QDir.homePath(), qsTr("Text Files (*.txt);;All Files (*)"));
var file = new QFile(filename);
var flags = new QIODevice.OpenMode(QIODevice.ReadOnly | QIODevice.Text);
if (file.open(flags)) {
var textStream = new QTextStream(file);
var line = textStream.readLine();
...
}