0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

KiCADフットプリントをPythonで格子状に並べる

Posted at

やること

KiCAD pcbnew で32列×28行(896個)LEDのフットプリントをPythonを使用して一瞬で並べる方法を紹介します

image.png

ソースコード

import pcbnew
bd = pcbnew.GetBoard()
OrgX=50800000      #原点座標X 50.8mm
OrgY=25400000      #原点座標Y 25.4mm
OffsetX=10160000   #横方向のオフセット距離 10.16mm(2.54mmの4個分)
OffsetY=7620000    #縦方向のオフセット距離 6.62mm(2.54mmの3個分)
pX=OrgX            #X座標変数、初期値は原点を入れておきます
pY=OrgY            #X座標変数、初期値は原点を入れておきます
REF=1              #部品番号の数値部分、初期値は1
for X in range(32):
    pY = OrgY
    for Y in range(28):
        LED = bd.FindFootprintByReference("D" + str(REF))
        LED.SetPosition(pcbnew.wxPoint(pX,pY))
        pY=pY + OffsetY
        REF = REF +1
    pX=pX+OffsetX
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?