Git Product home page Git Product logo

pcad2kicad's Introduction

PCAD/AD库文件转换KiCad工具

Convert PCAD/AD library to Kicad

特点:

  1. Altium Designer的二进制原理图库转换成KiCad格式

  2. PCAD的ASCII原理图库转换成KiCad格式

  3. PCAD的ASCII封装图库转换成KiCad格式

Feature:

  1. Altium Designer binary schlib to KiCad symbol library

  2. PCAD ASCII symbol library to KiCad symbol library

  3. PCAD ASCII footprint library to KiCad footprint library

ad2kicad

require 7z and lua 5.3

Signle mode:

lua ad2kicad.lua <inName> [outName] [fpLib]

Batch mode:

lua ad2kicad.lua --batch <inPath> [outPath] [fpLib] [prefix] [O1=N1[ O2=N2...]]

pcad2kicad

require lua 5.3

Signle mode:

lua pcad2kicad.lua <inName> [outName] [outPath] [fpLib]

Batch mode:

lua pcad2kicad.lua --batch <inPath> [outPath] [fpLib] [prefix] [O1=N1[ O2=N2...]]

pcad2kicad's People

Contributors

xtoolbox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pcad2kicad's Issues

Conversion error: FileHeader: No such file or directory

I get:

$ lua53.exe ad2kicad.lua ../ag35.schlib ag35
Der Befehl "7z" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
../ag35/FileHeader: No such file or directory
C:\mybin\lua53.exe: .\ad_lib.lua:143: attempt to get length of a nil value (local 'blocks')
stack traceback:
        .\ad_lib.lua:143: in upvalue 'parse_Header'
        .\ad_lib.lua:922: in function 'parse_schlib'
        .\ad_lib.lua:945: in function 'convert_schlib'
        ad2kicad.lua:95: in main chunk
        [C]: in ?

PS. 7z is installed and found, so I have no idea what that complaint is about!

Unknown record type 10

Unknown record type 10 in D:\KiCAD_data\my_libraries\ad_schlib/IR120/7V16000001
CORNER.X=20
LINEWIDTH=1
OWNERPARTID=1
COLOR=136
CORNERXRADIUS=2
ISSOLID=T
AREACOLOR=11599871
LOCATION.Y=-20
CORNERYRADIUS=2
RECORD=10
LOCATION.X=-20
CORNER.Y=20
INDEXINSHEET=8
ISNOTACCESIBLE=T
Unknown record type 10 in D:\KiCAD_data\my_libraries\ad_schlib/IR120/CS0806S
CORNER.X=40
LINEWIDTH=1
OWNERPARTID=1
COLOR=136
CORNERXRADIUS=2
ISSOLID=T
AREACOLOR=11010047
LOCATION.Y=-30
CORNERYRADIUS=2
RECORD=10
LOCATION.X=-40
CORNER.Y=30
INDEXINSHEET=7
ISNOTACCESIBLE=T
Unknown record type 10 in D:\KiCAD_data\my_libraries\ad_schlib/IR120/7M20000011
CORNER.X=20
LINEWIDTH=1
OWNERPARTID=1
COLOR=136
CORNERXRADIUS=2
ISSOLID=T
AREACOLOR=11599871
LOCATION.Y=-20
CORNERYRADIUS=2
RECORD=10
LOCATION.X=-20
CORNER.Y=20
INDEXINSHEET=8
ISNOTACCESIBLE=T
Convert D:\KiCAD_data\my_libraries\ad_schlib/IR120.SchLib to D:\KiCAD_data\my_libraries/5k_IR120.lib done

转换的过程中有这些错误提示,转换完之后添加到工程,报错:
无法从库"5k_IR120"加载别名

No comp in file Core52840/FileHeader

$ lua53.exe ad2kicad.lua Core52840.PcbLib
No comp in file Core52840/FileHeader
lua53.exe: .\ad_lib.lua:924: attempt to get length of a nil value (local 'compList')
stack traceback:
.\ad_lib.lua:924: in function 'parse_schlib'
.\ad_lib.lua:945: in function 'convert_schlib'
ad2kicad.lua:95: in main chunk
[C]: in ?

padShapeType为 Polygon 类型的封装无法转换

(padStyleDef "EF256X138TOP1"
    (holeDiam 0mil)
    (startRange 1)
    (endRange 2)
    (padShape (layerNumRef 1) (padShapeType Polygon) (shapeOutline
        (pt 93.504mil 68.898mil)
        (pt 127.953mil 34.449mil)
        (pt 127.953mil -34.449mil)
        (pt 93.504mil -68.898mil)
        (pt -93.504mil -68.898mil)
        (pt -127.953mil -34.449mil)
        (pt -127.953mil 34.449mil)
        (pt -93.504mil 68.898mil)
      )
    )
    (padShape (layerNumRef 2) (padShapeType Ellipse) (shapeWidth 0.0) (shapeHeight 0.0) )
    (padShape (layerType Signal) (padShapeType Ellipse) (shapeWidth 0.0) (shapeHeight 0.0) )
    (padShape (layerType Plane) (padShapeType NoConnect) (shapeWidth 0.0) (shapeHeight 0.0) )
    (padShape (layerType NonSignal) (padShapeType Oval) (shapeWidth 0mil) (shapeHeight 0mil) )
  )

PcbLib2.zip

Examples and Instruction please

Hi!
Do you have any working examples and instructions how to use this?

We're trying to import some AD .pcbLib and .SCHLIB files into KiCad...

Complex library with lots of problems

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.

Here is some of the library components those can represent the problems.
https://github.com/CarlNobody/Temporary/blob/main/Schlib1.SchLib

Problems list:
a. Alternative part will exist with the normal part in the converted library.
b. Curved object has wrong radius or wrong direction.
c. Designators those have space will lead an error.
d. Sometimes the conversion will failed with the error nil from not existing directory of the altium schematic part.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.