No poly offset ortho at endings

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Premier Member
Posts: 1559
Joined: Wed Sep 27, 2017 4:17 pm

No poly offset ortho at endings

Post by CVH » Thu Sep 26, 2019 6:27 am

Continuing from:
And all that were posted before.

I have issues with poly offsets since.... since ever.
I wondered that I might be the sole user that has these problems.
Probably, 123 views and non even tried.

With the little knowledge of scripting I first tried to follow the coding.
You may find my endeavour in: Bad poly offset.txt
The investigated path should return a correct distance!!

Then I tried to catch it in the act.
That was a little harder because core functions are involved.
But then a breakthrough.

As pro user the getDistance function is not handled by:
Instead it is handled by:

And for what my opinion is worth:
line 85-92 exclude any endings of line segments. :shock:
Furthermore, beside limiting inner segments,
line 83 will limit the outer ones too.

Code: Select all

77    OffsetThroughPro.prototype.getDistance = function(pos, shape) {
78        if (isPolylineShape(shape)) {
79            //return shape.getDistanceTo(pos, true);
80            var minDist = undefined;
81            for (var i=0; i<shape.countSegments(); i++) {
82                var seg = shape.getSegmentAt(i);
83                var d = seg.getDistanceTo(pos, true);
84                var p = seg.getClosestPointOnShape(pos, true);
85                if (isLineShape(seg)) {
86                    if (p.equalsFuzzy(seg.getEndPoint())) {
87                        continue;
88                    }
89                    if (p.equalsFuzzy(seg.getStartPoint())) {
90                        continue;
91                    }
92                }
93                if (isNumber(d) && (isNull(minDist) || d<minDist)) {
94                    minDist = d;
95                }
96            }
97            return minDist;
98        }
99        else {
100            return shape.getDistanceTo(pos, false);
101        }
102    };

Non-paying, non-pro user will get a proper offset.

Bad poly offset.txt
(3.49 KiB) Downloaded 185 times

User avatar
Site Admin
Posts: 7988
Joined: Fri Mar 30, 2007 6:07 am

Re: No poly offset ortho at endings

Post by andrew » Mon Sep 30, 2019 9:42 am

Thanks for your report.

Bug report at: ... sk_id=1948

Post Reply

Return to “QCAD Troubleshooting and Problems”