AutoCAD overkill command in QCAD?

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
Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

AutoCAD overkill command in QCAD?

Post by Sypher2012 » Wed Mar 03, 2021 2:27 pm

Lucky I stumble upon this great AutoCAD alternative but one thing that keep me switching back to AutoCAD is the "overkill" command! For those unfamiliar, it is basically a way to clean up loose end from objects. We are talking about overlapping line, arc, circles, you name it. One button does it all.

From what I understand, QCAD have the Detect Duplicates (MD). Changing the tolerance would add more to you selections but it's limited and doesn't always detect. After that you need to join the lines with the polyline (og/oc) command. There is also the select filter. I have tried those in combination but it doesn't clean up properly.

I have the following files that I need to clean up. A rectangle with a bunch of small holes. If you examine one of the hole in AutoCAD with explode command, it will shows two half arc making that circle and some overlapping lines around on the rectangle.

How do I clean up the file to make sure there are no overlapping line at all with the least amount of step since there are many more files like this that would have more complicated shapes?

-Windows 10
-Version 3.25.2.0

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

Re: AutoCAD overkill command in QCAD?

Post by petevick » Wed Mar 03, 2021 4:29 pm

did you forget to attach your files ??
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

Re: AutoCAD overkill command in QCAD?

Post by Sypher2012 » Thu Mar 04, 2021 3:43 pm

Sorry, here it is.
Attachments
Sample1.dxf
(5.38 KiB) Downloaded 378 times

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

Re: AutoCAD overkill command in QCAD?

Post by CVH » Thu Mar 04, 2021 4:07 pm

Hi,
Sypher2012 wrote:
Wed Mar 03, 2021 2:27 pm
and some overlapping lines around on the rectangle.
The rectangle is a logical closed polyline with 4 vertices.
I would not expect 'some overlapping lines' there and a QCAD explode returns 4 neat line segments.

Sypher2012 wrote:
Wed Mar 03, 2021 2:27 pm
If you examine one of the hole in AutoCAD with explode command, it will shows two half arc making that circle.

When one uses the QCAD explode method on a Circle entity it will turn into a Polyline representing two semi-circles.
If one explodes those Polylines then they become two semi-circle Arc entities.
Nothing wrong with that.

I don't know how the circles got exploded.
Recently Andrew added an option in the QCAD settings to exclude the explosion of Circle entities.

Type 'TA' ... All 27 entities selected.
All 27 entities are accounted for. I don't find any overlapping entities.

Regards,
CVH

Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

Re: AutoCAD overkill command in QCAD?

Post by Sypher2012 » Thu Mar 04, 2021 5:38 pm

Thanks CVH, I am using this file for a laser machine and if there are just 1 overlapping line or if it's broken down to two arc then the laser will follow that path. Meaning it will cut the first arc then the second arc to make the circle instead of one smooth clean motion.

One of the test I added in the line manually and forgot to do it in this sample. It doesn't seem to detect it unless I use the filter setting.

Can you upload your file for this one? It doesn't show in QCAD but what ever I do to this file to clean it up, AutoCAD overkill always find overlapping entities. It doesn't show in QCAD but AutoCAD finds them. Overkill combine combine those two arc in question.

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

Re: AutoCAD overkill command in QCAD?

Post by Husky » Thu Mar 04, 2021 11:32 pm

Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
One of the test I added in the line manually and forgot to do it in this sample. It doesn't seem to detect it unless I use the filter setting.
What could be the benefits of a test file which is already clean .... :?: :?: :?:

Anyway - assuming you are looking to clean up this sample file down to the polylines (9) I would just use the selection filter, search/select polylines, invert selection (TI), delete. No need to mess around with exploding, arcs etc.etc.
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..."

Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

Re: AutoCAD overkill command in QCAD?

Post by Sypher2012 » Fri Mar 05, 2021 3:04 am

Husky wrote:
Thu Mar 04, 2021 11:32 pm

What could be the benefits of a test file which is already clean .... :?: :?: :?:

Anyway - assuming you are looking to clean up this sample file down to the polylines (9) I would just use the selection filter, search/select polylines, invert selection (TI), delete. No need to mess around with exploding, arcs etc.etc.
What you have suggested work. It look clean in QCAD but when I import the save file into AUTOCAD and run the overkill command. It shows 8 overlapping object(s) or segment(s) deleted. AutoCAD seems to automatically combine the arc cleanly and also can detect and remove the test line that I drew in QCAD.

