Managing Structures

steve holmes's picture

Hi everyone I am working on a composition that controls a lot of LED light fixtures, I have made macros that control them I would love each one to output a structure and then merge/add the structures together so I don't have noddles everywhere. Is this possible as a plugin or a is it best to do it in javascript. Cheers Steve

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Managing Structures

I tend to think it's best in javascript, but you can always the kineme structure maker as well. So, if your macro creates RGBA, you can tie those inputs into a structure maker (keyed or indexed, depending on what you wish), and now you have a structure of "RGBA". Then, you take all of those structure outs and attach them to a javascript patch with a bunch of inputs, or a structure maker, so that all of your RGBA structures have different index or key values.

If it was a really large project, I would probably use the structure maker, because it's easy to add or subtract inputs on the fly. It seems like speed is equivalent in 10.6, but I think it used to be a little faster than javascript. It's certainly way easier to not have to type out a new port in a code panel every time you wish to configure a new input.

steve holmes's picture
Re: Managing Structures

Thanks I have been using named structure maker with start address and then maths patches to work out the subsequent address. The thing I am stuck on is using javascript to merge/add together multiple structures while retaining there indexing/names. Cheers Steve

jrs's picture
Re: Managing Structures

There is a structure joiner in the NI tools which I find pretty handy apart from the fact it doesn't preserve the structure orders (which I also tend to find handy at times so I'm not complaining too much)'s picture
Re: Managing Structures

Post your specifications and preferably a .qtz file showing the nested structure you want to create and I'l whip-up the JS code for you — it will be a cinch. Feel free to post your half complete but not working JS code and I'l get you home if you prefer.

One advantage of JS patch is if you are doing some data handling also, like calculations on data, you can do it all simply in the patch and the data can refer to other parts of the structure for the calculations without complicated noodling of queues structure breakdowns etc. Eg. Averaging or normalising all values of one expression/element in your data.

Pretty much anything can be done either way if your dedicated enough though, nod to gt!

Main problem for getting the hang of JS patch is just its little execution/parsing quirks. Conceptually it's can be as easy as BASIC, worth persevering 'till it all fall into place. When on the start of the learning curve those little querks can become extremely frustrating and insurmountable hurdles, I know :/