On Monday 20 February 2006 03:25, DJ Delorie wrote: > Ok, what's the standard for inverted pins in symbols? How do I (or > do I) put the bar over the text? Specifically, I'm adding the > pinlabel attribute to a pin on a symbol, and having it displayed > inside the big box that's the "component", and adding the inversion > bubble. But I'd like to have the bar over the name, either also or > instead, like: > > 40 | ___ > -----()| BHE I like it that way, too. To put the bar over the text you have to sum up the width of the used characters. In tragesym there's a lookup table for that task char --> charwidth. > Net names should have the bar over them too, once I get to that > point. > > Also, is there some standard for: > > 1. Where pin numbers get placed Outside, 100 mils away (enough space for negation bubbles) right alignment for left pins, left aligment for right pins > 2. Where pin labels get placed Inside, 50 mils away from the box, left bottom alignment for left pins, right bottom alignment for right pins, center bottom for bottom pins and center top for top pins. > 3. Spacing and text angle for pins on the top/bottom of box-symbols If there are only a few pins on the top, or bottom rotation is IHMO not nesseccary. e.g. ATmega163_DIP.sym For symbols with lots of pins it's useful to rotate labels and attributes: e.g. MSP430x13-4x.sym Please take a look at the invisible attributes too. > I've written a program to extract/insert attributes into .SYM files > (gattrib seems to want whole schematics, not symbols), using open > office's spreadsheet to sort/edit/fill. The script knows where to > put "new" attributes (you can add a column and it inserts them, plus > it knows about the standard attributes), assuming I've guessed OK > about where to put them. It seems there are a lot of symbol generators out there ;-) The tragesym script is part of the utility package. Most of the features are listed here: http://www.h-renrew.de/h/tragesym/tragesym.html For the braves I've attached the script that I use for fixing symbols. Don't use it unless you know what you're doing. The batchfile b is for the workflow only. regards Werner
#!/usr/bin/python import string,re,sys ################# constants #################################################### #LIBRARY_PATH="/mnt/hda5/store/src/gedacvs2/geda/devel/symbols/" CENTER=600 ################ functions ##################################################### def makenice(filename): f=open(filename) file=f.readlines() pintype=['in','out','io','oc','oe','pas','tp','tri','clk','pwr'] pins=[] attr={} graphical_text=[] errors=[] version="" nr =len(file) i = 0 while i < nr: if file[i][0] == 'v': print "v 20020825" i = i + 1 elif file[i][0] == 'T': if len(string.split(file[i+1],"=")) == 2: if re.match('^refdes=',file[i+1]): t=string.split(string.strip(file[i])," ") print string.join(t[0:3]," ") + ' 8 10 1 1 ' \ + string.join(t[7:9]) attr["refdes"]=1 else: t=string.split(string.strip(file[i])," ") print string.join(t[0:3]," ") + ' 5 10 0 0 ' \ + string.join(t[7:9]) attr[string.split(file[i+1],"=")[0]]=1 print string.strip(file[i+1]) else: graphical_text.append(string.strip(file[i])) graphical_text.append(string.strip(file[i+1])) i=i+2 continue elif file[i][0] == "P": pin=["","","","",""] ## Pin[pin,pinnumber,pinseq,pinlabel,pintype] pin[0]=string.strip(file[i]) print pin[0] i = i + 1 if string.strip(file[i][0]) != "{": print "FEHLER: PIN OHNE ATTRIBUTE" escape=1 else: escape=0 i = i + 1 print '{' x,y,pos = getpinpos(pin[0]) while string.strip(file[i][0]) != '}' and escape == 0: if re.match("^pinnumber=",file[i+1]) \ and file[i][0] == 'T': t=string.split(string.strip(file[i])," ") if pos == "left": pin[1] = 'T %i' %(x+200) + ' %i' %(y+50) + ' 5 8 1 1 0 6' elif pos == "right": pin[1] = 'T %i' %(x-200) + ' %i' %(y+50) + ' 5 8 1 1 0 0' elif pos == "top": pin[1] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 1 1 0 0' if ROTATE == 1: pin[1] = 'T %i' %(x-50) + ' %i' %(y-200) + ' 5 8 1 1 90 0' elif pos == "bottom": pin[1] = 'T %i' %(x+50) + ' %i' %(y+100) + ' 5 8 1 1 0 0' if ROTATE == 1: pin[1] = 'T %i' %(x-50) + ' %i' %(y+200) + ' 5 8 1 1 90 6' print pin[1] print string.strip(file[i+1]) elif re.match("^pinseq=",file[i+1]) \ and file[i][0] == 'T': t=string.split(string.strip(file[i])," ") if pos == "left": pin[2] = 'T %i' %(x+200) + ' %i' %(y-50) + ' 5 8 0 1 0 8' elif pos == "right": pin[2] = 'T %i' %(x-200) + ' %i' %(y-50) + ' 5 8 0 1 0 2' elif pos == "top": pin[2] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 0 1 0 2' if ROTATE == 1: pin[2] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 0 1 90 2' elif pos == "bottom": pin[2] = 'T %i' %(x+50) + ' %i' %(y+100) + ' 5 8 0 1 0 2' if ROTATE == 1: pin[2] = 'T %i' %(x+50) + ' %i' %(y+200) + ' 5 8 0 1 90 8' print pin[2] print string.strip(file[i+1]) elif re.match("^pinlabel=",file[i+1]) \ and file[i][0] == 'T': t=string.split(string.strip(file[i])," ") if pos == "left": pin[3] = 'T %i' %(x+350) + ' %i' %y + ' 9 8 1 1 0 0' elif pos == "right": pin[3] = 'T %i' %(x-350) + ' %i' %y + ' 9 8 1 1 0 6' elif pos == "top": pin[3] = 'T %i' %x + ' %i' %(y-350) + ' 9 8 1 1 0 5' if ROTATE == 1: pin[3] = 'T %i' %x + ' %i' %(y-350) + ' 9 8 1 1 90 6' elif pos == "bottom": pin[3] = 'T %i' %x + ' %i' %(y+350) + ' 9 8 1 1 0 3' if ROTATE == 1: pin[3] = 'T %i' %x + ' %i' %(y+350) + ' 9 8 1 1 90 0' print pin[3] print string.strip(file[i+1]) elif (re.match("^pintype=",file[i+1]) \ or re.match("^type=",file[i+1])) \ and file[i][0] == 'T': t=string.split(string.strip(file[i])," ") if pos == "left": pin[4] = 'T %i' %(x+350) + ' %i' %y + ' 5 8 0 1 0 2' elif pos == "right": pin[4] = 'T %i' %(x-350) + ' %i' %y + ' 5 8 0 1 0 8' elif pos == "top": pin[4] = 'T %i' %x + ' %i' %(y-500) + ' 5 8 0 1 0 5' if ROTATE == 1: pin[4] = 'T %i' %x + ' %i' %(y-350) + ' 5 8 0 1 90 8' elif pos == "bottom": pin[4] = 'T %i' %x + ' %i' %(y+500) + ' 5 8 0 1 0 3' if ROTATE == 1: pin[4] = 'T %i' %x + ' %i' %(y+350) + ' 5 8 0 1 90 2' print pin[4] print string.strip(file[i+1]) else: print "FEHLER IN DER PINSEKTION" i = i + 2 if pin[1] == "": if pos == "left": pin[1] = 'T %i' %(x+200) + ' %i' %(y+50) + ' 5 8 1 1 0 6' elif pos == "right": pin[1] = 'T %i' %(x-200) + ' %i' %(y+50) + ' 5 8 1 1 0 0' elif pos == "top": pin[1] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 1 1 0 0' if ROTATE == 1: pin[1] = 'T %i' %(x-50) + ' %i' %(y-200) + ' 5 8 1 1 90 0' elif pos == "bottom": pin[1] = 'T %i' %(x+50) + ' %i' %(y+100) + ' 5 8 1 1 0 0' if ROTATE == 1: pin[1] = 'T %i' %(x-50) + ' %i' %(y+200) + ' 5 8 1 1 90 6' print pin[1] print "pinnumber=X" if pin[2] == "": if pos == "left": pin[2] = 'T %i' %(x+200) + ' %i' %(y-50) + ' 5 8 0 1 0 8' elif pos == "right": pin[2] = 'T %i' %(x-200) + ' %i' %(y-50) + ' 5 8 0 1 0 2' elif pos == "top": pin[2] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 0 1 0 2' if ROTATE == 1: pin[2] = 'T %i' %(x+50) + ' %i' %(y-200) + ' 5 8 0 1 90 2' elif pos == "bottom": pin[2] = 'T %i' %(x+50) + ' %i' %(y+100) + ' 5 8 0 1 0 2' if ROTATE == 1: pin[2] = 'T %i' %(x+50) + ' %i' %(y+200) + ' 5 8 0 1 90 8' print pin[2] print "pinseq=X" if pin[3] == "": if pos == "left": pin[3] = 'T %i' %(x+350) + ' %i' %y + ' 9 8 1 1 0 0' elif pos == "right": pin[3] = 'T %i' %(x-350) + ' %i' %y + ' 9 8 1 1 0 6' elif pos == "top": pin[3] = 'T %i' %x + ' %i' %(y-350) + ' 9 8 1 1 0 5' if ROTATE == 1: pin[3] = 'T %i' %x + ' %i' %(y-350) + ' 9 8 1 1 90 6' elif pos == "bottom": pin[3] = 'T %i' %x + ' %i' %(y+350) + ' 9 8 1 1 0 3' if ROTATE == 1: pin[3] = 'T %i' %x + ' %i' %(y+350) + ' 9 8 1 1 90 0' print pin[3] print "pinlabel=X" if pin[4] == "": if pos == "left": pin[4] = 'T %i' %(x+350) + ' %i' %y + ' 5 8 0 1 0 2' elif pos == "right": pin[4] = 'T %i' %(x-350) + ' %i' %y + ' 5 8 0 1 0 8' elif pos == "top": pin[4] = 'T %i' %x + ' %i' %(y-500) + ' 5 8 0 1 0 5' if ROTATE == 1: pin[4] = 'T %i' %x + ' %i' %(y-350) + ' 5 8 0 1 90 8' elif pos == "bottom": pin[4] = 'T %i' %x + ' %i' %(y+500) + ' 5 8 0 1 0 3' if ROTATE == 1: pin[4] = 'T %i' %x + ' %i' %(y+350) + ' 5 8 0 1 90 2' print pin[4] print "pintype=X" if string.strip(file[i][0]) == "}": i = i + 1 print "}" elif file[i][0] in "ABLV": print string.strip(file[i]) i = i+ 1 else: print "FEHLER IN DER EINGANGSDATEI" i = i + 1 if not attr.has_key("footprint"): print "T 4000 650 5 10 0 0 0 0" print "footprint=X" if not attr.has_key("description"): print "T 4000 850 5 10 0 0 0 0" print "description=X" if not attr.has_key("numslots"): print "T 4000 450 5 10 0 0 0 0" print "numslots=0" if not attr.has_key("symversion"): print "T 4000 250 5 10 0 0 0 0" print "symversion=X" if not attr.has_key("net"): print "T 4000 1050 5 10 0 0 0 0" print "net=X" print "T 4000 1250 5 10 0 0 0 0" print "net=X" if not attr.has_key("documentation"): print "T 4000 1450 5 10 0 0 0 0" print "documentation=" for line in graphical_text: ## print all graphical text at the end of file print line def getpinpos(pinstring): p=string.split(pinstring) x1=string.atoi(p[1]) x2=string.atoi(p[3]) y1=string.atoi(p[2]) y2=string.atoi(p[4]) y = y1 x = x1 if x1 == x2: ## top or bottom pin if (y1 + y2) < CENTER*2: ## bottom pin pos = "bottom" if y1 > y2: y = y2 else: ## top pin pos = "top" if y1 < y2: y = y2 else: ## left or right pin if (x1 + x2) < CENTER*2: ## left pin pos ="left" if x1 > x2: x = x2 else: ## right pin pos = "right" if x1 < x2: x = x2 return x, y, pos ########################## MAIN ################################################ try: file_in=sys.argv[1] except: print "nice_sym:" print "Bad arguments, usage is: ", sys.argv[0] ,"infile [ROTATE]" sys.exit() try: rot=sys.argv[2] if rot == "ROTATE": ROTATE=1 else: ROTATE=0 except: ROTATE=0 makenice(file_in)
Attachment:
b
Description: application/shellscript