Bugfixes in custom pattern and connector symbol generators

This commit is contained in:
Shamil Yakupov
2016-04-26 19:08:45 +03:00
parent 360feb718e
commit 272fc90d69
4 changed files with 19 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "qeda",
"version": "0.0.47",
"version": "0.0.48",
"description": "QEDA — a tool for creating libraries of electronic components",
"main": "lib/qeda.js",
"bin": {

View File

@@ -45,13 +45,16 @@ copperPads = (pattern, element, suffix = '') ->
else if housing['rowCount' + suffix]? and housing['columnCount' + suffix]?
hasPads = true
rowCount = housing['rowCount' + suffix]
rowPitch = housing['rowPitch' + suffix] ? housing['pitch' + suffix]
rowDXs = element.parseMultiple housing['rowDX' + suffix]
rowDYs = element.parseMultiple housing['rowDY' + suffix]
columnCounts = element.parseMultiple housing['columnCount' + suffix]
if rowCount is 1
rowPitch = 0
else
rowPitch = housing['rowPitch' + suffix] ? housing['pitch' + suffix]
rowDXs = pattern.parseArray housing['rowDX' + suffix]
rowDYs = pattern.parseArray housing['rowDY' + suffix]
columnCounts = pattern.parseArray housing['columnCount' + suffix]
columnPitch = housing['columnPitch' + suffix] ? housing['pitch' + suffix]
columnDXs = element.parseMultiple housing['columnDX' + suffix]
columnDYs = element.parseMultiple housing['columnDY' + suffix]
columnDXs = pattern.parseArray housing['columnDX' + suffix]
columnDYs = pattern.parseArray housing['columnDY' + suffix]
y = -rowPitch*(rowCount - 1)/2
for row in [0..(rowCount - 1)]
columnCount = columnCounts[row] ? columnCounts[0]

View File

@@ -110,6 +110,14 @@ class QedaPattern
@pads[name] = @_addPad pad
this
#
# Parse array of floats
#
parseArray: (input) ->
unless input? then return [0]
result = input.toString().replace(/\s+/g, '').split(',').map((v) => parseFloat(v))
result
#
# Parse position point(s)
#

View File

@@ -20,7 +20,7 @@ module.exports = (symbol, element) ->
schematic.showPinNumbers ?= true
schematic.pinIcon = pinIcon
unless symbol.left.length and symbol.right.length # Automatic
if (not symbol.left.length) and (not symbol.right.length) # Automatic
numbers = Object.keys element.pins
if schematic.single
numbers.map (v) -> symbol.right.push v