You need to use EasyEDA editor to create some projects before publishing
Programmatically Place a Footprint and Generating PCB files
345 2
hkrewq 1 year ago
I would like to repeatly place a footprint to specific coordinate with codes. Refers to the document, [https://docs.easyeda.com/en/DocumentFormat/3-EasyEDA-PCB-File-Format/index.html#Footprint](https://docs.easyeda.com/en/DocumentFormat/3-EasyEDA-PCB-File-Format/index.html#Footprint)<br> <br> Footprint have these parametes, **configure** ```LIB~245~240~package`CK17-B`~0~~gge15~1``` 1. command: LIB 2. position x: 245 3. position y: 240 However, if I modified the position, it only changes the footprint origin, but the drawn shapes remains the same. Here is an example footprint I would like to put it **repeatly in specific x, y coordinates and rotation angle**. This is a keyboard's key's footprint. ``` "LIB~0~-4.77~package`~0~~gge1095~1~~~0~~none~~#@$TEXT~N~0~-47.5~0.7~0~0~3~~4.5~PG1353~M 4.5475e-13 -52.04 L 4.5475e-13 -47.75 M 4.5475e-13 -52.04 L 1.84 -52.04 L 2.45 -51.84 L 2.66 -51.63 L 2.86 -51.22 L 2.86 -50.61 L 2.66 -50.2 L 2.45 -50 L 1.84 -49.79 L 4.5475e-13 -49.79 M 7.28 -51.02 L 7.08 -51.43 L 6.67 -51.84 L 6.26 -52.04 L 5.44 -52.04 L 5.03 -51.84 L 4.62 -51.43 L 4.42 -51.02 L 4.21 -50.4 L 4.21 -49.38 L 4.42 -48.77 L 4.62 -48.36 L 5.03 -47.95 L 5.44 -47.75 L 6.26 -47.75 L 6.67 -47.95 L 7.08 -48.36 L 7.28 -48.77 L 7.28 -49.38 M 6.26 -49.38 L 7.28 -49.38 M 8.63 -51.22 L 9.04 -51.43 L 9.65 -52.04 L 9.65 -47.75 M 11.41 -52.04 L 13.66 -52.04 L 12.44 -50.4 L 13.05 -50.4 L 13.46 -50.2 L 13.66 -50 L 13.87 -49.38 L 13.87 -48.97 L 13.66 -48.36 L 13.25 -47.95 L 12.64 -47.75 L 12.03 -47.75 L 11.41 -47.95 L 11.21 -48.15 L 11 -48.56 M 17.67 -52.04 L 15.63 -52.04 L 15.42 -50.2 L 15.63 -50.4 L 16.24 -50.61 L 16.85 -50.61 L 17.47 -50.4 L 17.88 -50 L 18.08 -49.38 L 18.08 -48.97 L 17.88 -48.36 L 17.47 -47.95 L 16.85 -47.75 L 16.24 -47.75 L 15.63 -47.95 L 15.42 -48.15 L 15.22 -48.56 M 19.84 -52.04 L 22.09 -52.04 L 20.86 -50.4 L 21.48 -50.4 L 21.89 -50.2 L 22.09 -50 L 22.3 -49.38 L 22.3 -48.97 L 22.09 -48.36 L 21.68 -47.95 L 21.07 -47.75 L 20.45 -47.75 L 19.84 -47.95 L 19.64 -48.15 L 19.43 -48.56~none~gge1119~~0~#@$HOLE~0~0~9.8425~gge916~0#@$TEXT~P~0~-42.5~0.7~0~0~3~~4.5~SW1~M 2.86 -46.43 L 2.45 -46.84 L 1.84 -47.04 L 1.02 -47.04 L 0.41 -46.84 L 0 -46.43 L 0 -46.02 L 0.2 -45.61 L 0.41 -45.4 L 0.82 -45.2 L 2.05 -44.79 L 2.45 -44.59 L 2.66 -44.38 L 2.86 -43.97 L 2.86 -43.36 L 2.45 -42.95 L 1.84 -42.75 L 1.02 -42.75 L 0.41 -42.95 L 0 -43.36 M 4.21 -47.04 L 5.24 -42.75 M 6.26 -47.04 L 5.24 -42.75 M 6.26 -47.04 L 7.28 -42.75 M 8.3 -47.04 L 7.28 -42.75 M 9.65 -46.22 L 10.06 -46.43 L 10.68 -47.04 L 10.68 -42.75~yes~gge1116~~0~#@$SOLIDREGION~11~~M 20.0233 -26.3657 L 19.7979 -26.377 L 19.5721 -26.377 L 19.3467 -26.3657 L 19.122 -26.3433 L 18.8988 -26.3096 L 18.6775 -26.2649 L 18.4587 -26.2092 L 18.243 -26.1426 L 18.0309 -26.0654 L 17.8229 -25.9777 L 17.6195 -25.8798 L 17.4212 -25.7718 L 17.2286 -25.6541 L 17.042 -25.5269 L 16.8621 -25.3906 L 16.6892 -25.2455 L 16.5237 -25.092 L 16.366 -24.9304 L 16.2167 -24.7611 L 16.0759 -24.5846 L 15.9441 -24.4013 L 15.8216 -24.2117 L 15.7088 -24.0161 L 15.6058 -23.8153 L 15.5129 -23.6095 L 15.4304 -23.3993 L 15.3585 -23.1853 L 15.2974 -22.968 L 15.2472 -22.7479 L 15.208 -22.5256 L 15.1799 -22.3016 L 15.163 -22.0765 L 15.1574 -21.8508 L 15.1574 -18.7012 L 15.163 -18.4755 L 15.1799 -18.2504 L 15.208 -18.0264 L 15.2472 -17.8041 L 15.2974 -17.584 L 15.3585 -17.3667 L 15.4304 -17.1527 L 15.5129 -16.9425 L 15.6058 -16.7367 L 15.7088 -16.5359 L 15.8216 -16.3403 L 15.9441 -16.1507 L 16.0759 -15.9674 L 16.2167 -15.7909 L 16.366 -15.6216 L 16.5237 -15.46 L 16.6892 -15.3065 L 16.8621 -15.1614 L 17.042 -15.0251 L 17.2286 -14.8979 L 17.4212 -14.7802 L 17.6195 -14.6722 L 17.8229 -14.5743 L 18.0309 -14.4866 L 18.243 -14.4094 L 18.4587 -14.3428 L 18.6775 -14.2871 L 18.8988 -14.2424 L 19.122 -14.2087 L 19.3467 -14.1863 L 19.5721 -14.175 L 19.7979 -14.175 L 20.0233 -14.1863 L 20.248 -14.2087 L 20.4712 -14.2424 L 20.6925 -14.2871 L 20.9113 -14.3428 L 21.127 -14.4094 L 21.3391 -14.4866 L 21.5471 -14.5743 L 21.7505 -14.6722 L 21.9488 -14.7802 L 22.1414 -14.8979 L 22.328 -15.0251 L 22.5079 -15.1614 L 22.6808 -15.3065 L 22.8463 -15.46 L 23.004 -15.6216 L 23.1533 -15.7909 L 23.2941 -15.9674 L 23.4259 -16.1507 L 23.5484 -16.3403 L 23.6612 -16.5359 L 23.7642 -16.7367 L 23.8571 -16.9425 L 23.9396 -17.1527 L 24.0115 -17.3667 L 24.0726 -17.584 L 24.1228 -17.8041 L 24.162 -18.0264 L 24.1901 -18.2504 L 24.207 -18.4755 L 24.2126 -18.7012 L 24.2126 -21.8508 L 24.207 -22.0765 L 24.1901 -22.3016 L 24.162 -22.5256 L 24.1228 -22.7479 L 24.0726 -22.968 L 24.0115 -23.1853 L 23.9396 -23.3993 L 23.8571 -23.6095 L 23.7642 -23.8153 L 23.6612 -24.0161 L 23.5484 -24.2117 L 23.4259 -24.4013 L 23.2941 -24.5846 L 23.1533 -24.7611 L 23.004 -24.9304 L 22.8463 -25.092 L 22.6808 -25.2455 L 22.5079 -25.3906 L 22.328 -25.5269 L 22.1414 -25.6541 L 21.9488 -25.7718 L 21.7505 -25.8798 L 21.5471 -25.9777 L 21.3391 -26.0654 L 21.127 -26.1426 L 20.9113 -26.2092 L 20.6925 -26.2649 L 20.4712 -26.3096 L 20.248 -26.3433 Z~npth~gge913~~~~0#@$HOLE~-19.685~14.961~2.3622~gge901~0#@$HOLE~0~23.228~2.3622~gge889~0#@$PAD~ELLIPSE~-19.685~14.961~7.874~7.874~1~~1~0~~0~gge850~0~~Y~0~0~0.4016~-19.685,14.961#@$PAD~ELLIPSE~0~23.228~7.874~7.874~1~~2~0~~0~gge835~0~~Y~0~0~0.4016~0,23.2283#@$TRACK~1~3~~-37.5 -27.5 -37.5 -37.5 -27.5 -37.5~gge1094~0#@$TRACK~1~3~~-27.1775 -17.1726 -27.1775 -27.1726 -17.1775 -27.1726~gge1091~0#@$TRACK~1~3~~27.5 -37.5 37.5 -37.5 37.5 -27.5~gge1088~0#@$TRACK~1~3~~17.1602 -27.1599 27.1602 -27.1599 27.1602 -17.1599~gge1085~0#@$TRACK~1~3~~27.1851 17.1482 27.1851 27.1482 17.1851 27.1482~gge1082~0#@$TRACK~1~3~~37.5 27.5 37.5 37.5 27.5 37.5~gge1079~0#@$TRACK~1~3~~-27.5 37.5 -37.5 37.5 -37.5 27.5~gge1076~0#@$TRACK~1~3~~-27.1746 17.1614 -27.1746 27.1614 -17.1746 27.1614~gge1073~0" ```
Comments
andyfierman 1 year ago
I can't help you with scripting this but you may find that the "Distribute Array" tool does what you want anyway: [https://docs.easyeda.com/en/Introduction/Basic-Skill/index.html#Align](https://docs.easyeda.com/en/Introduction/Basic-Skill/index.html#Align)
Reply
pommie 1 year ago
A long time ago I did this for a project using javascript (macro). Here's some of the code which placed items, [code]     var x = posXY\[j\]\[0\]\*100/25\.4;     var y = posXY\[j\]\[1\]\*100/25\.4;     var ang = posXY\[j\]\[2\];     var id = LEDs\[LEDnumber\]\[1\];     api('moveObjsTo', {objs:[{gId:id}], x:circleCX+x,y:circleCY-y});     shape=api('getShape',{id:id});     var cur=parseInt(shape.head.rotation);     if(isNaN(cur)){         cur=0;     }     ang=-(ang-cur);     api('rotate', {ids:[id],degree:ang}); [/code] I can't post more as it was proprietry and I can't post the whole thing. Good luck, Note, one thing I realised was the rotation is relative to the previous rotation (hence ang=-(ang-cur);) - there may be a set absolute rotation but I couldn't find it. And, don't bother asking here as "No reply" is the normal answer.
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,建议访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus-@1x -mockplus-

Cookie Notice

Our website uses essential cookies to help us ensure that it is working as expected, and uses optional analytics cookies to offer you a better browsing experience. To find out more, read our Cookie Notice