JKSH Posted July 19, 2014 Report Posted July 19, 2014 (edited) 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". 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: 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 July 19, 2014 by JKSH Quote
Yair Posted July 20, 2014 Report Posted July 20, 2014 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 1 Quote
JKSH Posted July 21, 2014 Author Report Posted July 21, 2014 Thanks for the lead, Yair! I had a quick look, and it seems to be exactly the kind of example that I need. I'll dig through it when I have time. Quote
chris754 Posted July 21, 2014 Report Posted July 21, 2014 I've done this in the past. I found it easiest to use a template and change the controls as needed using scripting. Building it from scratch each time is a lot more work. 2 Quote
smithd Posted July 21, 2014 Report Posted July 21, 2014 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. 1 Quote
MikaelH Posted July 25, 2014 Report Posted July 25, 2014 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 Quote
JKSH Posted July 27, 2014 Author Report Posted July 27, 2014 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. Quote
JKSH Posted August 15, 2014 Author Report Posted August 15, 2014 For the record, the correct way to do this from scratch is: Pass a reference of LabVIEWClassControl (not LVClassLibrary) into the "vi object class" input of New VI Object Save the newly-created LVClassLibrary object to disk Pass the path of the LVClassLibrary into the "path" input of New VI Object 1 Quote
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.