Linux: Ubuntu 20.04 and Wayland
qcad-3.27.1-pro-linux-qt5.14-x86_64
Hello,
I want to change a rectangle build by 4 lines to a rectangle made by one polyline using a script. I use your script “ExThreePoints.js” to test functions for my script and copied it to my script ExTrial.js for modifications.
I found two entries in your forum for the solution:
But none of this will work. I put the code to my script and got in both case the error (running qcad in debug mode): “Uncaught exception at scripts/PPeters/ExTrial/ExTrial.js:111: ReferenceError: Can’t find variable: PolylineFromSelection”
(attached screenshot)
Remark that di.selectAll(); will select all selectable entities in a drawing.
Poly from selection would than merge everything that can be considered as a chain of segments.
And not only some rectangles build by 4 lines.
For that you need to evaluate all entities first on whether they make up a quadrilateral.
Deselecting those that don’t or merely selecting those that will.
Without selecting all first in your script, it would run on those that are selected before you initiate it.
In the way you are scripting right now is nothing more than TA followed by OC.
Remark also that the QCAD shape tools create quadrilaterals as 4 lines or optionally as a polyline.
Maybe it is just a question of using the correct option on creation.
Please keep in mind that PolylineFromSelection is not part of the public API but part of the proprietary API of QCAD Professional. Feel free to call this from your script, but keep in mind that this API might change in a future version.