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?
Chrome
75.0.3770.100
Windows
10
EasyEDA
6.1.52