Running Scripts [SOLVED]
Moderator: andrew
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Running Scripts [SOLVED]
Operating System: Ubuntu 22.04
Program: QCAD 3.28.1 Community Edition
Testing out my Ubuntu 22.04 and QCAD Community Edition.
Entered Misc Drop Down menu > Script Shell appeared properly seemed to execute one line at a time FINE
Entered Misc Menu > Run Script Open > Dialog Box Appeared > Selected Script File > But nothing happened.
I'm on Community Edition, Is that an issue??
Program: QCAD 3.28.1 Community Edition
Testing out my Ubuntu 22.04 and QCAD Community Edition.
Entered Misc Drop Down menu > Script Shell appeared properly seemed to execute one line at a time FINE
Entered Misc Menu > Run Script Open > Dialog Box Appeared > Selected Script File > But nothing happened.
I'm on Community Edition, Is that an issue??
Last edited by Joseph1916 on Sun Aug 06, 2023 12:59 am, edited 1 time in total.
Re: Running Scripts
Have you an example script to share ...
You my also PM 'Personal Message' the example if that is more convenient for you.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Running Scripts
Its the example provided: (without the comments)
a=7; b=6;
phi=0.2*Math.PI;
step=Math.PI/256;
w=100;
h=100;
v=[];
for (t=0.0; t<Math.PI*2; t+=step) {
// compute next x,y coordinate:
x = w * Math.sin(a*t + phi);
y = h * Math.sin(b*t);
// append coordinate to our array of coordinates:
v.push([x,y]);
}
addSpline(v, true);
autoZoom();
Joseph1916
a=7; b=6;
phi=0.2*Math.PI;
step=Math.PI/256;
w=100;
h=100;
v=[];
for (t=0.0; t<Math.PI*2; t+=step) {
// compute next x,y coordinate:
x = w * Math.sin(a*t + phi);
y = h * Math.sin(b*t);
// append coordinate to our array of coordinates:
v.push([x,y]);
}
addSpline(v, true);
autoZoom();
Joseph1916
Re: Running Scripts
Joseph1916,
These are executed the same way as if they where in a script file.
For saved scripts the file extension *.js is even not mandatory.
addSpline(...); is part of the Simple API and draws a fitpoint spline.
CE only supports control point splines.
You could replace addSpline(...) by addPolyline(...)
Then you get an approximation by line-segments what looks about the same there the points cloud is dense enough.
To be able to draw fitpoint splines the only advice is to upgrade to QCAD PRO or to use the trial version.
Regards,
CVH
One can paste several lines of code to the bottom line of the Script Shell in one go.Joseph1916 wrote: ↑Sat Jul 15, 2023 6:14 pmEntered Misc Drop Down menu > Script Shell appeared properly seemed to execute one line at a time FINE
These are executed the same way as if they where in a script file.
For saved scripts the file extension *.js is even not mandatory.
Yes and no.
addSpline(...); is part of the Simple API and draws a fitpoint spline.
CE only supports control point splines.
You could replace addSpline(...) by addPolyline(...)
Then you get an approximation by line-segments what looks about the same there the points cloud is dense enough.
To be able to draw fitpoint splines the only advice is to upgrade to QCAD PRO or to use the trial version.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Running Scripts
Hi CVH;
SOLVED !!! I worked on my own attempts, They were not the issue, but the addPolyline( ... ) did the trick.
On to learn more, and I feel I will go to the Professional after I get more experience ......
Thanks for the strong support...
Joseph1916
SOLVED !!! I worked on my own attempts, They were not the issue, but the addPolyline( ... ) did the trick.
On to learn more, and I feel I will go to the Professional after I get more experience ......
Thanks for the strong support...
Joseph1916
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Running Scripts
CVH,
Hey
My objective with QCAD is to create a a 2d JavaScript array database of Point values that will be assigned Point Numbers contained in Column 1 of the 2d array. Column 2 3 and 4 will be the XYZ of the respective Points. Column 5 would be a description.
I was a Survey Engineer, with no Software but Civil 3D, and that is not for Surveyors, And its price is outrageous.
Joseph1916, Retired Surveyor
Hey
My objective with QCAD is to create a a 2d JavaScript array database of Point values that will be assigned Point Numbers contained in Column 1 of the 2d array. Column 2 3 and 4 will be the XYZ of the respective Points. Column 5 would be a description.
I was a Survey Engineer, with no Software but Civil 3D, and that is not for Surveyors, And its price is outrageous.
Joseph1916, Retired Surveyor
Re: Running Scripts
Joseph1916,
QCAD PRO comes with a powerful script developed by Andrew: Import Points with Labels ...
Have a look here:
https://qcad.org/en/tutorial-importing- ... s-from-csv
Various kinds of points can later be stored to use as coordinate input data for creating splines/polylines ... For inserting blocks ... And so on.
https://qcad.org/en/tutorial-reusing-drawing-positions
Exporting things in a drawing to CSV can already be done by an OS Command Line tool dwg2csv:
https://qcad.org/en/products/qcad-command-line-tools
That CSV data may require some polishing up.
Regards,
CVH
QCAD PRO comes with a powerful script developed by Andrew: Import Points with Labels ...
Have a look here:
https://qcad.org/en/tutorial-importing- ... s-from-csv
Various kinds of points can later be stored to use as coordinate input data for creating splines/polylines ... For inserting blocks ... And so on.
https://qcad.org/en/tutorial-reusing-drawing-positions
Exporting things in a drawing to CSV can already be done by an OS Command Line tool dwg2csv:
https://qcad.org/en/products/qcad-command-line-tools
That CSV data may require some polishing up.
Regards,
CVH
-
- Active Member
- Posts: 36
- Joined: Wed Jul 12, 2023 2:58 pm
- Location: Florida
Re: Running Scripts
Scripts supporting ExMyMinimal.iu Code:
<?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>
<?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>
Last edited by Joseph1916 on Thu Aug 03, 2023 7:12 pm, edited 1 time in total.
Re: Running Scripts
Joseph1916,
Below is the exact same text as in the post above.
Simply copied whole your topic content and pasted it in the reply topic text box:
Seems to look well formatted as code when I do it.
Sure, indentations are removed in your post as do all leading spaces in plain text.
That won't happen if the text is in a code box.
Regards,
CVH
I can not comprehend how and why this will not work for you ...
Below is the exact same text as in the post above.
Simply copied whole your topic content and pasted it in the reply topic text box:
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>
Sure, indentations are removed in your post as do all leading spaces in plain text.
That won't happen if the text is in a code box.
Regards,
CVH