Archi Forum

Archi Plug-ins => jArchi => Topic started by: PARISAM on March 08, 2023, 13:00:33 PM

Title: Is there a way by script to find if the object is used or not in the model?
Post by: PARISAM on March 08, 2023, 13:00:33 PM
Hi,

Is there a way by script to find if the object or link is used or not in the model?

I checked in the documentation but I can't find anything.

This will allow to clean up the model by script.

Thank in advance.
Title: Re: Is there a way by script to find if the object is used or not in the model?
Post by: Phil Beauvoir on March 08, 2023, 14:31:44 PM
Hi, for elements and relations you'll need to use viewRefs:

https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Collection#viewrefs

For example:

selected = selection.first();
selectedConcept = selected.concept;
console.log(isUsedInView(selectedConcept));

function isUsedInView(concept) {
    return !$(concept).viewRefs().isEmpty();
}
Title: Re: Is there a way by script to find if the object is used or not in the model?
Post by: PARISAM on March 14, 2023, 17:35:02 PM
Thank it work :)