Scripting Examples

Trying to get into the upverter scripting, is there a repository of examples? I found the scripting reference a bit jarring without some examples.

I’m working on better docs for scripting but in the meantime heres one I wrote today to list out all the DNP parts in a design.

print(‘Checking for DNP parts’);
print(’-------------------------’);
api.components.forEach(function(component) {
var dnp = component.attributes[’_dnp’] || ‘?’;
if (dnp == ‘yes’) {
print(component.refDes + ': ’ + component.manufacturer + ’ ’ + component.partNumber);
}
});

Thanks zak! That example is helpful to start.

In the meantime I suppose I’ll look over the scripting documentation more :slight_smile:

Can you share where you found this documentation?

https://upverter.com/apidocs/