Trying to get the Root from the Scene nodes and respective children


What is the correct way to get the Scene node to make a foreach per node, starting with each artboard.

don’t understand why documentRoot.children does not work since I get the root node. Please help.


What do you required ?
Children of the artboard


Nop :), the entire list of ARTBOARDS and than I want to do a for each for every element inside the artboard.


Ok I will try and reply


ok i will getting list of artboards for now do you?
where you stopped?


As per my understanding you want get all art boards and dosomething
i just implemented for each artboard only so you can extend it furthur

this is my crazy implementation

function myPluginCommand(selection, documentRoot) {
	var rootnodes = selection.insertionParent.parent;
	var nodes = selection.items[0];
	rootnodes.children.forEach(element => {
		selection.items = [element];
		let rect = new Rectangle();
		rect.height = 100;
		rect.width = 100;
		rect.fill = new Color("grey");

Artbobard Name from Selection?

see the implementation


full fledged implementation is :

function myPluginCommand(selection, documentRoot) {
	var rootnodes = selection.insertionParent.parent;
	var nodes = selection.items[0];
	rootnodes.children.forEach(element => {
		//This is ArtBoard
		selection.items = [element];
		let rect = new Rectangle();
		rect.height = 10;
		rect.width = 10;
		rect.fill = new Color("red");

		var children = element.children;
		children.forEach(element => {
			//This is an Artboard child
			selection.items = [element];
			let height = element.globalDrawBounds.height;
			let width = element.globalDrawBounds.width;

			let x = element.globalDrawBounds.x;
			let y = element.globalDrawBounds.y;
			console.log("height : " + height + "width : " + width);
			console.log("x : " + x + "y : " + y);
			let rect = new Rectangle();
			rect.height = height / 10;
			rect.width = width / 10;
			rect.fill = new Color("red");
			let xParent = rect.parent.globalDrawBounds.x;
			let yParent = rect.parent.globalDrawBounds.y;
			console.log("rect parent : " + rect.parent);
			rect.moveInParentCoordinates(x - xParent, y - yParent);


@PramUkesh trying it


Your example only works if I choose 1 artboard correct?

I want to get ALL ARTBOARDS and ALL CHILDRENS. Getting all artboards is my problems.

So with 1 artboard selected it works perfectly.

but with now artboards selected:


Means you want pasteboard content ?


Let say I have 2 artboards and on each artboard I have 2 squares, in one a red one and in another a black one.

I want to get the colors of all squares in all artboards. I want to find all colors for used in a project.


where the code is failing


When I DON’T select any artboard.


wait a second i will try it


do you remember how you managed to add artboards in experience generator
i forgot those method
i was trying to get now once i got i will show that or
you can add some code snippet from plugin so that i can explain with ease

for (let a = 0; a < settingsScope.length; a++) {
    var expDevSetting = settingsScope[a];
    var artBoardHeight = expDevSetting.height;
    var artBoardWidth = expDevSetting.width;
    var artBoardName = expDevSetting.title;     
    var newArt = new Artboard(); = checkedDeviceValue.charAt(0).toUpperCase() + checkedDeviceValue.replace("_", "-").substr(1)  + ' ' +checkedExperienceValue.charAt(0).toUpperCase() + checkedExperienceValue.replace("_", "-").substr(1)  +  ' - ' +artBoardName;
    newArt.width = artBoardWidth;
    newArt.height = artBoardHeight;
    newArt.fillEnabled = true;
    newArt.fill = new Color("white");
    newArt.focusedArtboard = true;
    documentRoot.addChild(newArt, 0);

        newArt.moveInParentCoordinates(nextArtboardPosition, farthestH + artboardVertSpacing);
        nextArtboardPosition = nextArtboardPosition + newArt.width + artboardSpacing;
        nextArtboardPosition = nearestW + newArt.width + artboardSpacing;
        newArt.moveInParentCoordinates(nearestW, farthestH + artboardVertSpacing);


But I want to GET the scares not to design a new one.

I am trying to OBTAIN information and not GENERATE.

Obtain the colors of squares already created.


When I do a console.log(documentRoot) I get this:

RootNode {
  children: [Artboard, Artboard, Text]

But I cant reach .children or the Artboard and I don’t know why.


To do this:

we also need to have access to all text elements in all artboards.