jcarmody Posted January 13, 2010 Report Share Posted January 13, 2010 I've written a VI to insert the Add State(s) to Queue SubVI and wire it into the States string of a JKI State Machine. My problem is that I can't figure out how to calculate the position relative to the owner of the wire, so I've hard coded an offset. It works well enough, but I don't like it. Could you look at what I've done and see if you can help me position the SubVI properly? If I could only find the position of the wires owner I think I could finish this. To test this: download the BD Minion, run it, go to a VI with a string wire, select the string wire then press the "Add States to Queue" button. Jim BDMinion.vi Quote Link to comment
Francois Normandin Posted January 13, 2010 Report Share Posted January 13, 2010 If I could only find the position of the wires owner I think I could finish this. You already have everything you need. The average position between terminals is certainly not what you want, but you can get the terminals' position easily from your wire property node. Quote Link to comment
jcarmody Posted January 14, 2010 Author Report Share Posted January 14, 2010 You already have everything you need. The average position between terminals is certainly not what you want, but you can get the terminals' position easily from your wire property node. Almost, but it doesn't give me the position of the terminals relative to the wire's owner. This is what I worked out after I found that the Case Structure is the Terminal's owner's owner. 1 Quote Link to comment
Black Pearl Posted January 14, 2010 Report Share Posted January 14, 2010 You could use the move method, it has an input 'owner' and uses the coordinate of that owner if it's wired (so use case structure as the owner). Felix Quote Link to comment
Francois Normandin Posted January 14, 2010 Report Share Posted January 14, 2010 ... is the Terminal's owner's owner. I had never seen double " 's " used before... Quote Link to comment
vugie Posted January 14, 2010 Report Share Posted January 14, 2010 I do nor understand exactly what do you search for, but this is what I know: - wire's owner is always a diagram (so this is why wire's owner's owner is case structure) - diagram is also positioned against its owner - I don't know exactly what wire's position means but I didn't find it useful - exact wiring point is TerminalPosition + (TerminalSize modulo 2) Quote Link to comment
jcarmody Posted January 14, 2010 Author Report Share Posted January 14, 2010 I've made this into a JKI RCF plugin to simplify (my) life when writing a VI with a JKI State Machine. I don't often duplicate cases to make a new one, and I use Linked Tunnels so my tunnels are all wired, but I have to put the Add State(s) to Queue.vi into the new case manually. I've resorted to leaving it outside the State Machine (initializing the Shift Register) so I have one handy to ctrl-click/copy/drag. I suspect that's why JKI put it there in the first place. It only takes a few seconds but I've wanted a RCF plugin for a long time. (This was one of the first RCF ideas I had.) You install this like you would any other RCF plugin. To use it, select the State String wire, activate the RCF and select "Insert AS2Q" and it'll insert the SubVI eight pixels from the output tunnel (just where my OCD likes it ). Two questions: 1) How can I test the data type of the wire? I don't want to activate this plugin unless a String wire is selected. 2) Am I the only one that thinks this will be useful? Thanks, Jim Insert_AS2Q.llb Quote Link to comment
jcarmody Posted January 15, 2010 Author Report Share Posted January 15, 2010 It doesn't behave well if I use it in the Idle state (inside the Event Structure), even after I change the To More Specific Class. Back to the drawing board. Quote Link to comment
vugie Posted January 15, 2010 Report Share Posted January 15, 2010 How can I test the data type of the wire? I don't want to activate this plugin unless a String wire is selected. The wire datatype is always a datatype of its source terminal, which is always first element of Terminals[] property of the wire. And Terminal has Data Type property (variant) and Type Descriptor property (which is not exposed in scripting, so you have to use Scripting Workbench or PMS Assistant to get it). What concerns not centered wire - I can't open your code (please save in 8.2) but I belive that you should use Create Described Wire method providing as wire description start and end points which should be center terminal points (see my previous post). Remember that coordinates should be provided in reversed form (y,x). Check out how I do it in my Weird Wires plugin. 1 Quote Link to comment
jcarmody Posted January 15, 2010 Author Report Share Posted January 15, 2010 The wire datatype is always a datatype of its source terminal, which is always first element of Terminals[] property of the wire. And Terminal has Data Type property (variant) and Type Descriptor property (which is not exposed in scripting, so you have to use Scripting Workbench or PMS Assistant to get it). What concerns not centered wire - I can't open your code (please save in 8.2) but I belive that you should use Create Described Wire method providing as wire description start and end points which should be center terminal points (see my previous post). Remember that coordinates should be provided in reversed form (y,x). Check out how I do it in my Weird Wires plugin. The Data Type property seems to hold the data, not the type. The Data Type of the States wire contains the Variant "". I've managed to get the data type, having found a reference that said it is found in the low byte of the first element in the Type Descriptor array. This turns out to be 26 in most cases, but not all, so I still need help. Here's an 8.2 version. Insert_AS2Q.llb Quote Link to comment
vugie Posted January 15, 2010 Report Share Posted January 15, 2010 The Data Type property seems to hold the data, not the type. The Data Type of the States wire contains the Variant "". I've managed to get the data type, having found a reference that said it is found in the low byte of the first element in the Type Descriptor array. This turns out to be 26 in most cases, but not all, so I still need help. Here is version which properly (I hope) tests the data type. I used Compare Data Type (private) method of Application. There is also Compare Type method which compares type descriptors. I also added automatic calculation of proper offset to center the wire (for y coordinate). You could also think of calculating x coordinate from cursor position. Insert_AS2Q_vug.llb 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.