04-29-2009 04:53 PM - edited 04-29-2009 04:54 PM
Solved! Go to Solution.
04-29-2009 05:08 PM
Is this something you're trying to do at runtime? Clusters are fixed data structures so you can't change them programmatically. Or, are you just trying to create some typedef cluster controls so that you can use them for coding? What would your clusters basically look like? Perhaps another way of holding the information like an array of variants?
You can try LabVIEW scripting, though be aware that this is not supported by NI.
04-29-2009 05:27 PM
Wow! Thanks for the quick response! We would use this cluster as a fixed data structure. No need to change the structure during runtime. The cluster would be a cluster of clusters with multiple levels. There would be not pattern as to how deep these levels would go, or how many elements would be in each. Here is the application. I would like to be able to autocode a Simulink model file into a DLL. The model DLL would accept a Simulink bus object of a certain data structure (bus of buses), pick out which elements of the bus is needed for the model calculation, and then pass the bus object. I then will take the DLL file and use the DLL VI block to pass a cluster into the DLL block (with identical structure as the bus in Simulink). To save time, I would like to auto generate the C header file using Simulink to define the bus structure and then have LabView read that header file and create the cluster automatically. Right now I can do everything but the auto creation of the cluster. I can manually build the cluster to match the Simulink model bus structure and it runs fine. But this is only for an example model with a small structure. Need to make the cluster creation automated so it can handle large structures with minimal brute force. Thanks!
smercurio_fc wrote:Is this something you're trying to do at runtime? Clusters are fixed data structures so you can't change them programmatically. Or, are you just trying to create some typedef cluster controls so that you can use them for coding? What would your clusters basically look like? Perhaps another way of holding the information like an array of variants?
You can try LabVIEW scripting, though be aware that this is not supported by NI.
04-29-2009 10:33 PM - edited 04-29-2009 10:37 PM
Well, I can completely understand why you would want to do this, and it would be a neat tool. Unfortunately, there's no mechanism that can programmatically create clusters (unless you consider scripting, as I mentioned).
Since your cluster is complicated (cluster of clusters of who knows what), then I'm not sure how feasible/practical an array of variants will be. Sorry I can't provide a good answer for you.
04-30-2009 09:23 AM
04-30-2009 09:30 AM
The LabVIEW scriptors are found on LAVA.
I have done something simlar a couple of years ago but when I demo'ed it for my boss (I devloped it at home) it threw an "Insane Object" error and LV crashed. I have not touched it since.
That functionality is built into a lot of LV already but just not exposed to the users.
Talk to your Ni rep about acquiring a license for scripting. Who know's there may be a back-door way of doing this .
Ben
04-30-2009 09:32 AM - edited 04-30-2009 09:37 AM
Scripting is an entirely different beast from importing/exporting strings. The link I provided in my previous response is to the LAVA board that talks about scripting. As I indicated, that's the best place to research this topic. There is no documentation available for scripting. Also, be aware that you need LabVIEW 7 in order to create new code (using the methods discussed on LAVA).
Importing/exporting strings is intended for localization, not for what you're trying to do. It allows you to change the text displayed on your VI to target a different (human) language.
04-30-2009 11:18 AM
Ben wrote:
That functionality is built into a lot of LV already but just not exposed to the users.
Hi Ben,
You mentioned that this fucntionality is built into LV already. Are you referring to autogenerating clusters based off an XML or header file structure? I read somewhere that there are VI blocks that are hidden in LV that can be turned on by changing a flag in the LV config file. Here's the link to that post. http://forums.lavag.org/VI-Scripting-Readme-First-t1207.html
04-30-2009 11:40 AM
PhilipJoeP wrote:
Ben wrote:
That functionality is built into a lot of LV already but just not exposed to the users.
Hi Ben,
You mentioned that this fucntionality is built into LV already. Are you referring to autogenerating clusters based off an XML or header file structure? I read somewhere that there are VI blocks that are hidden in LV that can be turned on by changing a flag in the LV config file. Here's the link to that post. http://forums.lavag.org/VI-Scripting-Readme-First-t1207.html
There are methods and properties that let you insert a control into a cluster control that could in theory be used to build up your desired cluster. The ability to do this has been taken away from the casual user and is now protected under a scripting license (which I understand is not easy to get). So talk to your loacl NI rep about what you want to do. They may be able to get you going.
Re: LAVA
I am "neBulus" on the LAVA forum.
Ben
05-01-2009 01:08 PM
If you have a way to read in the file descriptor (CSV/C/XML) and build the data structure as a variant you could use my 'Variant to Control' tool for creating a cluster.
Ton