Author Topic: Find in all diagrams - Element usage window  (Read 3799 times)

DanielB

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Find in all diagrams - Element usage window
« on: March 18, 2015, 01:47:21 pm »
Hi,

Is it possible to open Element usage window from Script? Or something similar.

Regards,
Daniel
« Last Edit: March 18, 2015, 01:47:43 pm by slaug »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find in all diagrams - Element usage window
« Reply #1 on: March 18, 2015, 06:09:29 pm »
I don't think so, unless you play with SendKeys to simulate some kind of user interaction.

You could of course also write your own "element usage" window (in C# or similar) and display that using a script. But I guess you are trying to avoid any .Net development.

Geert

DanielB

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Find in all diagrams - Element usage window
« Reply #2 on: March 19, 2015, 10:34:24 am »
Thank you for qucik response.

I would like to avoid if it is possible. If not then I don't mind to put few lines of code in C#. Do you have a link to documentation which describes how to include C# libs in scripts?
« Last Edit: March 19, 2015, 10:52:06 am by slaug »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Find in all diagrams - Element usage window
« Reply #3 on: March 19, 2015, 12:00:31 pm »
In which scripts??

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find in all diagrams - Element usage window
« Reply #4 on: March 19, 2015, 06:02:58 pm »
Quote
Thank you for qucik response.

I would like to avoid if it is possible. If not then I don't mind to put few lines of code in C#. Do you have a link to documentation which describes how to include C# libs in scripts?
I don't really have a link, but I do have a few EA-Matic script examples on my site where I use elements from my Enterprise Architect Addin Framework

Another example is the usage of a .net ArrayList below in the vbscript function below
Code: [Select]
function getOrderedActivities(diagram)
      'loop all diagram object
      dim diagramObject as EA.DiagramObject
      dim orderedActivities
      dim orderedDiagramObjects
      set orderedActivities = CreateObject("System.Collections.ArrayList")
      set orderedDiagramObjects = CreateObject("System.Collections.ArrayList")
      for each diagramObject in diagram.DiagramObjects
            dim element as EA.Element
            set element = Repository.GetElementByID(diagramObject.ElementID)
            if not element is nothing and element.Type = "Activity" then
                  dim added
                  added = false
                  dim i
                  for i = 0 to orderedDiagramObjects.Count - 1
                        if diagramObject.top = orderedDiagramObjects(i).top then
                              'height is equal, check x position
                              if diagramObject.left <= orderedDiagramObjects(i).left then
                                    orderedDiagramObjects.Insert i, diagramObject
                                    orderedActivities.Insert i, element
                                    added = true
                                    exit for
                              end if
                        elseif diagramObject.top > orderedDiagramObjects(i).top then
                              'add before
                              orderedDiagramObjects.Insert i, diagramObject
                              orderedActivities.Insert i, element
                              added = true
                              exit for
                        end if
                  next
                  'if not added yet then add it to the back of the list
                  if not added then
                        orderedDiagramObjects.Add diagramObject
                        orderedActivities.Add element
                  end if
            end if
      next
      set getOrderedActivities = orderedActivities
end function

Geert