Detect and unify overlapping elements ?

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
spaskalev
Newbie Member
Posts: 6
Joined: Wed Oct 07, 2020 6:00 pm
Location: Bulgaria

Detect and unify overlapping elements ?

Post by spaskalev » Sun Nov 15, 2020 5:48 pm

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!

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Detect and unify overlapping elements ?

Post by petevick » Sun Nov 15, 2020 6:31 pm

you can delete all duplicated lines by using Menu: Modify > Detect Duplicates
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

spaskalev
Newbie Member
Posts: 6
Joined: Wed Oct 07, 2020 6:00 pm
Location: Bulgaria

Re: Detect and unify overlapping elements ?

Post by spaskalev » Sun Nov 15, 2020 8:36 pm

I know, but this functionality currently will detect only complete duplicates, not partial ones.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4942
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Detect and unify overlapping elements ?

Post by Husky » Sun Nov 15, 2020 10:13 pm

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 4835 times
Husky-2020.11.15-03.png
Husky-2020.11.15-03.png (8.05 KiB) Viewed 4835 times
Husky-2020.11.15-02.png
Husky-2020.11.15-02.png (1.73 KiB) Viewed 4835 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 ...
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

CVH
Premier Member
Posts: 3479
Joined: Wed Sep 27, 2017 4:17 pm

Re: Detect and unify overlapping elements ?

Post by CVH » Mon Nov 16, 2020 7:36 am

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 4820 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

spaskalev
Newbie Member
Posts: 6
Joined: Wed Oct 07, 2020 6:00 pm
Location: Bulgaria

Re: Detect and unify overlapping elements ?

Post by spaskalev » Tue Nov 17, 2020 3:58 pm

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.

CVH
Premier Member
Posts: 3479
Joined: Wed Sep 27, 2017 4:17 pm

Re: Detect and unify overlapping elements ?

Post by CVH » Tue Nov 17, 2020 4:35 pm

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

Post Reply

Return to “QCAD 'How Do I' Questions”