I am not knocking this program. I just want to understand a better/faster way of getting the job done in QCAD. I like how this program is mostly user driven.

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

Re: AutoCAD overkill command in QCAD?

Post by CVH » Fri Mar 05, 2021 3:33 am

Hi,
We are standing in the dark ...
Following Husky guidelines you just deleted 16 Line segments and 2 Text entities.
Leaving only 9 Polylines.
With 9 Polylines + 1 mistery Line AutoCAD detects 8 overlapping object(s) or segment(s).
One would be that mistery Line you added + 7 others.
(9+1) minus 8 so 2 Entities remain ...
Or is it (9+1) minus (8+1) and only one entity remains?
It all makes no sense to me.


In your file 'Sample1.dxf' there are, 9 Polylines, 16 Line segments and 2 Text entities.
1 Polyline is a neat outer contour on layer 'CUT' with only 4 straight segments.
The other 8 Polylines on Layer '18' are circular shaped and probably were circles initially.
The 16 Line segments are by pair a cross in the 8 circle shaped Polylines, also on layer '18'.
2 Text on two different layers, 1 on 'SCRIBE' & 1 on 'TEXT'

One can't state that the 8 crosses and the 2 text overlap other entities.
Sure the 8 crosses are in the voids by the holes and the texts are on the plate.
In real live.
That is not what is meant by overlapping drawing entities.

What is the request here?
OverKill command : feature request by Andrew himself, early 2018.
https://www.ribbonsoft.com/bugtracker/i ... sk_id=1723
Although the summary is 'Detecting overlapping line / arc segments'
A method that surfaced many times when users fail to find such with QCAD method 'Detect Duplicates'.
The MD method is not intended for partially overlapping among other things.
BUT
None of the 27 entities in your file do overlap!
The 'one button does it all' won't fix what simply isn't there.
Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
Overkill combine combine those two arc in question.
Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
Meaning it will cut the first arc then the second arc to make the circle instead of one smooth clean motion.
There are no Arc entities in your drawing!
There only would be 16 semi-circle Arcs if you explode the 8 Polylines on Layer '18' yet again.
Why exploding them? I see no reason to do so.
Keep them as Polylines and laser cut them as 8 individual entities with a perfect and smooth round shape.
Let me add some questions:
- Why were those original Circle entities changed to circular Polylines in the first place?
- With what intention and with what application were those exploded knowing there is no easy way back?
- What was wrong with 8 Circle entities?
- What purpose have those 8 crosses while laser cutting?
- Why all the explode/investigate/overkill with AutoCAD?
Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
AutoCAD overkill always find overlapping entities. It doesn't show in QCAD but AutoCAD finds them.
That is AutoCAD its problem.
I investigated the dxf sample file textual in detail: 988 text lines
>> There is nothing else as the known 27 entities in there.
Sounds like AutoCAD finds more than there actually is.
Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
One of the test I added in the line manually and forgot to do it in this sample.
Please, attach such a file with 'the line' in it.
In Husky's words: What could be the benefits of a test file which is already clean ....
In other words: Send us your worst example file.
Sypher2012 wrote:
Thu Mar 04, 2021 5:38 pm
@CVH: Can you upload your file for this one?
That would be exactly your file because:
From my point of view there is nothing wrong with the one you posted:
Sample1.dxf
(5.38 KiB) Downloaded 358 times


The key questions here are:
A) How to revert back an explosion of Circle entities?
B)
Sypher2012 wrote:
Wed Mar 03, 2021 2:27 pm
How do I clean up the file to make sure there are no overlapping line at all with the least amount of step since there are many more files like this that would have more complicated shapes?
Both have no easy answer.

For A) I could write a script based on:
https://qcad.org/rsforum/viewtopic.php? ... 592#p31590
Although, It served me more to exclude Circle entities from being exploded in the first place, even by accident.

For B) ? more complicated shapes ? We can only guess.

Try my sources instead. As engraver, I get horrible art designs.
I spent most of my time cleaning them up. There is no 'one click' solution for all.
For a sub 0.1mm engraving tip the paths have to be really smooth, I mean rather perfect.

