Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # File intented to demo some functions available in the Symbol Generator module.
- # Another example is the connecor generator
- # sys.path.append(os.path.join(sys.path[0],..))
- # load KiCadSymbolGenerator path
- # add KiCadSymbolGenerator to searchpath using export PYTHONPATH="${PYTHONPATH}<absolute path>/autogen/"
- # or use relative module path. Example ..KiCadSymbolGenerator
- import csv
- from KiCadSymbolGenerator import *
- generator = SymbolGenerator('VPC')
- current_symbol = generator.addSymbol('PXI-2575')
- current_symbol.setReference('U', at={'x':0, 'y':150})
- current_symbol.setValue(at={'x':0, 'y':-150})
- i = 1.0
- lastUnit = 1
- with open('PXIe2575.csv', newline='') as csvfile:
- reader = csv.reader(csvfile, delimiter=',', quotechar="|")
- for row in reader:
- pinNum = int(row[1])
- pinName = row[2]
- pinUnit = int(row[3])
- if lastUnit != pinUnit:
- i = 1
- else:
- lastUnit = pinUnit
- i += 1
- yPos = -254*i
- current_symbol.drawing.append(DrawingPin(at=Point({'x':-254, 'y':yPos}, grid=100), number=pinNum,
- orientation=DrawingPin.PinOrientation.RIGHT,
- name=pinName, length=5.08, unit_idx=pinUnit, deMorgan_idx=pinUnit))
- rect = DrawingRectangle(start={'x':-100, 'y':100}, end={'x':100, 'y':-100})
- current_symbol.drawing.append(rect)
- #current_symbol.drawing.translate({'x':50, 'y':100})
- #testpoint = Point({})
- #testpoint2 = testpoint.translate(distance={'x':1,'y':1}, apply_on_copy=True) #apply on copy can be used to generate multiple equal parts.
- generator.writeFiles()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement