I'm a QCAD 3.23.0.0 (3.23.0) x86_64 Windows 10 Pro/user
I would like to create polylines from all the segments in my document.
Something along the lines of:
include("scripts/Pro/Draw/Polyline/PolylineFromSelection/PolylineFromSelection.js");
var ids = doc.queryAllEntities();
var op = new RMixedOperation();
PolylineFromSelection.createPolyline(op, ids, document, new RVector(1.0e-3, 1.0e-3));
Obviously this doesn't work as:
1) PolylineFromSelection there is no documentation for which method there are within the PolylineFromSelection object.
2) The arguments for such method and how to obtain the selection etc...
Could you please provide an example.
I couldn't find anything om the documentation or in the forum
I found examples for PolylineFromSegments (which expects a single entity) but not for PolylineFromSelection.
Best Regards
Daniel Hung
How do I run "Polyline From Selection"
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.
-
- Junior Member
- Posts: 10
- Joined: Thu Nov 14, 2019 4:15 pm
Re: How do I run "Polyline From Selection"
There are methods described to launch a Qcad function from its scriptfile.
Including the things a user would set up when initiating the function.
But I have to look that one up too.
it won't be obvious ....
keywords; script, run, ...
Another example would be:
https://qcad.org/rsforum/viewtopic.php?f=32&t=6801
Regards
CVH
Including the things a user would set up when initiating the function.
But I have to look that one up too.
it won't be obvious ....
keywords; script, run, ...
Another example would be:
https://qcad.org/rsforum/viewtopic.php?f=32&t=6801
Regards
CVH
Re: How do I run "Polyline From Selection"
Do you just want to do this with a document or do you want to run it as part of a (more complex) script?daniel_frac wrote: ↑Thu Mar 12, 2020 5:15 pmI would like to create polylines from all the segments in my document.
In the first case, simply select all segments and run Draw > Polyline > Polyline from Selection.
-
- Junior Member
- Posts: 10
- Joined: Thu Nov 14, 2019 4:15 pm
Re: How do I run "Polyline From Selection"
Sorry I forgot to mentioned I want to run this as a script no interactively
Re: How do I run "Polyline From Selection"
Assuming, di is your RDocumentInterface, first, you need to select all entities you want to use as segments for the new polylines. E.g.:
This would be to use all entities.
Then, you can run:
Where tolerance is the maximum gap allowed between segments to still join them into a polyline. The return value is the number of polylines created.
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.
Code: Select all
di.selectAll();
Then, you can run:
Code: Select all
var counter = PolylineFromSelection.autoJoinSegments(di, tolerance);
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.
-
- Junior Member
- Posts: 10
- Joined: Thu Nov 14, 2019 4:15 pm
Re: How do I run "Polyline From Selection"
Is the tolerance a parameter a single floating nunber or a vector like new RVector(1.0e-3, 1.0e-3)
-
- Junior Member
- Posts: 10
- Joined: Thu Nov 14, 2019 4:15 pm
Re: How do I run "Polyline From Selection"
Also is there a way to do it rather than by selecting, but using a list of entities or id's?
Re: How do I run "Polyline From Selection"
Tolerance is a number.
No.Also is there a way to do it rather than by selecting, but using a list of entities or id's?