https://qcad.org/en/tutorial-interactiv ... troduction
My Operating System - Ubuntu 22.04
QCAD 3.28.1
I did not expect success, but to get started, I attempted to build the code below using gcc compiler.
Error Messages:
gcc qcad-1.cpp
qcad-1.cpp:1:8: error: expected constructor, destructor, or type conversion before ‘(’ token
1 | include("scripts/EAction.js");
| ^
qcad-1.cpp:3:1: error: ‘function’ does not name a type; did you mean ‘union’?
3 | function ExMyMinimal(guiAction) {
| ^~~~~~~~
| union
qcad-1.cpp:7:1: error: ‘ExMyMinimal’ does not name a type
7 | ExMyMinimal.prototype = new EAction();
| ^~~~~~~~~~~
qcad-1.cpp:9:1: error: ‘ExMyMinimal’ does not name a type
9 | ExMyMinimal.init = function(basePath) {
| ^~~~~~~~~~~
End of error messages
Below is the subject CODE: (FROM Link at top of this message)
=========================================================================================
include("scripts/EAction.js");
function ExMyMinimal(guiAction) {
EAction.call(this, guiAction);
}
ExMyMinimal.prototype = new EAction();
ExMyMinimal.init = function(basePath) {
var action = new RGuiAction(qsTr("&Minimal Example"), RMainWindowQt.getMainWindow());
action.setRequiresDocument(true);
action.setScriptFile(basePath + "/ExMyMinimal.js");
action.setGroupSortOrder(100000);
action.setSortOrder(0);
action.setWidgetNames(["ExamplesMenu"]);
};
=========================================================================================
Any one willing to adventure into this SUBJECT !!
Obviously, not a good START !!
Joseph1916
Interactive Scripting [SOLVED]
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Interactive Scripting [SOLVED]
Last edited by Joseph1916 on Sat Aug 05, 2023 10:34 pm, edited 1 time in total.
Re: Interactive Scripting
Joseph1916,
Please post script related questions under 'QCAD Programming, Script Programming and Contributing'
What was wrong with your endeavor was that you included the line numbers.
ECMAScript has no line numbering.
True, GitHub will display line numbers and so do some textual tools like for example Notepad++
Regards,
CVH
Please post script related questions under 'QCAD Programming, Script Programming and Contributing'
What was wrong with your endeavor was that you included the line numbers.
ECMAScript has no line numbering.
True, GitHub will display line numbers and so do some textual tools like for example Notepad++
Regards,
CVH
Re: Interactive Scripting
Please note that this is code for a script (JavaScript), not C++ code. You do not need to compile the script. Simply put it in the scripts directory of your QCAD installation in a folder with the same name as the script.
From the tutorial you were following:
Note that in order for the script to be found, the file name needs to match the class name, i.e. "ExMyMinimal.js" in this case. It also needs to reside inside a directory with the same name "ExMyMinimal", so this script can for example be put into scripts/Misc/ExMyMinimal/ExMyMinimal.js.
From the tutorial you were following:
Note that in order for the script to be found, the file name needs to match the class name, i.e. "ExMyMinimal.js" in this case. It also needs to reside inside a directory with the same name "ExMyMinimal", so this script can for example be put into scripts/Misc/ExMyMinimal/ExMyMinimal.js.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting
Will Do !!
Following along
Joseph1916
Following along
Joseph1916
Last edited by Joseph1916 on Thu Aug 03, 2023 7:30 pm, edited 3 times in total.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting
This Matter is solved. should be closed....
Re: Interactive Scripting
Please edit your first post and add [SOLVED] to the title.
Regards,
CVH