Interactive Scripting to Interactive COGO [SOLVED]
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.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Interactive Scripting to Interactive COGO [SOLVED]
I am revisiting this topic, it is a central issue.
Script ExMyMinimal.js and ExMyMinimal.xml simply seems to wait for a "grid" input point.......
Can anyone spot an issue why the problems?
Script ExMyMinimal.js and ExMyMinimal.xml simply seems to wait for a "grid" input point.......
Can anyone spot an issue why the problems?
Last edited by Joseph1916 on Mon Aug 07, 2023 6:24 pm, edited 7 times in total.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting
Operating System: Linux Ubuntu 22.04
QCAD Version: 3.28.1
indentation appears in text file ExMyMinimal.js and ExMyMinimal.iu
After POST my indentation is remover. How come?
Thanks.
Joseph1916
QCAD Version: 3.28.1
indentation appears in text file ExMyMinimal.js and ExMyMinimal.iu
After POST my indentation is remover. How come?
Thanks.
Joseph1916
Last edited by Joseph1916 on Thu Aug 03, 2023 6:51 pm, edited 1 time in total.
Re: Interactive Scripting to Interactive COGO
Hardly.
Remarked in several of your latest post is the use of some kind of HTML type tags:
e.g:
Code: Select all
</e></QUOTE>
came back with a Parse Error. <br/>
<br/>
While the js file: <br/>
Code: Select all
came back with a Parse Error.
While the js file:
It is common to use a code panel for such things ... Select the code portion in your topic and use the '</>' button.
The functional UI I can retrieve is:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExMyMinimal</class>
<widget class="QWidget" name="ExMyMinimal">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="RadiusLabel">
<property name="text">
<string>&Radius:</string>
</property>
<property name="buddy">
<cstring>Radius</cstring>
</property>
</widget>
</item>
<item>
<widget class="RMathLineEdit" name="Radius">
<property name="text">
<string notr="true">1</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>RMathLineEdit</class>
<extends>QLineEdit</extends>
<header>RMathLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
It looks like:
The naming of this plain text file should be: ExMyMinimal.ui
And now the JS script .... ... With indentations, it is common to use 4 spaces for a tab in QCAD.
Code: Select all
include("scripts/EAction.js");
function ExMyMinimal(guiAction) {
EAction.call(this, guiAction);
this.pos = undefined;
this.radius = undefined;
this.setUiOptions("ExMyMinimal.ui");
}
ExMyMinimal.prototype = new EAction();
ExMyMinimal.prototype.beginEvent = function() {
EAction.prototype.beginEvent.call(this);
var di = this.getDocumentInterface();
di.setClickMode(RAction.PickCoordinate);
};
ExMyMinimal.prototype.pickCoordinate = function(event, preview) {
this.pos = event.getModelPosition();
if (preview) {
this.updatePreview();
}
else {
this.applyOperation();
}
};
ExMyMinimal.prototype.getOperation = function(preview) {
if (isNull(this.pos) || isNull(this.radius)) {
return undefined;
}
var doc = this.getDocument();
var op = new RAddObjectOperation();
var circle = new RCircle(this.pos, this.radius);
op.addObject(shapeToEntity(doc, circle));
return op;
};
ExMyMinimal.prototype.slotRadiusChanged = function(v) {
this.radius = v;
this.updatePreview();
};
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"]);
};
Can't detect any coding error with this ... It draws a circle with the radius from the UI at the indicated position ...
... Probably you tried to implement this with all the unrelated/faulty tags in place.
Please use a plain text editor.
On windows I can advice Notepad++ using the formatting language 'JavaScript' and using the Unix EOL.
I am sure there will be Linux alternatives.
And please use plain text to enter topics.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting to Interactive COGO
Hello CVH,
Lots to consume with your posting..... How do i ensure my Posts are in plain Text? Is that an option? Anyway, now using Genome Text Editor, hopefully in will resolve some of the problems.
I have limited programming background and especially with MS Windows and the Internet(i.e. JavaScript, HTML, etc.)
I will attempt to solve my problems one by one. The code is still not executing correctly. RESOLVED
CODE is now executing.
Thanks for all your help !!
Joseph1916
Lots to consume with your posting..... How do i ensure my Posts are in plain Text? Is that an option? Anyway, now using Genome Text Editor, hopefully in will resolve some of the problems.
I have limited programming background and especially with MS Windows and the Internet(i.e. JavaScript, HTML, etc.)
I will attempt to solve my problems one by one. The code is still not executing correctly. RESOLVED
CODE is now executing.
Thanks for all your help !!
Joseph1916
Last edited by Joseph1916 on Thu Aug 03, 2023 6:55 pm, edited 1 time in total.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting to Interactive COGO
I have solved some problems However, code executing properly
Joseph1916
Joseph1916
Last edited by Joseph1916 on Thu Aug 03, 2023 6:57 pm, edited 2 times in total.
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting to Interactive COGO
I have the code working !!
Last edited by Joseph1916 on Thu Aug 03, 2023 6:59 pm, edited 1 time in total.
Re: Interactive Scripting to Interactive COGO
I enter ... type ... this in the reply box and it comes out as plain text, right?
The same is true when you do that in the text box for new topics.
ExMyMinimal.ui and ExMyMinimal.js should both be located in a folder called ExMyMinimal somewhere under the script folder.
For example: ... QCAD/scripts/Misc/Examples/ExMyMinimal where the 3 dots represent your QCAD installation path.
Regards,
CVH
Re: Interactive Scripting to Interactive COGO
What have you not ...?
So far the second version of your code is exactly the same as the previous and as mine except indentations, except as code in a code panel.
One edit own posts, see the button with the pencil in it.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting to Interactive COGO
CVH ;
Sorry for the delay with this reply...... What I was referring to was earlier Post. I was basically chatting to myself. Disregard that statement.
I do not see how you get the "white code box" to reflect Code? Knowing how to do that could help me communicate !!
Regarding my current Script, let me do additional investigations, as to the source for the failing Script. We know it is on my side !!
Thanks for your support !
Joseph1916
Sorry for the delay with this reply...... What I was referring to was earlier Post. I was basically chatting to myself. Disregard that statement.
I do not see how you get the "white code box" to reflect Code? Knowing how to do that could help me communicate !!
Regarding my current Script, let me do additional investigations, as to the source for the failing Script. We know it is on my side !!
Thanks for your support !
Joseph1916
Last edited by Joseph1916 on Thu Aug 03, 2023 3:09 pm, edited 1 time in total.
Re: Interactive Scripting to Interactive COGO
When you are writing a topic you can copy/paste some code text to include it.Joseph1916 wrote: ↑Wed Aug 02, 2023 6:17 pmI do not see how you get the "white code box" to reflect Code? Knowing how to do that could help me communicate !!
Then select the pasted code lines.
At the top of the text box there is a ribbon with buttons.
With the code lines selected hit the '</>' button.
Similar for setting text bold, italic, underlined ...
This is code
Will be displayed on Preview or Submit as:
Code: Select all
This is code
It speaks for itself that I couldn't include these brackets in the above sentence.
Or you could hit the code button an then insert the lines of code between the two formatting tags.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Interactive Scripting to Interactive COGO
My mistake. The Dialog was at the top..... Did not expect that....... SUCCESS.... Sorry I took such time..... We can all move on...
Joseph1916
Joseph1916
Re: Interactive Scripting to Interactive COGO
Yes, please, and maybe you want to declutter this topic by editing your own posts.
Regards,
CVH