Jump to content

Recommended Posts

Hi all,


In order to teach myself to use LVOOP -it's about time to start- I've decided to start with a little project that I've had in mind for a long time, I've called it LVOOP VIServer, I hope it doesn't sound too pretentious.


The idea is to make a hierarchy of LVOOP classes that matches the LabVIEW Controls class hierachy in order to take advantage of dynamic dispatch.

In a way it is related to this LIE Idea : Improve the "cluster to array" primitive


For now I've implemented the parent class "Control" and two child classes "Path Control" and "String Control" and a bunch of VIs to read/write position, size, caption text, caption font and font.




If anyone is interested in reviewing the code, providing advice or whatever... I've kept it small enough so that if the core concept is not good it can still be changed.


The code is hosted on GitHub here, it should be accessible to anyone, let me know if there is any issue of if you would like a zip in this thread.



Edited by Antoine Châlons
  • Like 2
Link to post

After a quick look, here are a couple of comments:

  1. I'm not sure whether or not this is a worthwhile project (particularly for learning LVOOP), but it can probably come in handy if you want to generate controls inside picture controls.
  2. LV 2010 should allow you to create property folders for accessor VIs, which will allow you to call the VIs using property nodes (easier for the user, and means the need for an icon is considerably lower). I don't remember if in 2010 you can do this automatically from the accessor creation dialog or whether you have to do it manually, but it can probably be automated through VI Server.
  3. I don't think you need to write the reference twice in the init VI. Just write it into the Control class and then have the specific class' read VI downcast the reference to the correct class.
  4. You could probably gather the init VIs into a polyVI which will allow the user to create a new "reference" simply by wiring the reference to that VI (although you should check how that behaves first, both with regular references and with strict and unknown references).

Link to post

