You need to use EasyEDA editor to create some projects before publishing
Script API 'moveObjsTo' exception
638 2
Pat Signup 5 years ago
I am writing a script to automatically place my footprints into a symmetrical grid, and all should be working except my api call is failing. ``` var COLUMNS = 3, ROWS = 3, FIRST_X = api('unitConvert', {type: 'mm2pixel', value: 4}), FIRST_Y = api('unitConvert', {type: 'mm2pixel', value: 4}), SPACING = api('unitConvert', {type: 'mm2pixel', value: 7}); var json = api('getSource', {type: 'json'}), column = 0, row = 0; json.itemOrder.forEach(function(gid) { if (json.FOOTPRINT.hasOwnProperty(gid)) { api('moveObjsTo', { objs: [{gId: gid}], x: (json.BBox.x + FIRST_X + SPACING * column), y: (json.BBox.y + FIRST_Y + SPACING * row) } ); column++; if (column == COLUMNS) { column = 0; row++; } } }); ``` I have retrieved the message and stacktrace for the exception caught by the try/catch statement wrapped around by the extension system. ``` message: "Cannot read property 'notCopper' of undefined" stack: "TypeError: Cannot read property 'notCopper' of undefined at Wr (https://easyeda.com/editor/6.1.52/js/editorPCB.min.js:4:11942) at zr (https://easyeda.com/editor/6.1.52/js/editorPCB.min.js:4:12842) at moveTo (https://easyeda.com/editor/6.1.52/js/editorPCB.min.js:28:25916) at a (https://easyeda.com/editor/6.1.52/js/editorPCB.min.js:2:134) at Yn (https://easyeda.com/editor/6.1.52/js/main.min.js:8:11763) at moveObjsTo (https://easyeda.com/editor/6.1.52/js/main.min.js:16:4233) at https://easyeda.com/editor/6.1.52/js/main.min.js:15:13051 at eval (eval at (https://easyeda.com/editor/6.1.52/js/main.min.js:15:12910), :17:9) at Array.forEach () at __userjs_20218__ (eval at (https://easyeda.com/editor/6.1.52/js/main.min.js:15:12910), :13:16)" ``` Whats going on? What is the solution to this?
Comments
Rodrigo Schramm 5 years ago
Hi. Any follow up for this? I am also trying to use "moveObjsTo" without success. Same error type: ``` "TypeError: Cannot read property 'notCopper' of undefined ```
Reply
Hi, I am also experiencing this issue.
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