MeshItems
MeshItems
Section titled “MeshItems”app.activeDocument.meshItems
Description
Section titled “Description”A collection of MeshItem objects.
Properties
Section titled “Properties”MeshItems.length
Section titled “MeshItems.length”app.activeDocument.meshItems.length
Description
Section titled “Description”The number of objects in the collection.
Number; read-only.
MeshItems.parent
Section titled “MeshItems.parent”app.activeDocument.meshItems.parent
Description
Section titled “Description”The parent of this object.
Object; read-only.
MeshItems.typename
Section titled “MeshItems.typename”app.activeDocument.meshItems.typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Methods
Section titled “Methods”MeshItems.getByName()
Section titled “MeshItems.getByName()”app.activeDocument.meshItems.getByName(name)
Description
Section titled “Description”Gets the first element in the collection with the specified name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | Name of element to get |
Returns
Section titled “Returns”MeshItems.index()
Section titled “MeshItems.index()”app.activeDocument.meshItems.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | String or number key |
Returns
Section titled “Returns”MeshItems.removeAll()
Section titled “MeshItems.removeAll()”app.activeDocument.meshItems.removeAll()
Description
Section titled “Description”Deletes all elements in this collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Copying mesh items to another document
Section titled “Copying mesh items to another document”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 documentif (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; }}