Jump to content

How to programmatically create LVClass method VI?


JKSH

Recommended Posts

Hi all,

 

I'm trying to programmatically create and modify LVClasses. So far, I've managed to do the following via LabVIEW scripting:

  • Create a new LVClass
  • Save the new LVClass to disk
  • Make one LVClass a subclass of another
  • Create property definition folders

 

My next step is to create class methods (static dispatch for now), but I'm stuck. I can't figure out how to add an LVClass control/indicator to a VI. I tried the following, but LabVIEW complained, "Type mismatch: Object cannot be cast to the specific type".

 

TTkTrDq.png

 

I can't find any other LVClass-related items in the list.

 

I tried to figure out what I should pass to New VI Object.vi, by querying an existing static dispatch VI as follows:

bTx0Goa.png

 

Apparently, the FP elements I want are called "LabVIEWClassControl", and they have a ClassID of 102. However, "LabVIEWClassControl". isn't available in the list. When I wired 102 into New VI Object.vi, I was told "The specified object was not found."

 

 

How do I programmatically drop an LVClass control/indicator into a VI? More fundamentally, how do I script a new static dispatch VI?

 

Thanks in advance!

Edited by JKSH
Link to comment

I never looked at the details, but you can examine the VIs LV uses to see the process. Not all of them are unlocked, but some are.

 

Specifically, you'll probably want to start with <LabVIEW>\resource\Framework\Providers\LVClassLibrary\NewAccessors\BaseAccessorScripter\ScriptAccessorVIs.vi

  • Like 1
Link to comment

Something stupid I've done in the past when I'm in a hurry and can't figure out what that VI wants from me is to create something known (like a numeric) and then on the newly generated control, immediately call replace. Replace has a path input. I'm not a big fan, but it usually works.

  • Like 1
Link to comment

Thanks for your answers, everyone!

Creating a VI based on an existing template and then replacing placeholder components was a clean and easy way to do things.

 

You can always check out NI's GDS.

Look in VI:

C:\Program Files (x86)\National Instruments\LabVIEW 20xx\resource\Framework\Providers\Symbio_GDS\ClassProviders\Provider_LvNativeClass\ClassWriterNative_class\CreateMethod.vi

 

I haven't installed the GDS; I believe it will be part of LabVIEW 2014? Anyway, thanks for the lead. I'm sure there's lots of gems to be found inside when I need to dig deeper.

Link to comment
  • 3 weeks later...

For the record, the correct way to do this from scratch is:

  1. Pass a reference of LabVIEWClassControl (not LVClassLibrary) into the "vi object class" input of New VI Object
  2. Save the newly-created LVClassLibrary object to disk
  3. Pass the path of the LVClassLibrary into the "path" input of New VI Object

bqhwzGO.png

  • Like 1
Link to comment

Join the conversation

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

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

×
×
  • Create New...

Important Information

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