From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-20-2015 11:12 AM
Hi,
I have been looking for a way to connect wires to a "build array" node through VI Scripting.
I have an array of inputs which have to translate into an array via "build array" node. I successfully added input terminals to "build array" node through VI Scripting. However, the program fails when I try to run a loop to wire all the inputs sequentially. The problem is, all of the input wires at the first element of "build array". Snapshot of code is attached.
Please suggest me a way to connect different elements at different inputs of "build array" node.
Thank you.
Regards
HB
Solved! Go to Solution.
02-20-2015 11:41 AM
You should be iterating over the terminals of the Build Array node and calling the Connect Wire method of each terminal.
02-20-2015 11:46 AM
Thanks for the reply. This is the same I am doing as shown in the snap shot. Please point out where I am missing something.
Regards
Hasan
02-20-2015 11:56 AM
You are calling Connect Wires on the node itself, not on the individual terminals. You need to use the Terminals[] property of the node to get the array of terminals (element 0 is the output terminal).
02-20-2015 12:15 PM
I am still unable to solve it. It is still connecting the terminals to the 1st element of "build array" node. Please see the edited code and point out the mistake in it.
Thanks
HB
02-20-2015 12:37 PM
You'd have to post the code, not the screenshot. Are you sure it is wiring to the first element? Wiring in scripting can be tricky, have you tried doing a BD cleanup on the scripted code? Often wires overlap or run in strange places.
02-20-2015 02:56 PM
I'd recommend looking at JKI's Right Click Framework. One of the plugins it has that I've used in the past is Build Array of References. At the heart of it will be a subVI for building the array. It looks like it uses a method for the Terminal object called "Create Described Wire".
Digging into that could give you the main part of the code that you need for what you are trying to do.
02-21-2015 03:39 AM
Hi Darin,
Sorry for the inconvenience. I posted screen shot because it is a long VI including many other sub VIs in it. Anyways, I have made the new VI containing only that piece of code where I am having problem.
This VI generates another VI (in stack sequence 0) and creates two numeric control knobs in the new VI (in stack sequence 1). I then want to build an array of these control knobs (in stack sequence 2). I am unable to wire them in different terminals of "build array" node. The 0th stack sequence (nested inside the outer 2nd stack) adds the appropriate number of terminals in "build array" node. The 1st stack sequence (nested inside the outer 2nd stack) is the one where I am doing unknown mistake.
Thanks for your due help.
Regards
HB
02-21-2015 03:44 AM
Hi Raven,
Thanks for your reply.
I have already been through it and following his logic , but still unable to achieve my desired goal. It must be very small logical mistake which I am committing. Please see the attached file in the above comment Problem_HB.vi
Thanks
Regards
Hasan
02-21-2015 10:21 AM
Running LV12 at the moment, faster to write a quick example than to open LV14 and look at your VI.