本文整理匯總了Python中upconvert.writer.kicad.KiCAD.get_pin_line方法的典型用法代碼示例。如果您正苦於以下問題:Python KiCAD.get_pin_line方法的具體用法?Python KiCAD.get_pin_line怎麽用?Python KiCAD.get_pin_line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類upconvert.writer.kicad.KiCAD
的用法示例。
在下文中一共展示了KiCAD.get_pin_line方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_pin_line
# 需要導入模塊: from upconvert.writer.kicad import KiCAD [as 別名]
# 或者: from upconvert.writer.kicad.KiCAD import get_pin_line [as 別名]
def test_get_pin_line(self):
"""
The get_pin_line returns the correct string for a kicad pin.
"""
writer = KiCAD()
pin = Pin('1', (-300, 100), (-600, 100))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 1 -6667 1111 300 R 60 60 %(unit)d %(convert)d B\n')
pin = Pin('1', (300, 100), (600, 100))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 1 6667 1111 300 L 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, -1300), (0, -1500))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 2 0 -16667 200 U 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, 1300), (0, 1500))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 2 0 16667 200 D 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, 1300), (0, 1500),
Label(0, 0, 'name', 'center', 0))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X name 2 0 16667 200 D 60 60 %(unit)d %(convert)d B\n')
示例2: test_get_pin_line
# 需要導入模塊: from upconvert.writer.kicad import KiCAD [as 別名]
# 或者: from upconvert.writer.kicad.KiCAD import get_pin_line [as 別名]
def test_get_pin_line(self):
"""
The get_pin_line returns the correct string for a kicad pin.
"""
writer = KiCAD()
pin = Pin('1', (-300, 100), (-600, 100))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 1 '
+ str(int(-600 / MULT)) + ' '
+ str(int(100 / MULT)) + ' '
+ str(int(300 / MULT)) + ' '
+ 'R 60 60 %(unit)d %(convert)d B\n')
pin = Pin('1', (300, 100), (600, 100))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 1 '
+ str(int(600 / MULT)) + ' '
+ str(int(100 / MULT)) + ' '
+ str(int(300 / MULT)) + ' '
+ 'L 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, -1300), (0, -1500))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 2 0 '
+ str(int(-1500 / MULT)) + ' '
+ str(int(200 / MULT)) + ' U 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, 1300), (0, 1500))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X ~ 2 0 '
+ str(int(1500 / MULT)) + ' '
+ str(int(200 / MULT)) + ' D 60 60 %(unit)d %(convert)d B\n')
pin = Pin('2', (0, 1300), (0, 1500),
Label(0, 0, 'name', align='center', rotation=0))
line = writer.get_pin_line(pin)
self.assertEqual(
line, 'X name 2 0 '
+ str(int(1500 / MULT)) + ' '
+ str(int(200 / MULT)) + ' D 60 60 %(unit)d %(convert)d B\n')