From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do I keep getting error 1000 while using VI scripting after I close the reference to the VI?

This is my first time posting to this forum, so I'm hoping someone out there will be able to help me. I work with a lot of people who aren't super savvy with LabVIEW, but know enough to press the 'run' button and do basic block diagram edits. I am developing an application that uses classes with a few VIs within them that are loaded like modules and run in the order the user specifies in the UI. They use a tree control to load up the classes and then an actor runs through them one by one. There's a lot more going on, but that's the general idea. Each one of those classes is what I call a 'procedure', which has basic IO with a device and with the UI via the actor framework's messaging system. 

 

I'm trying to create a sort of procedure wizard that will create a labview class and set up the (very) basic facade and block diagram so that my colleagues will be able to modify the procedures themselves. It also poses an interesting challenge for me so that I can learn. 

 

Here's my problem(s): I can create the class fine, and add it to the library of procedures OK, too. I can even change the private data cluster using the code below. That is--when I run them separately. If I run them in sequence with one VI calling them both, I get an error 1000 at the 'New VI Object' node. According to my research, this indicates that the class is 'not in a state compatible with this operation'. What that indicates to me is that the class has a reference open somewhere that I have failed to close. The problem is, the first VI is the only place I open and close the reference before it heads to the second. Am I missing something?

 

Also, I can't seem to run the first VI twice without getting error 43 'operation cancelled by user'. Any ideas?

 

create class.png

set private data.png

0 Kudos
Message 1 of 5
(3,194 Views)

I have no experience with class creation, but I suggest you look at some tools which do this, such as the VIs in <LabVIEW>\resource\Framework\Providers\LVClassLibrary or the GOOP development studio, which should be open source on GitHub, and does class creation.


___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(3,181 Views)

I think I am seeing something similar, did you ever come up with a solution?

0 Kudos
Message 3 of 5
(2,904 Views)

For anyone who might see this in the future....

 

My problem was that I had a missing VI in a class somewhere else in the hierarchy.  So class A is the parent, I am trying to script class B which inherits from class A.  Class C also exists, and inherits from A.  If class C is in memory and is broken (in my case missing a VI), then when I try to modify the private data for the class I am scripting I would see error 1000.

 

Seems like a pretty isolated case, but hopefully will help someone get on the right track 🙂

Message 4 of 5
(2,880 Views)

My fix didn't have any broken VIs as far as I am aware. What I wound up doing which worked was copying a class from a template and modifying the private class data of the newly copied class. There is something which prevents newly created classes from being recognized when you create them on the fly. I had created a class and saved it, reopening it when I was sure it was closed, tried to modify it, and still got the error. 

 

Copying the class from a template in the project folder worked wonders, though, and I was able to modify the private data of the class as I saw fit. Take a look at the snippets below for what I wound up doing to fix the issue. After using this method, I was able to modify the member VIs and class properties without issue.

 

There were surprisingly few helpful posts about this online, which is why I had such a hard time with this. 

 

copy.png

modify.png

Message 5 of 5
(2,870 Views)