QCAD Bugtracker

  • Status Closed
  • Percent Complete
  • Task Type Feature Request
  • Category ECMAScript
  • Assigned To
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 3.18.1
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by Christoph Derigo - 12.10.2017
Last edited by Andrew - 12.10.2017

FS#1643 - Modify > Explode: make drawing order predictable

Multiple entities ( for example polylines ) get exploded...

the exploded lines have all the same drawing ids the old entities had, a consequence of this is that when one explodes and then exports to dxf file the line order get’s scrambled wildly
the exported order is “random”!

sort the selected entities by their id first then
after copying attributes ⇒ also set the order of the elements to the default order !
( see fix in sourcecode attached )

Closed by  Andrew
12.10.2017 13:36
Reason for closing:  Implemented
Additional comments about closing:  

Define draw order based on draw order property and entity ID:
https://github.com/qcad/qcad/commit /cce72665ff661f8c2b9adcd17759d7338a09116 7

Andrew commented on 12.10.2017 11:18

If I understand this request correctly, you want to make sure that the drawing order of resulting entities after exploding a set of entities is somehow predictable.

The current implementation explodes each entity with drawing order D into a number of new entities, all with the same drawing order D. This is important to maintain the overall drawing order in the entire drawing and prevent entities from being moved into the foreground when exploded. Imagine a hatch entity in the background of a drawing. Exploding it would move it into the foreground of the drawing if your proposed changes are applied to Explode.js.

Unfortunately, I cannot see an easy way to make the drawing order of exploded entities predictable (without changing the drawing order and thus changing the appearance of the entire drawing).

May I ask why this is important for your use case? Perhaps there is another solution to your particular problem.

Christoph Derigo commented on 12.10.2017 11:27

First of all thank you for the quick responce!

For the explanation:
I can also see the problem of maintaining the overall drawing order...
But for us it is more important to keep the order of the exploted elements, as we are useing qcad to cleanup very special dxf's that are used in the pcb industry ( ⇒ there are no background entities at all )
Moreover it is crucial to get a resulting dxf where for polylines the exploted lines have the sequencial order of the polyline....
i did not find any other way to do this...

⇒ we want to convert polyline to lines and keep the order of the poly points ⇒ this is important if you for example want to move along a path with a machine for example..

Andrew commented on 12.10.2017 13:14

Thanks for the details.
I think we can account for this by falling back on the entity ID for drawing order for entities with identical draw order.

I.e. the drawing order is defined by the draw order property (1st priority) and the entity ID (2nd priority, if draw order is identical).

Christoph Derigo commented on 12.10.2017 13:23

Just for understanding:
is this going to be changed in the dxf output in future releases, this may be a general problem when someone uses identical draw orders,
i see ⇒ the Handle values change but the drawing values stay the same. ⇒ by useing a combination it should be possible to get the right order out...

regards Christoph Derigo

Andrew commented on 12.10.2017 13:34


DXF does not define an explicit draw order value at all. The draw order is implicitly defined by the order in which entities are stored. At the moment this can be arbitrary for entities with the same draw order.

Since QCAD uses the same algorithm to define draw order as to define storage order in DXF, the draw order is always identical to the storage order in DXF.


Available keyboard shortcuts


Task Details

Task Editing