Universal Robots+

How can an URCap now a new Installation file has been loaded?

There is a gap for a problem in my URCap that I’d like to have covered.

If you have an UR program using my URCap nodes, and then you load a different installation file, my URCap IS NOT AWARE OF THAT. How can let my URCap be informed?

As I read somewhere, is a good practice to keep the isDefined methods as ligth as possible, and in future it will be limited to just consult variables with getModel, but forbiden to modify them.

I’ve already followed this, so I keep track of my own install node modifications, to update an isDefinedInstallValue only when needed. (I followed a similar politics with each ProgramNode.)

So how can I now a new installation file has been loaded? Then, in case has been loaded, I would update all my isDefined values.

I’m thinking in a variable I can consult or compare (such as the Safety checksum, but for the rest of installation parameters), to determine if a change has been loaded. Only then I will recalculate stuff.
Or maybe an ‘onInstallationLoaded’ event.

I guess you need the CreationContext.NodeCreationType from the CreationContext package:

e.g:

import com.ur.urcap.api.contribution.program.CreationContext;
..
CreationContext creationContext;
..
if (creationContext.getNodeCreationType() == CreationContext.NodeCreationType.NEW) {
..
} else {
..
}

Regards,

Matteo Timossi @recognitionrobotics

Sorry to dig up an old topic, but I am trying to do the same.

As I understand by consulting the API, getNodeCreationType() indicates how the node was created, returning NEW or LOAD. However, this would not indicate whether a new Installation node has been loaded, only how it has been created.

Has anyone figured out how to detect new loaded Installation files? Thank you.