Author Topic: Finding a model in jArchi  (Read 353 times)

DaveVint

  • Active Member
  • ***
  • Posts: 51
Finding a model in jArchi
« on: November 15, 2019, 14:53:38 PM »
Hi,

I have a model that I want to use as an ABB template for an adapted copy/clone run by a script. For the initial load I would prompt the user to find and load it using the window.promptOpenFile and model.load functions. However I can't figure out how to tell if the model is already loaded and if so, find it. Probably just my lack of JQuery/Javascript experience, but I would be grateful for any pointers!

Cheers,

Dave

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: Finding a model in jArchi
« Reply #1 on: November 15, 2019, 17:12:20 PM »
The model#load(path) method will simply return the reference to the model if it is already loaded (i.e. in the Models Tree) but there's currently no way to know what is loaded.

We could implement:

Code: [Select]
$.model.getLoadedModels()
and:

Code: [Select]
$.model.isModelLoaded(model)
In fact I've just written the code to do this. @JB what do you think?
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Jean-Baptiste Sarrodie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 716
  • Archi Evangelist and Contributor. Visionary.
    • About me...
Re: Finding a model in jArchi
« Reply #2 on: November 15, 2019, 20:37:54 PM »
Hi,

This might be useful in some occasion. If you've implemented it, let's test it ;-)

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

DaveVint

  • Active Member
  • ***
  • Posts: 51
Re: Finding a model in jArchi
« Reply #3 on: November 25, 2019, 11:39:32 AM »
Thanks for the quick response both! I've been offline for a while, so couldn't reply. Look forward to getting access to this.

DaveVint

  • Active Member
  • ***
  • Posts: 51
Re: Finding a model in jArchi
« Reply #4 on: January 16, 2020, 17:08:05 PM »
Hi Guys,

Downloaded jArchi 0.7.0 with this included and works a dream. Thanks!

Dave