Hello
Using this function
async function exportRendition(myParentFolder, selection) {
let scenegraph = require("scenegraph");
const application = require("application");
const rectangles = scenegraph.root.children.filter(node => node instanceof scenegraph.Rectangle);
const groups = scenegraph.root.children.filter(node => node instanceof scenegraph.Group);
if (rectangles.length > 0) {
var children = rectangles;
if (groups.length > 0)
children = rectangles.concat(groups);
}
console.log(children);
try {
const arr = children.map(async item => {
if (item instanceof Rectangle) {
//selection.items = [item];
console.log(`${item.name}.png`);
const file = await myParentFolder.createFile(`${item.name}.png`);
let obj = {};
obj.node = item //selection.items[0]
obj.outputFile = file;
obj.type = "png";
obj.scale = 1;
return obj
}
})
console.log(arr.length);
const renditions = await Promise.all(arr);
await application.createRenditions(renditions);
} catch (err) {
console.log(err);
}
}
gives me the error :
[Error: Expected ânodeâ field with a SceneNode value]
This error is happening when it tries to export the first Group item!
Can anyone help?