Skip to content

MeshItems

app.activeDocument.meshItems

A collection of MeshItem objects.


app.activeDocument.meshItems.length

The number of objects in the collection.

Number; read-only.


app.activeDocument.meshItems.parent

The parent of this object.

Object; read-only.


app.activeDocument.meshItems.typename

The class name of the referenced object.

String; read-only.


app.activeDocument.meshItems.getByName(name)

Gets the first element in the collection with the specified name.

ParameterTypeDescription
nameStringName of element to get

MeshItem


app.activeDocument.meshItems.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

MeshItem


app.activeDocument.meshItems.removeAll()

Deletes all elements in this collection.

Nothing.


To run this script, have two open documents. One document should contain at least one mesh item, the other document can be empty. Make the empty document the frontmost before running the script.

// Copies all mesh items from one document to a new document
if (app.documents.length > 0) {
var srcDoc = documents[0];
var locationOffset = 0;
var targetDoc = documents.add();
for (var i = 0; i < srcDoc.meshItems.length; i++) {
var srcItem = srcDoc.meshItems[i];
var dupItem = srcDoc.meshItems[i].duplicate(targetDoc, ElementPlacement.PLACEATEND);
// offset the copied items' position on the y axis
dupItem.position = Array(100, 50 + locationOffset);
locationOffset += 50;
}
}