And a couple more things I didn't notice earlier:

  1. Your init VIs are in the control class, which is a no-no. The control class should not be required to know about its child classes. Instead, have a separate init VI for each class inside that class (you will still need to give it a full name to avoid having LV think it's a DD VI). You can collect these into the PolyVI I mentioned earlier.
  2. The Control class then has a set ctl ref VI, which is the VI these init VIs call to put the ref into the object data. If you want to protect it, you can make it protected scope, which should still allow the children to call it.
  3. You might wish to follow the VI Server hierarchy exactly. The Ring class actually inherits from Control>>Numeric>>Named Numeric.
  4. Likewise, implementing the actual classes yourself would mean you didn't have to rely on the LV UI, but that is really a lot of work and is probably not worth it.

And regarding that last part, I only now really looked at what you're doing, and I'm not sure I understand the point. Sure, this could work for the idea in the IE, but is there anything else it's good for? In many ways, the VI server API already works like DD VIs do, so there shouldn't be a need to wrap it.

  • Like 1
Link to post

Thanks a lot for taking the time to have a look and comment.


I have no illusions about how usefull this code can be, as I said I wanted something simple to start teaching myself that's why your comments are very appriciated.

I wont have much time this week to work on this subject but I'll definitely go back to my code with your comments in mind and probably come back here with questions.



Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Ryan Vallieu
      I have seemingly found an issue with the shipping example code for Nested Malleable VIs.  Another user has verified that he saw the same behavior in 2019.
      I am working through the examples and the presentation from NIWeek 2019.  In running the Lesson 2b code (C:\Program Files (x86)\National Instruments\LabVIEW 2019\examples\Malleable VIs\Nested Malleable VIs) I found the Equals.vi in the class was not being leveraged and the search failed.  When I went to my LabVIEW 2018 machine and ran the Lesson 2b.vi the code worked to find the element by correctly leveraging the in-class Equals.vi.
      One difference I see is that in the 2018 example the Equal.vi is in the example folder with the code, and in 2019 the Equal.vi has been moved to VI.lib - otherwise the code looks to be the same.  The Equals.vi code looks identical, and the calling VIM look identical.  I posted on the LabVIEW NI.com forum here: 
      I am trying to determine what may have broken or changed between the implementation in 2018 and 2019, visually the code looks the same.
    • By Voklaif
      Hello all,
      I am programming with LabVIEW for around 2 years and was recently stumbled upon LVOOP.
      I am required to write a communication protocol to work with a micro-controller, which later will be also used for ATP and debug purposes.
      I want to build the program "correctly" from the beginning so it will be maintainable and flexible to additions and changes.
      My natural way of building a program would have been a queued state machine, with several loops, each loop is in charge of a different module (one for GUI obviously), but as I stated in the beginning, I want to use LVOOP.
      Does anyone have a LVOOP project I can use as reference? I've searched online and found some nice examples, but they are small and teach you the basic stuff.
      For me it's important to see the how to use the project tree wisely, where to place the classes, see the managing loop and to learn as much as possible before I create one of my own.
      Thanks in advance,
    • By GregFreeman
      I have an array of classes, let's call the object TestPass, of size 1 (but it is an array because it can scale out to multiple test passes). In this class, there is one other nested class which is not too complex, then various numeric and string fields to hold some private data. There is also an array of clusters. In this cluster there is a string, two XY pair clusters, and an integer. Not very confusing.
      This array of clusters gets fairly large, however, upwards of 80-100k elements. What I am finding is when I index the array of pass classes it is crazy slow. On the order of 30 ms. Doesn't seem like much, but we are indexing the array in our method to "Get Current Pass" which is used in various places throughout our code. This is adding potentially hours to our test time over the 80k devices we are testing. 
      So, I started digging. When I flatten the class to a string and get the length, it's 3 mb. But, when I run the function with the profiler is is allocating close to 20 mb of memory!
      My gut feel was that the string is causing the issues. So I removed the string from the cluster and the index time went to 0 ms. 
      Luckily we can normalize a bit and pull the strings out of the cluster since a lot of them are duplicates. But it makes our data model a bit uglier. 
      Has anyone seen these kind of performance issues before? I saw them in 2013 and 2017.
    • By ted Francis
      I am new to LVOOP and have jsut started writing my first LVOOP program which I have attached.
      I would appreciate greatly help with the question I have
      Thank you in advance 
      This vi will perform two tasks 
      1.Generating Report data sheet for metrology 
      2. updating the scales in a MAX .nce file
      1. Metrology will input calibration information into the tables on the tabs
      Metrology will then click "Update Tables" then "Create Report ( create report section of code is not yet written
      Update Tables will write all information entered in the tabs to class varaibles and will also delete current Max informatiomn
      2. Metrology will click "Load NCE Scale"
      vi will prompt for nce file to load and then once file is selected, display existing scales for two channels (Current Motor 1 and 
      Current Motor 2)
      Metrology will then click "Update Scales"  the program will replace the existing scales with those entered in Step 5.14 and 5.15
      from the tables on the tab
      Question 1.  Steps 5.14 and 5.15 are needed by both classes ( Table Variable and MAX) - what is the best way to share this information
      CAT0000032 Class Version.zip
    • By shoneill
      I was browing through the actor framework discussions on the NI site yesterday and I came across a statement by AQ.
      Never inherit a concrete class from another concrete class
      I had to think about that for a second.  The more I think about it, the more I realise that all of the LVOOP software I have been writing more or less adheres to this idea.  But I had never seen it stated so succinctly before.  Now that may just be down to me being a bit slow and all, but in the muddy and murky world of "correct" in OOP-land, this seems to be a pretty good rult to hold on to.
      Are there others which can help wannabe plebs like me grasp the correct notions a bit better?  How about only ever calling concrete methods from within the owning class, never from without?  I'm learning for a long time now, but somehow, my expectations of LVOOP and the reality always seem a little disconnected.  AQs statement above helped crystallise out some things which, up to that point, had been a bit nebulous in my mind.  Well, I say I'm learning..... I'm certainly using my brain to investigate the subject, whether or not I'm actually LEARNING is a matter for discussion... The older I get, the less sure I am that I've actually properly grasped something.  The old grey cells just seem to get more sceptical with time.  Maybe that in itself is learning...
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.