Hello Hans,
I have similar sniplet/script which makes new instance of component. If you will find it useful...
Regards
Jan Priban, Autodesk
//Author-JP
//Description-tocite schody
function run(context) {
"use strict";
if (adsk.debug === true) {
/*jslint debug: true*/
debugger;
/*jslint debug: false*/
}
var ui;
try {
var app = adsk.core.Application.get();
ui = app.userInterface;
var product = app.activeProduct;
var design = adsk.fusion.Design(product);
if (!design) {
ui.messageBox('No active Fusion design', 'No Design');
return;
}
// Get the root component of the active design.
var rootComp = design.rootComponent;
var occs = rootComp.allOccurrences;
// Gather information about each unique component
var count = occs.count;
ui.messageBox(count.toString(), 'count');
//var comp = occs.item(0).component;
//var jmeno = comp.name
//ui.messageBox(jmeno,'name');
// Create a new occurrence.
var trans = adsk.core.Matrix3D.create();
// Create a new occurrence for the component, offset by 15 cm in the X direction.
trans.setCell(0, 3, 15.0);
var newOcc = rootComp.occurrences.addExistingComponent(occs.item(0).component, trans);
//ui.messageBox('Hello script');
}
catch (e) {
if (ui) {
ui.messageBox('Failed : ' + (e.description ? e.description : e));
}
}
adsk.terminate();
}