RPolyline.reverse() apparently only returns the bool value of true. What is the intent of this method?
Does a method exist for RPolyline which will reverse the direction of the polyline, reverse the order of the vertices?
I want to reverse a polyline then appendVertex() or appendShape() to the original startPoint of the polyline. I have polylines that I am attempting to aggregate that were drawn with different orientations, clockwise or counter-clockwise with respect to the closed outline I am attempting to create from them.
reversing polylines
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.
Re: reversing polylines
Yes, reverse is the method you are looking for. Perhaps, you can provide a bit of context (code), so we can help efficiently.
You also might want to have a look at this code of the Modify > Reverse tool of QCAD which also works for polylines:
https://github.com/qcad/qcad/blob/maste ... Reverse.js
You also might want to have a look at this code of the Modify > Reverse tool of QCAD which also works for polylines:
https://github.com/qcad/qcad/blob/maste ... Reverse.js
Re: reversing polylines
Hi,
With an RPolyline shape in a variable called 'poly'
poly.reverse(); will reverse the orientation of the RPolyline stored in 'poly'.
That is all there is to it.
Also see:
https://qcad.org/doc/qcad/3.0/developer ... 14d08a32ef
var test = poly.reverse(); will indeed return a boolean in 'test' and also reverse the orientation of the shape in 'poly'.
You really don't need the var test = part.
The boolean is always true, see: https://github.com/qcad/qcad/blob/maste ... 1938-L1967
Line 1966 simply returns true.
Regards,
CVH
With an RPolyline shape in a variable called 'poly'
poly.reverse(); will reverse the orientation of the RPolyline stored in 'poly'.
That is all there is to it.
Also see:
https://qcad.org/doc/qcad/3.0/developer ... 14d08a32ef
var test = poly.reverse(); will indeed return a boolean in 'test' and also reverse the orientation of the shape in 'poly'.
You really don't need the var test = part.
The boolean is always true, see: https://github.com/qcad/qcad/blob/maste ... 1938-L1967
Line 1966 simply returns true.
Regards,
CVH