Hey Todd,
Glad to see this is working. However, I noticed a few things that may want to adjust.
Firstly, api.getConfigurator
returns a Promise which means you must wait for the promise to resolve before accessing the result (the configurator API in this case).
You can do so easily by making your function an async
and await
the result.
(async function () {
var c = await api.getConfigurator();
Secondly, it appears setting the translation is the only thing that requires a script. You may be able to simplify things by creating a rule with no conditions (i.e. one that always fires) with actions that set the count.
Then you can simplify your script to something like this…
(async function () {
const c = await api.getConfigurator();
const { Spacing } = c.getConfiguration();
const node = api.scene.findNode({ name: "Box" });
api.scene.set(
{ id: node, plug: "PolyMesh", property: "translation" },
{ x: 0, y: 0, z: Spacing }
);
})();