On top, my CNC engraver won't stop/start at tangentially connected shapes.
Nor would it at nodes of circular Polylines.
Many start/stopping, but surely steep corners would kill my cutters.
A laser doesn't have that downside.

Looking forward for a really problematic example file.
BTW: I would really want to see those polylines with 1 full arc segment :lol:

Regards,
CVH

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

Re: AutoCAD overkill command in QCAD?

Post by CVH » Fri Mar 05, 2021 6:16 am

Bitte:
Tick 'SELECT ALL', copy and save it as a *.js file (eg. CircPoly2Circ.js)
Run it in QCAD on a selection with Menu Misc .. Development .. Run Script (XC).

Code: Select all

// Full circular Polylines with 2 Arc segments to Circles script by CVH
var doc = getDocument();
var di = getDocumentInterface();
var polysCollected = [];

// Retrieve the selection:
var ids = doc.querySelectedEntities();

// Terminate without selection:
if (ids.length === 0) {
    EAction.handleUserWarning("Nothing Selected! Script terminated.");
    return;
}

// Filter full circular Polylines with 2 Arc segments from selection:
for (var i=0; i<ids.length; i++) {    //Cycle selected entities
    // Get entity from the document:
    var entity = doc.queryEntity(ids[i]);

    // Collect when exist and is full circular shape:
    if (!isNull(entity)){
        if (isClosedPolylineEntity(entity)) {
            if (entity.countVertices() === 2) {
                if (RMath.fuzzyCompare(entity.getBulgeAt(0), 1.0) && RMath.fuzzyCompare(entity.getBulgeAt(1), 1.0)){
                    polysCollected.push(ids[i]);
                }
            }
        }
    }
} // Loop selected entities

// Terminate without full circular Polylines in selection:
if (polysCollected.length === 0) {
    EAction.handleUserWarning("No full circular Polylines selected! Script terminated.");
    return;
}

// Setup an operation:
var operation = new RModifyObjectsOperation();
operation.setText("Full circular Polylines to Circles");

// Process collected Polylines:
for (var i=0; i<polysCollected.length; i++) {    //Cycle collected Polylines
    // Get full circular Polylines from the document:
    var fullPoly = doc.queryEntity(polysCollected[i]);
    var centerRv = RVector.getAverage(fullPoly.getStartPoint(), fullPoly.getVertexAt(1));
    var radius = fullPoly.getStartPoint().getDistanceTo2D(fullPoly.getVertexAt(1)) / 2;

    // Create a new Circle entity:
    var newCircle = new RCircleEntity(
                    doc,
                    new RCircleData(
                        centerRv,
                        radius
                    )
    );

    // Add the new Circle to the operation:
    operation.addObject(newCircle, false, true);    // NOTuseCurrentAttributes, DOforceNew

    // Mark the full circular Polyline to delete:
    operation.deleteObject(fullPoly);
} // Loop collected Polylines

// Apply all modifications:
di.applyOperation(operation);

// Finished:
var msg = "Created " + polysCollected.length + " Circle entity/ies."
EAction.handleUserInfo(msg);
EAction.handleUserMessage("Script ended.");
return;

Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

Re: AutoCAD overkill command in QCAD?

Post by Sypher2012 » Sat Mar 06, 2021 3:28 pm

Great detective work there CVH, you're not wrong on many count. It might be AutoCAD itself that is the problem because I have a certain workflow that I do and when I tried to do the same in QCAD, it is where I got a different results. I've attached a cleaned out file from AutoCAD perspective on what it say a problem free file should be. Your script actually does a better job and in this case for me and shows a file that AutoCAD have ZERO problem with..

There is something that I must be doing wrong on the detect duplicate command and the detect zerolength command. I place 2 of the following object as a simple test but it failed to detect both. See attachment file Sample1 Fail.dxf
1. I drew a square matching all four corners and sitting exactly on top so pretty much a duplicate
2. I drew a broken line segment from one corner to the other end, still overlapping
Attachments
Sample1 fail.dxf
(101.06 KiB) Downloaded 342 times
Sample1 cleaned.dxf
(101.29 KiB) Downloaded 343 times

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

