修改 BOM 处理单元:
1. 使用 Reference 替代 Ref; 2. 使用 MaterialFootprint 替代 Footprint. Signed-off-by: rick.chan <cy187lion@sina.com>
This commit is contained in:
parent
5b9fb4dece
commit
011894b807
10
bom.go
10
bom.go
|
@ -37,7 +37,7 @@ func transBomFormat(commentId, designatorId, footprintId int, contents []string)
|
||||||
lines := strings.Split(line, "\",")
|
lines := strings.Split(line, "\",")
|
||||||
if commentId < len(lines) && designatorId < len(lines) && footprintId < len(lines) {
|
if commentId < len(lines) && designatorId < len(lines) && footprintId < len(lines) {
|
||||||
footprint := transBomFootprint(lines[footprintId])
|
footprint := transBomFootprint(lines[footprintId])
|
||||||
ostr += lines[commentId] + "\"," + lines[designatorId] + "\"," + footprint + "\"\n"
|
ostr += lines[commentId] + "\"," + lines[designatorId] + "\"," + footprint + "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ostr
|
return ostr
|
||||||
|
@ -54,16 +54,16 @@ func transBomFootprint(footprint string) string {
|
||||||
func findBomContents(content string) (commentId, designatorId, footprintId int, contents []string) {
|
func findBomContents(content string) (commentId, designatorId, footprintId int, contents []string) {
|
||||||
contents = strings.Split(content, "\n")
|
contents = strings.Split(content, "\n")
|
||||||
for i, line := range contents {
|
for i, line := range contents {
|
||||||
if (strings.Contains(line, "\"Ref\"")) &&
|
if (strings.Contains(line, "\"Reference\"")) &&
|
||||||
(strings.Contains(line, "\"Value\"")) &&
|
(strings.Contains(line, "\"Value\"")) &&
|
||||||
(strings.Contains(line, "\"Footprint\"")) {
|
(strings.Contains(line, "\"MaterialFootprint\"")) {
|
||||||
lines := strings.Split(line, ",")
|
lines := strings.Split(line, ",")
|
||||||
for j, item := range lines {
|
for j, item := range lines {
|
||||||
if item == "\"Ref\"" {
|
if item == "\"Reference\"" {
|
||||||
designatorId = j
|
designatorId = j
|
||||||
} else if item == "\"Value\"" {
|
} else if item == "\"Value\"" {
|
||||||
commentId = j
|
commentId = j
|
||||||
} else if item == "\"Footprint\"" {
|
} else if item == "\"MaterialFootprint\"" {
|
||||||
footprintId = j
|
footprintId = j
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue