취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

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,542 조회수

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,519 조회수

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,494 조회수
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,487 조회수
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,448 조회수

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,446 조회수

Ben,

 

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

Hummer1

 

learning every day too.

0 포인트
7/18 메시지
4,438 조회수

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,429 조회수

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,423 조회수

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,402 조회수