Mailing list archives : pcb-rnd

ID:3246
From:ge...@igor2.repo.hu
Date:Wed, 7 Aug 2019 09:11:10 +0200 (CEST)
Subject:[pcb-rnd] new: smash multiple subcircuits in buffer
Hi all,
 
we had an annoying corner case (inherited from PCB^1): the smash buffer 
feature (the one that breaks up subcircuit data in a buffer into 
individual objects) operated on only one subcircuit. If the buffer had 
more subcircuits, we threw an error and didn't do anything.
 
The new code can deal with multiple subcircuits and break them all up. 
(More precisely, it breaks up the first level of subcircuits, which will 
make a difference once we will have subc-in-subc.)
 
Note: the smash code breaks up subcircuits in the current buffer and 
leaves any other object intact. So you can have, for example, 3 
subcircuits and 2 lines in your buffer, break it all up, and the 2 lines 
will still be in the buffer among the new objects coming out of the 
subcircuits.
 
 
Keantoken, please test this, you were the original reporter of this 
misfeature. 
 
 
 
Fine print:
 
This also makes smash buffer and convert-objects-to-subcircuit 
somewhat asymmetric: 
 
- A heap of objects can be converted only into one subcircuit in one
go (else we would need some tricky way to tell which objects go in which
subc, which is more complicated than just doing multiple conversions). So 
the output of the forward transformation is always one subc (from many 
objects).
 
- Smash buffer can convert from multiple subcircuits into a heap of 
objects. So the input of smashing can be multiple subcircuits.
 
Which means you can still use convert and smash for a full round trip for 
a single subc, but if you have multiple subcircuits you can't achieve 1:1 
smash/convert round trips without using multiple converts. In other words:
 
- objects -> convert-to-subc -> smash  will always give you back the same 
objects
 
- but smash -> objects -> convert-to-subc will give you back the same subc 
only if you started from a single subc in buffer; if you had two 
subcircuits, they both will get smashed but convert "won't remember you 
had two", so the result will be one big subc containing all your objects. 
This is not a bug, this is by design.
 
 
Footnote:
 
^1: in geda/pcb, last time I checked, if you had multiple elements in 
buffer, the smash action silently failed - no error message, just didn't 
do what you asked. I think it's a bug. pcb-rnd at least gave an error.
 
Regards,
 
Igor2
 

Reply subtree:
3246 [pcb-rnd] new: smash multiple subcircuits in buffer from ge...@igor2.repo.hu