X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Thu, 19 Oct 2017 06:26:35 +0200 (CEST) X-X-Sender: igor2 AT igor2priv To: geda-user AT delorie DOT com X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu" From: gedau AT igor2 DOT repo DOT hu Subject: [geda-user] [pcb-rnd] subc: refdes text: dyntext and floaters Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Reply-To: geda-user AT delorie DOT com Hi all, the last piece of the subc "refdes text" cleanup is done. The new code fits nicely into the new data model and pcb-rnd's approach: instead of hardwired hacks and side effects that happen to do The Right Thing for one specific case, provide a few, orthogonal features that can be combined to do the same thing, or 100 other things. Old, pcb-mainline model: "element text" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An element has 3 hardwired text objects that have to contain the refdes, the value and the footprint name. Further limitations: - all three element text object have to have the same coordinates and font and size - they can be only on silk, and all three must be on the same silk layer - special exception from under the element-lock: the only element-part you can move without moving the element is the element text (e.g. the only element part that can change its position compared to other parts of the element without breaking the element up first) - and the element text can always be moved, you can't locally lock it to the element; so you can't have a special element where the text has a fixed position for whatever reason - there was exactly 3 of these - no more, no less - they could contain only what the programmer thought would be useful - only one of them could be displayed at a time, and which one got displayed was a board-global setting; this global setting also affected some New, pcb-rnd subc model: ~~~~~~~~~~~~~~~~~~~~~~~~ Instead of the bunch of hardwired properites and restrictions of an element text, subcircuits offer a set of orthogonal features that can be used to reproduce the behavior of element texts too, but can also be used more flexibly: - subcircuits consist of any object on any layer - these objects can be text, and can be on a silk layer - a text object can have the DYNTEXT flag, in which case the code does %% substitution on the text; e.g. if the text string contains %a.parent.refdes%, the part between the %% is substituted with the refdes attribute ("a.") of the parent subcircuit ("parent."). In short: it's replaced with the subcircuit's refdes - there's no limitation on the number of text objects having DYNTEXT flags - you can have one displaying the refdes on silk, another on copper - there's no limitation on what attribute is displayed; refdes, value and footprint name are not special any more, they are just attributes. You can introduce your own attributes, and you can get them printed in text - with these, you can have a resistor footprint that prints both the refdes and the value on silk, side by side - if any object of a subcircuit has the FLOATER flag, it can be moved within the subcircuit (and can be edited without breaking up the subcircuit); the "lock names" and "only names" became "lock floaters" and "only floaters". How to emulate the old behavior with the new features ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To get a subc refdes that behaves the same as an element refdes text, except that it's only a refdes text and not a 3-fold "magic text": - on a silk layer create a text object that will be part of the subc - set the text string to %a.parent.refdes% so that it will always display the subcircuit refdes - edit flags to turn on DYNTEXT and FLOATER; the first lets pcb-rnd replace %% patterns, the second lets the user grab and move the text Note: when you convert buffer to subc and it doesn't have a refdes text, the code automatically adds one, so you don't need to do this manually for each new subcircuit you draw. Regards, Igor2