I have a set of libraries from Altium CERN Library, I faced with varieties problems while I'm using this tool by you. I tried to change the code and test, but ending with failure.
I‘m not a LUA developer, but I tried to solve them. What I tried for the corresponding problems are:
a. No solutions.
b. Not very good try, but converted library can be used.
local function parseArc(block, fonts, comp)
local x = ad2kicad_CoordValue(block['LOCATION.X'])
local y = ad2kicad_CoordValue(block['LOCATION.Y'])
local r = ad2kicad_CoordValue(block.RADIUS)
local startAngle = block.STARTANGLE or 0
local sweepAngle = block.ENDANGLE or 0
sweepAngle = sweepAngle - startAngle
print("startAngle=",startAngle," sweepAngle=",sweepAngle, " r=",r)
local width = getWidth(block.LINEWIDTH)
-- Start of additions.
if (r <60 ) and ( r>25) and ((tonumber(startAngle) == 270) or (tonumber(startAngle) == 90))then
r = r - 25
startAngle = -180+startAngle
else if( r <= 25) then
startAngle = -180+startAngle
end
end
-- Ending of additions.
local v = toKicadArc(x,y,r,startAngle, sweepAngle, width,"symbol")
v.part = block.OWNERPARTID or 0
local f = block.ISSOLID and block.ISSOLID == 'T'
v.fill = f and 'f' or 'N'
v.bbox = BBOX.create(r*2,r*2)
v.bbox = BBOX.moveTo(v.bbox, x, y)
comp.graphs[#comp.graphs+1] = v
end
c. Solved the problem.
local function parseText(block,fonts,comp)
local t = block.NAME or 'user'
local value = get_str(block, "TEXT")
local x = ad2kicad_CoordValue(block['LOCATION.X'])
local y = ad2kicad_CoordValue(block['LOCATION.Y'])
local rotate = block['ORIENTATION'] or 0
local hide = false
local just = tonumber(block.JUSTIFICATION) or 0
if block.ISHIDDEN and block.ISHIDDEN=='T' then
hide = true
end
rotate = tonumber(rotate) * 90
local font = buildFont(block.FONTID, fonts)
local hJust = ad2kicad_textJustify[just] and ad2kicad_textJustify[just][2] or 'C'
local vJust = ad2kicad_textJustify[just] and ad2kicad_textJustify[just][1] or 'C'
if t == 'Designator' then
value = string.sub(value,1,-2)
-- Start of additions.
value=string.gsub(value," ", "_")
-- Ending of additions.
comp.ref = value == "" and 'U' or value
end
d.To ensure conversion successfully, nil related components can be skipped.
if blocks == nil then
r.toSymbol = nil
return
end