취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Connecting wires to build array through VI Scripting

해결 완료!
솔루션으로 이동

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 

 

 

0 포인트
1/13 메시지
5,586 조회수

You should be iterating over the terminals of the Build Array node and calling the Connect Wire method of each terminal.

0 포인트
2/13 메시지
5,578 조회수

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

0 포인트
3/13 메시지
5,574 조회수

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).

0 포인트
4/13 메시지
5,569 조회수

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

0 포인트
5/13 메시지
5,564 조회수

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.

0 포인트
6/13 메시지
5,551 조회수

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.

 

 

0 포인트
7/13 메시지
5,523 조회수

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

0 포인트
8/13 메시지
5,497 조회수

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

0 포인트
9/13 메시지
5,496 조회수
솔루션
주제 작성자 HB.이(가) 승인함

Running LV12 at the moment, faster to write a quick example than to open LV14 and look at your VI.

 

WireBuildArray.png

10/13 메시지
5,466 조회수