Re: AutoCAD overkill command in QCAD?

Post by CVH » Sat Mar 06, 2021 5:26 pm

Hi again,
Now I see circles. Did you used the script?

Sample1 cleaned.dxf is clean as a whistle.
8 circles and 4 lines.
In QCAD simply type 'TA' and look at what the 'Selection' returns in the Property Editor.
Although I would prefer the outer contour as a Polyline.
One single neat closed chain of line segments.

Sample1 fail.dxf
TA >> 14 Entities and I only see 9 or 12 depending the contour is 1 or 4.

MD, 0.001 Distance & Angle Tolerance, ignore direction, ignore layer
Any QCAD tool with settings shows these on the Options Toolbar.

That finds 1 duplicate line at the bottom.
Close the tool.

Alt+Select the lower horizontal
>> Poly 4400 + Line 1100 + Line 1100
The last two are exact duplicates, one of the two is found by MD

Alt+Select the higher horizontal
>> Poly 4400 + Line 1100
MD doesn't consider this as duplicates

Alt+Select left or right vertical
>> Poly 4400 + Line 1100
MD doesn't consider both Lines as duplicates

Like I mentioned, QCAD MD will not find partial overlapping, among others.
Here the Overkill would come into play.
A Line entity 1100 long matches one segment of the Polyline.

Now what you don't want to do is TA, OC, to create 2 Polylines that would match.
Two reasons:
- The contour becomes a Poly with 10 vertices, all Lines merge with the Polyline.
- Even disregarding not exploding circles (Application Preferences), they become polylines with 2 semi-circles Arcs.

Thanks for letting me discover the second.
An other thing to worry about in the future.
I will request to exclude Circles from OC.

Regards,
CVH

John Hyslop
Premier Member
Posts: 473
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: AutoCAD overkill command in QCAD?

Post by John Hyslop » Sat Mar 06, 2021 11:34 pm

Hi Sypher2012
1st Great work CVH very handy script and downloaded :)
Just a tip if I may add my 2 cents worth. :)
I have been creating patterns for laser cutters for 20 odd years and also missed the
Overkill command when moving across to Qcad.
Until one day I tried something ..:)
After running MD & MZ try "Solid Hatch" this will pick up overlapping entities,broken
profiles and small gaps , it displays the positions in red in the command line where the problem is,
what I do is draw a circle at those co-ordinates then fix the problem up, I sometimes
have to do this multiple times to catch all the errors.. It's worked for me, just thought
I'd pass on..
Most of the time it comes from a pattern supplied to me to fill a sheet up for a screen
and the pattern has errors and sometimes I myself might miss something or have a line
not trimmed correctly..

Cheers
John
PS Try this out with the attached file and you'll see what I mean :) It shows where all the faults are and you can fix up one by one
Attachments
test.dxf
(196.66 KiB) Downloaded 332 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

Sypher2012
Newbie Member
Posts: 7
Joined: Wed Mar 03, 2021 2:01 pm

Re: AutoCAD overkill command in QCAD?

Post by Sypher2012 » Sun Mar 07, 2021 6:17 pm

Thank you both CVH and John for your suggestions.

John: I think that is a very creative way on finding open area in a drawing! I never thought about doing like that but will have to try to add that in to my QCAD workflow now.

CVH: I have uploaded a sample2 file that is more complicated than the first one.

Another way of thinking of the "overkill" command is a tool that would flatten or condense current selections. Something that would stripe it down to it's bare minimum without changing what it would look like in the final render. Not sure if there is a QCAD equivalent.
Attachments
Sample2.dxf
(145.06 KiB) Downloaded 317 times

John Hyslop
Premier Member
Posts: 473
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: AutoCAD overkill command in QCAD?

Post by John Hyslop » Mon Mar 08, 2021 12:28 am

Hi Sypher2012
I know the method I mentioned isn't anyway as good as the overkill command but I'm pretty sure someone might be able to create a tool for this eventually but just wanted to share another way of checking files for laser cutting hatching will also find overlapping entities 👍
There is a command Flatten though.. It's here
Misc>Modify>Flatten Drawing to 2D.
Basically sets all Z entities to 0..

Hope this helps :)
Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

Post Reply

Return to “QCAD 'How Do I' Questions”