取消
显示结果 
搜索替代 
您的意思是: 

Add new class to project programmaticly

I'm trying to streamline my development using classes. I have found a way to add folders and such to a project programmaticly, but no success with how to add a new class. My goal is to make a utility that can generate a class skeleton for me to modify as needed. 
1 条消息(共 18 条)
4,767 次查看

Wirejunky,

 

LabVIEW has built-in object oriented programming capability.  The links at Can I Use Object-Oriented Programming in LabVIEW? give a lot of great information on how to use it!

Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
0 项奖励
2 条消息(共 18 条)
4,744 次查看

just created this fast (prob. better ways to do it). Here I also created the class itself.

 

 prog_class

 

Just a fast example. You can play with lots of more in there. Here I also created the class itself. Its fully possible to add a class to your project 🙂 With the create code at the beginning youve lots of class options to use.

3 条消息(共 18 条)
4,719 次查看
Sorry, missed the part on doing this programatically 🙂 Good catch, corny!
Message Edited by Robbob on 02-09-2010 02:23 PM
Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
0 项奖励
4 条消息(共 18 条)
4,712 次查看
Thanks Corny for your example! Learnt something new today :smileyhappy:. Now if only you didn't need to save the class first to disk... I am thinking of how you create classes in the project manager, where creating and adding the class to the project does not create a class file on disk. I am going to play around a bit and see if I cant get that type of behavior. 
0 项奖励
5 条消息(共 18 条)
4,673 次查看

Corny wrote:

just created this fast (prob. better ways to do it). Here I also created the class itself.

 

...

 

Just a fast example. You can play with lots of more in there. Here I also created the class itself. Its fully possible to add a class to your project 🙂 With the create code at the beginning youve lots of class options to use.


This reminds me of an expression we used when I graduated from my Navy "A School".

 

"Six months ago I didn't know how to spell Technician. Now I is one." 吐舌表情

 

Nice post,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 项奖励
6 条消息(共 18 条)
4,671 次查看

Ben,

 

Well, Navy...that explains a lot...

Hummer1

 

learning every day too.

0 项奖励
7 条消息(共 18 条)
4,663 次查看

WireJunky wrote:
Thanks Corny for your example! Learnt something new today :smileyhappy:. Now if only you didn't need to save the class first to disk... I am thinking of how you create classes in the project manager, where creating and adding the class to the project does not create a class file on disk. I am going to play around a bit and see if I cant get that type of behavior. 
Ive also tried to not save it, and add the reference to the project by entering the type (string) "class" or "lvclass" (I think this is what you tried?, for folders you would use the string name "folder"), but then, it popped up as an unkown object in the project manager.
 
Perhaps if you think the class as a file (it is actually a file), and a folder in the project as a "virtual folder (it doesnt need to exist on HDD)" than perhaps it makes sense?!? (just something that popped to my mind) 🙂
0 项奖励
8 条消息(共 18 条)
4,654 次查看

ops didnt read your post entirely.. my bad. "fast reader" litirally (how the heck is that spelled). If its possible to add classes that are in memory and not HDD to project, inform if you find out (I didnt got it to work) 🙂

0 项奖励
9 条消息(共 18 条)
4,648 次查看

K, I played around abit and I got this to work. By using the AddItemFromMemory method and supplying it with the newly created class name I was able to add the class to the project without first saving the class to disk.

 

CreateClass.png

This creates a new class in the project manager....

 

Project.png 

 

Thanks Corny for your help so far!.... now the cherry on top would be to programmaticly set the access scope of the internal virtual folder of the newly created class.

10 条消息(共 18 条)
4,627 次查看