QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Suggestion
  • Category QCAD/CAM
  • Assigned To
    Andrew
  • Operating System macOS (All)
  • Severity Low
  • Priority Very Low
  • Reported Version 3.32.2
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by Robert Strubegger - 25.04.2025
Last edited by Andrew - 23.05.2025

FS#2666 - Mirroring produces Objects with unsorted handles. Causes ineffective laser cut

QCAD/CAM 3.32.2 / Qt 6.6.0 / macOS arm64 / cocoa

I am cutting multiple very short lines into plywood. They are constructed by QCAD and mirrored by MI function multiple times.
The original is in sequence by handle numbers and laser is cutting efficiently. The mirrored objects are cut inefficiently and it shows that the handle numbers are spread.
Look the video from the laser cut included.

(Response from laser cutter manufacturer: The laser cutter SW is not capable to sort the huge amount of vectors back to efficient sequence)

Closed by  Andrew
23.05.2025 20:14
Reason for closing:  Won't implement
Additional comments about closing:  

Handles do not have any guaranteed order.

CVH commented on 26.04.2025 07:36

Hi,

This is not a bug at the QCAD side.
Rather a limitation at the CAM side, see lower.
I would expected this as a forum topic under QCAD Troubleshooting and Problems

Unique object Handles are assigned on creation.
Entities are objects but not all objects are entities.
Making a selection would return a list of selected IDs not related to Handles.
The ID list of a selection can be in arbitrary order.
The mirror tool would create new entities in that order.

Another entity property is the Drawing Order.
The higher the more in front.
Again this is assigned on creation as 1 higher as what already exist in the drawing.
The mirror tool initially retains the original order as far as I know.
Note that the Drawing Order is re-assigned from zero and up on save-reload.

We would then expect that the mirrored copy has a +1 Drawing Order of the original.
And that the copies are re-ordered in between the originals.
Tested and confirmed on reload.
I can not recreate a random order with QCAD as seen in the attached DXF.

Depending the entity type and used tool it may apply the changes to the entity in direct or it may delete the original and recreate the entity over as new.
Note that things are not really removed from the storage in this open session because of the Undo/Redo functionality.


In all cases it is not correct to use the Handles as cutting order.

Drawing Order may be a better suited candidate when that is unique and well ordered.
Simply because the Drawing Order is editable and an entity Handle is not.

Calculating the most efficient cutting order for things that can be cut at the same time is typically solved with a symmetric TSP algorithm at the CAM side. But that is not easily or efficiently solved for 882 points.

Solving for an exact solution by brute force would test all (881)!/2 solutions and that is a number of permutations that you can not write down.
It would take years or even ages to test them all.

Near optimal solutions are found by for example the Nearest Neighbour (NN) algorithm.
Presumed to be exploited by QCAD/CAM.
However, there exist distributions which make the NN algorithm give less optimal or even the worst route.

Other good modern candidates are the 'Ant colony optimization algorithms'.
Recently there was a contribution by user Deejay that implemented this algorithm.
Still, it is 'near optimal' without a way to prove it is optimal.

Regards,
CVH

Robert Strubegger commented on 10.05.2025 11:09

Hi,
sorry that it took me so long to respond. I am not familiar with a lot of terms from your comment and had to check several facts.
The only entity properties I see in the tool are "Drawing Order" and "Handle". As Drawing Order is not unique (multiple entities have same Drawing Order value in my file) I assumed it must be the Handle which is sequence setting parameter. But it is not that simple as I understood from your comment.
You say the ID-list from the selection is arbitrary. And mirroring uses it for creation in that order.

Checked on my file with small number of lines:
1) Mirrored copy receives same Drawing Order like the original.
2) After save-reload, the copy has n+1 Drawing Order from the original
⇒ Laser cutter sequence is not in Drawing Order, otherwise it would always jump between original and mirrored copy. But Laser cutter is cutting original efficiently and later comes the mirrored copy and then it seem to be random.

... I still need to investigate further:
Why do I have multiple entities with same Drawing Order after reload of the file.
What parameter is key for the sequence of the laser cutter.

CVH commented on 10.05.2025 14:51

1) As said, Mirroring retains the original Drawing order for the copies ... Initially.

"(multiple entities have same Drawing Order value in my file)"
Is possible by editing or on creation ... Initially.

On closing/Reload or Save/Revert thing will be renumbered starting from 0 and up.
There is no answer given on whether this takes place on Saving or on Loading a file.

"and later comes the mirrored copy and then it seem to be random."

I could/can not replicate the fully random nature of mirrored copies based on:
- Handles
- Drawing Order
Seen in your first example file.

What I didn't test is the explosion of a Block References and its mirror.

"What parameter is key for the sequence of the laser cutter."
For now still a mystery.
A CAM should use some sort of re-sequencing based on some algorithm.

It is never the task of the QCAD part to ensure a certain sequence.
QCAD/CAM also exploits re-sequencing for shorter travel time.

Regards,
CVH

Robert Strubegger commented on 10.05.2025 16:37

Hi,
thank you for the fast response.

You are absolutely right, it is not the job of QCAD to put in an efficient sequence for the cutter. If I understand how the random gets created then I can think of a workaround in my workflow.
Even when I end up in not use mirror and have to live with just move.

Regards
Schoggi

CVH commented on 11.05.2025 08:57

Hi,

Move a copy of a selection or duplicate and move that selection would also be an arbitrary ID order of selected items. Items are then processed in that order.

About sure concerning 'arbitrary'.
Repeated test with a few selected entities for a custom tool revealed that order of the array with selected IDs is not the same from case to case.

I can't explain the neat vs random order I see in your document.
Perhaps the CAM altered these ...

Regards,
CVH

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing