Page 1 of 1

Detect and unify overlapping elements ?

Posted: Sun Nov 15, 2020 5:48 pm
by spaskalev
As a result of drawing something with more operations I am often left with overlapping elements. Since they overlap perfectly they usually go unnoticed. However, if I later try something like stretching a part of the drawling the helper elements that I've used often remain.

Is there a way to 'optimize' a drawing and remove such elements that don't contribute to the render of a layer ? Thanks!

Re: Detect and unify overlapping elements ?

Posted: Sun Nov 15, 2020 6:31 pm
by petevick
you can delete all duplicated lines by using Menu: Modify > Detect Duplicates

Re: Detect and unify overlapping elements ?

Posted: Sun Nov 15, 2020 8:36 pm
by spaskalev
I know, but this functionality currently will detect only complete duplicates, not partial ones.

Re: Detect and unify overlapping elements ?

Posted: Sun Nov 15, 2020 10:13 pm
by Husky
spaskalev wrote:
Sun Nov 15, 2020 8:36 pm
I know, but this functionality currently will detect only complete duplicates, not partial ones.
Yes and no.
Yes: If you play with the tolerance you can catch a lot of partial duplicates.

Husky-2020.11.15-01.png
Husky-2020.11.15-01.png (6.86 KiB) Viewed 7379 times
Husky-2020.11.15-03.png
Husky-2020.11.15-03.png (8.05 KiB) Viewed 7379 times
Husky-2020.11.15-02.png
Husky-2020.11.15-02.png (1.73 KiB) Viewed 7379 times

No: I've to admit that that is a world with many unknown factors - I've still not figured out which mathematically rules are used for that function ...

Re: Detect and unify overlapping elements ?

Posted: Mon Nov 16, 2020 7:36 am
by CVH
Hello,

Indeed, a feature that is missing for long.
Just as Husky ... I can't get my mind around the functionality of MD.

On top, I need that functionality to finish Tile2Hatch.
Overlapping, but also just touching.
Catch 22: Coding touching in-line hatch segments leads to a spacing of 0 and a zero is a Dot.


Large tolerances are no solution either.
This is even rather or very dangerous in complex designs!

MD_vs_large_values.png
MD_vs_large_values.png (27.13 KiB) Viewed 7364 times
In this example the horizontal is not selected by angle tolerance but by distance !!!
I presume 'angle tolerance' is for arc segments ... ?!
In Husky's example a value of 35 or so would select almost every entity.

'Overlapping elements' also means that only two ends overlap.
MD doesn't catch those.
'Unify overlapping elements' means they are converted to one single entity.
MD only selects those found by the fuzzy criteria.
One can erase duplicates found in one (too easy) click.
Unifying is something totally different.

Usually my approach is to transfer those found to a temporary layer.
Same with MZ.
Then I run OG/OC on copies and isolate dropouts (those not part of the poly)
OC will merge/unify some arc segments, OS can merge line segments.
After several recursive processing, back and forth, I get neat polys that explode to neat segments...
Then the human decides in what to keep and what to throw away.
In fact, I usually don't throw away much ... I rather isolate them ... The safest way so far.

Regards,
CVH

Re: Detect and unify overlapping elements ?

Posted: Tue Nov 17, 2020 3:58 pm
by spaskalev
That's why I was thinking of a brute force algorithm - select any element that does not change the render in model space when removed. I might try to hack something up on it, time permitting.

Re: Detect and unify overlapping elements ?

Posted: Tue Nov 17, 2020 4:35 pm
by CVH
spaskalev,
Indeed the goal of whole my approach.

Left alone that deleting any element that does not change the render in model space by brute force ...
... won't detect and delete neither of two overlapping elements.

If only 'Detect and unify overlapping elements' was that easy. :cry:

What you are proposing is 'Remove Redundant' like what MD does not as mentioned in the 3e post.

spaskalev wrote:
Tue Nov 17, 2020 3:58 pm
I might try to hack something up on it, time permitting.
I don't want to discourage you, but knowing that scripting under QCAD can be very difficult,
I'm looking forward to it on the 'QCAD Developers and Contributors' forum.

I would be glad to help you there for the mentioned reasons. :wink:

Regards,
CVH