i2dx Posted October 28, 2004 Report Share Posted October 28, 2004 Hi, has anyone ever tried to create a polymorphic VI with VI-Scripting ? or does anyone know a way to do this ? thx, CB Quote Link to comment
David Boyd Posted November 4, 2004 Report Share Posted November 4, 2004 Hi,has anyone ever tried to create a polymorphic VI with VI-Scripting ? or does anyone know a way to do this ? thx, CB 2510[/snapback] Hmmm, curiouser and curiouser... (LV7.1) Calling the 'New VI ' primitive with the 'vi type' input set to 'Polymorphic VI' (so far, this seems like what we want to do, right?) generates an error and no valid VI ref. Not ready for prime time. OK, let's try this: Create a new polyVI (using the conventional approach). Save it with a .vit extension. NOW call the 'New VI' primitive, specifying the path to the .vit file as the 'template' input, but specify the 'vi type' as a standard VI. When I run this, I get a history dialog asking me to add a comment (I have this option turned on in my prefs, YMMV). The save operation is on a VI named: <long-random-digits>.tmp When done, I have a valid VI reference. If I do FP.Open on this ref, I have an 'Untitled' polyVI that says it's never been saved (no path to disk). That's all for now... more testing needs to be done. Like, where is there a scripting method to add a VI to a polyVI's list of instances...? I think this is a dead end for the moment. Best regards, Dave Quote Link to comment
i2dx Posted December 4, 2004 Author Report Share Posted December 4, 2004 Hmmm, curiouser and curiouser...[...] I think this is a dead end for the moment. Best regards, Dave 2559[/snapback] sad but true ...i did not find a solution, too but, that was not really a problem, because building a poly-VI with 800 instances would have not been a really good idea ;-) i found a way to solve the problem on a more "low level" way. by the way: waiting 4 LV8 will last longer than usually. the beta version is expected in august 2005 best regards cb Quote Link to comment
Jens Posted June 25, 2005 Report Share Posted June 25, 2005 I never found the need to use poly VI's, even though my professional version allows for creating them. I _always_ use Variants as control for those VI's and add as many "Variant to Data" VI's as needed with the different constants wired to them. The one that does not return an error, got the right data. Never failed for me :-) Quote Link to comment
i2dx Posted June 25, 2005 Author Report Share Posted June 25, 2005 sorry, but this doesn't sound like a good idea to me. if you just stick with variants, you better become a visual basic programmer. there are many positive aspects with strict typing and so on :headbang: Quote Link to comment
PJM_labview Posted June 25, 2005 Report Share Posted June 25, 2005 Hi,has anyone ever tried to create a polymorphic VI with VI-Scripting ? or does anyone know a way to do this ? thx, CB 2510[/snapback] Hi all I forgot about that thread, but since it resurfaced I realized I made such a tool. The Attached tool will allow you to get 90% there. At the end, you just have to add the polymorphic instances to the polymorphic VI. Enjoy PJM Note: I forgot to mentioned, attached file is in LV7.1 Download File:post-121-1119739386.llb Quote Link to comment
i2dx Posted June 26, 2005 Author Report Share Posted June 26, 2005 thanks a lot, but i was searching for the missing 10% ;-) i was as far as you, but what i wanted was to put the VIs in the polymorphic instance with vi scripting. best regards, CB Quote Link to comment
LAVA 1.0 Content Posted June 9, 2006 Report Share Posted June 9, 2006 I found a way to create polymorphic VIs. Works only in LabVIEW 8, but the code can be created with LV 7.1. -jimi- LV scripting programmer since Wednesday this week Quote Link to comment
Mike Ashe Posted June 9, 2006 Report Share Posted June 9, 2006 Nice little technique. Thanks for posting this. Too bad we have to keep doing the 7.1 <-> 8.x switching. Hmm, gives me some ideas of things to test ... Quote Link to comment
LAVA 1.0 Content Posted June 12, 2006 Report Share Posted June 12, 2006 Hmm, gives me some ideas of things to test ... Would you like to share those ideas with us ? Quote Link to comment
LAVA 1.0 Content Posted July 1, 2006 Report Share Posted July 1, 2006 There is also a way to find out which VIs the polymorphic VI consits of. See the picture below. Quote Link to comment
JDave Posted August 29, 2006 Report Share Posted August 29, 2006 I found a way to create polymorphic VIs. Works only in LabVIEW 8, but the code can be created with LV 7.1. -jimi- LV scripting programmer since Wednesday this week Combining this with PJM's method of creating a new Polymorphic VI in 7.1 (clever, clever :thumbup: ) one can create polymorphic VI's programmatically even in 7.1, even with the Full Development System. I kept PJM's original code, adding the following: Attaching generated instances to the new polymorphic VI If selected control is an array, the element data is replaced (not the entire array) David Saunders Download File:post-1519-1156806400.llb Quote Link to comment
LAVA 1.0 Content Posted September 13, 2006 Report Share Posted September 13, 2006 I kept PJM's original code, adding the following: Attaching generated instances to the new polymorphic VI If selected control is an array, the element data is replaced (not the entire array) Download File:post-1519-1156806400.llb Nice work :worship: Polymorphism over array dimensions (from scalars to N-dimensional arrays) combined with different data types is still on my wish list. As an example: DBL scalar, SGL scalar, Bool scalar DBL 1d, SGL 1d, Bool 1d DBL 2d, SGL 2d, Bool 2d ... DBL Nd, SGL Nd, Bool Nd If I ever have extra time, I'll modify to code or write a tool to include polymorphism over both type and dimension. Tip: Today I needed to create polymorphic dynamic LVOOP methods. This requires to create first a number of dynamic methods (one for each polymorphic type), then create for each dynamic method a static method that calls the dynamic method. In the end the static methods can be added to polymorphic VI. When the polymorphic VI is called, it first calls static VI of correct type, which then calls dynamic VI of the same type which is dynamically dispatched to the correct decendent class. Complicated but it works... Quote Link to comment
Bobillier Posted November 5, 2006 Report Share Posted November 5, 2006 Please is it possible to obtein a 7.0 version of your LLB ? Are you sure that run ok with FDS ? regards Eric Quote Link to comment
JDave Posted November 5, 2006 Report Share Posted November 5, 2006 Please is it possible to obtein a 7.0 version of your LLB ? Are you sure that run ok with FDS ?regards Eric I don't have 7.0 so I couldn't test this 7.0 version, but I was able to open it with 7.1 successfully. Try it out. David Download File:post-1519-1162706506.llb Quote Link to comment
Bobillier Posted November 5, 2006 Report Share Posted November 5, 2006 Thanks for your help :thumbup: , but that's don't run. :headbang: At start it's ok, but when i push "generate" there is an error message,who tell me that " Can't open the ref of vi in creatPolymorphism Instances(stingSM)___.... (reason: this VI is in more new version than your labview version" And when i look at working folder, i see a VI(POLY).Vi creat, but in 7.1 format. I look at code and I think it's in the Empty Polymorphic VI.vi template who is write for 7.1 Do you know if it's possible ,and how, modify this template to be compatible with 7.0 ? Regards Eric Quote Link to comment
Chris Davis Posted November 6, 2006 Report Share Posted November 6, 2006 You have to create a blank polymorphic VI in LV 7, read it in as a string and replace the string constant on the diagram that represents the empty LV 7.1 Polymorphic VI. After you do this, the LV 7.0 version of the code will work. Check out my new CR Example with its lv7.0 version Quote Link to comment
Bobillier Posted November 6, 2006 Report Share Posted November 6, 2006 Yes, but like i don't have PDS (just FDS) i can't creat this template. It's be very cool if somebody can do it for me. Regards Eric Quote Link to comment
Chris Davis Posted November 6, 2006 Report Share Posted November 6, 2006 Yes, but like i don't have PDS (just FDS) i can't creat this template. It's be very cool if somebody can do it for me. Regards Eric Check out the new CR Example (link above). It has an empty polymorphic VI as part of the zip file. Quote Link to comment
Bobillier Posted November 8, 2006 Report Share Posted November 8, 2006 Many thanks at all (chrisdavis,PJM,Dsaunders,....) for there work. I have modify the creat_Poly_instances_7_0.llb for running ok (see my precedent post) and send you a copy. Regards Eric :thumbup: Download File:post-5178-1162975495.llb Quote Link to comment
Bobillier Posted November 8, 2006 Report Share Posted November 8, 2006 Hi again In fact there is always a bug. Now Ican create a Polymorphic Vi , i can place it on new Vi, Place Wire on it. But if i right click on it, labview stop and close immediately, without any error message (big crash). I send you a copie of my polymorphic Vi to see if you have same problem. I have test that on 2 PC and see same things. Regards Eric :headbang: Download File:post-5178-1162980110.zip Quote Link to comment
tnt Posted November 8, 2006 Report Share Posted November 8, 2006 Now I can create a Polymorphic Vi , i can place it on new Vi, Place Wire on it. But if i right click on it, labview stop and close immediately, without any error message (big crash). :headbang: Hi,I've tested your "Essai multi1 (Poly).vi" in LV 7.1.1f2 FDS and didn't have a problem with it (right-click to select the instance was also OK), so maybe it's because you are using LV 7.0 ?? One strange thing in your "Essai multi1 (Poly).vi" is that you've included "Essai multi2 (Boolean).vi", I've had to browse for it when opening the toplevel polymorph vi. Good luck with creating polymorphic vi's in LV FDS (instead of PDS) ... TNT Quote Link to comment
Bobillier Posted November 9, 2006 Report Share Posted November 9, 2006 Hi all In fact Create_Poly_Instances_7_0.llb run good in 7.0. The problem i have find in precedent post don't came of this llb. Regards Eric Quote Link to comment
LAVA 1.0 Content Posted January 20, 2009 Report Share Posted January 20, 2009 Does anyone know how to set the Menu and selector information on a new or existing polymorphic VI? Ton 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.