Hi --
  
> My first crack at building a .sym file for a 2N5551 transistor looks 
> like this.  I know there's some pintype definitions left empty, I'm 
> still working on that.
> 
> v 20050820 1
> L 300 900 600 700 3 0 0 0 -1 -1
> L 600 400 600 800 3 0 0 0 -1 -1
> L 470 410 500 370 3 0 0 0 -1 -1
> L 440 450 470 410 3 0 0 0 -1 -1
> L 440 450 421 381 3 0 0 0 -1 -1
> L 500 370 421 381 3 0 0 0 -1 -1
> L 600 500 469 412 3 0 0 0 -1 -1
> L 421 381 300 300 3 0 0 0 -1 -1
> P 300 1200 300 900 1 0 0
> {
> T 400 1000 5 10 0 1 0 0 1
> pinseq=1
> T 400 1000 5 10 0 1 0 0 1
> pinnumber=1
> T 400 1200 5 10 0 1 0 0 1
> pinlabel=B
> T 400 1400 5 10 0 1 0 0 1
> pintype=
> }
> P 800 600 600 600 1 0 0
> {
> T 700 700 5 10 0 1 0 0 1
> pinseq=2
> T 700 700 5 10 0 1 0 0 1
> pinnumber=2
> T 900 700 5 10 0 1 0 0 1
> pinlabel=A
> T 900 900 5 10 0 1 0 0 1
> pintype=
> }
> P 300 0 300 300 1 0 0
> {
> T 400 100 5 10 0 1 0 0 1
> pinseq=3
> T 400 100 5 10 0 1 0 0 1
> pinnumber=3
> T 0 0 5 10 0 1 0 0 1
> pinlabel=C
> T -700 200 5 10 0 1 0 0 1
> pintype=
> }
> T 700 0 8 10 0 1 0 0 1
> footprint=TO92
> T 700 200 8 10 1 1 0 0 1
> device=2N5551
> T 700 400 8 10 0 1 0 0 1
> description=Small signal transistor
> T 0 600 8 10 1 1 0 0 1
> refdes=Q?
> 
> Note at the bottom that there's text attributes for footprint, device, 
> description, and refdes.  Also note that field 6 of the 'T' line for 
> footprint and description is set to 0 (invisible), while its set to 1 
> (visible) for device and refdes.
> 
> If I open gschem up and inset this symbol into a blank file, and then 
> save and open that .sch file in a text editor, it looks like this:
> 
> v 20050820 1
> C 72300 52600 1 0 0 2N5551-1.sym
> {
> T 73000 52800 5 10 1 1 0 0 1
> device=2N5551
> T 72300 53200 5 10 1 1 0 0 1
> refdes=Q?
> }
> 
> Note that the device and refdes attributes where preserved, but the 
> description and footprint attributes have been 'cleaned off'.  I can 
> make an attribute survive or fail this importing process by simply 
> flagging it as visible or invisible in the .sym file.  Also, opening up 
> the device's properties inside gschem only shows the device and refdes 
> attributes.

OK, I think I know what is going on here.  

Gschem is architected to read almost all info about a symbol from the
.sym file.  Only things which change from schematic to schematic, or
are needed by gnetlist were promoted to the .sch file.  The rest
stayed buried in the .sym file.

Originally, only a couple of attribs were promoted from the .sym file
to teh .sch file.  I know that refdes was promoted because you had to
overwrite the ? with the corrfect refdes.   Also, teh "device"
attribute was promoted to the .sch file because the netlister uses
it.  However, with one or two other exceptions, only this small set of
attribs were promoted to the .sch file.

Then, various users suggested promoting *all* attributes in teh .sym
file into the .sch file.  I believe that Carlos, Ales, Patrick, or one
of the  heavy-duty gschem/libgeda hackers did that.  However, it looks
like they implemented it so that only visible attributes were
promoted.

Part of the reason to keep symbols light is to force the user to put
all mutable attributes into the schematic.  Gattrib is supposed to
make this easy.  Yes, lots of newbie programs give you *all*
attributes in the symbol, but for the power user it's not such a good
thing, because you can get bit in the a** when an attribute lives in a
symbol which you didn't expect, or don't want.  For example, we don't
put "footprint" attributes in the .sym file because not everybody uses
the open-source PCB program.  I have netlisted to Protel in the past,
and it uses different footprint names.

Perhaps Carlos, Ales, Patrick, et al made the visibility parameter the
way to control attribute promotion?  We do want same way to keep
some attributes from being promoted selectably.  Maybe there is a
different way?  Or am I wrong?  I'll let the power hackers answer
this.

> What I wanted to do was define attributes in the .sym file that I did 
> not necessarily want to be visible on the schematic, but that were still 
> preserved and associated with the symbol so that it could be passed on 
> to PCB.  For instance, I wanted 'footprint' to be invisible but still 
> there so that PCB could use that information.

The current gEDA philosophy is to put all that stuff into the
schematic, not the .sym files.  Use gattrib to attach it.  It makes it
quite easy.  Using gattrib you can  also toggle attribute visibility,
and even do it on a per-column (e.g. all footprints are invisible)
basis. 

> It appears that gschem decides to keep any attribute that is marked as 
> visible, and throws away any attributes that are marked as invisible in 
> the .sym file.  Is this how it was intended to work?
> 
> I can appreciate that the prevailing wisdom is that the library should 
> be 'light', but that shouldn't prevent me from building a custom 'heavy' 
> library of symbols if I want, should it?  This behavior of gschem means 
> I either can leave attributes out of my .sym file and add them to my 
> symbols after I've inserted them into the schematic, or I can leave the 
> attributes visible in my .sym file and then manually make them invisible 
> after I've inserted them into the schematic.  Either way, I have to open 
> the properties of every symbol I import, which is what I was trying to 
> avoid in the first place.

I appreciate your points.  Let's hear from Ales et al.  Meanwhile, try
out gattrib -- it eliminates the problem you fear: needing to click on
each component in gschem an laborously enter each attribute.

Stuart

Reply via email to