Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - m2i7c9k

Pages: [1]
Automation Interface, Add-Ins and Tools / Virtual document from vbscript?
« on: September 08, 2021, 03:12:57 am »
Hi guys,

please help me! I'm a bit "out of order", because I don't understand how works virtual documents.

Is is possible have 3 element on the diagram and print them by element type?

1 Diagram = 1 UseCase, 1, Class (stereotype="webpage"), 1 Class (stereotype="service")

And I have no idea how create template that read the diagram elements, and use 3 deferent templates
by element type, in one document,  document chapter?

Thanks for advice


Hi Guy,

pleas HELP :) I'd like to retrieve from SQLQuery only ONE value <DestID>.

Sub Main

   Repository.EnsureOutputVisible "Script"
   Repository.ClearOutput "Script"
   dim currentDiagram as EA.Diagram
   set currentDiagram = Repository.GetCurrentDiagram()
   for each currentDiagram in currentDiagram.SelectedObjects
      dim theElement as EA.Element
      set theElement = Repository.GetElementByID( currentDiagram.ElementID )   
      Dim sqlCmd
      sqlCmd = "SELECT " &  _
         "   Object_1.Object_ID AS DestID " &  _
         "FROM  " & _
         "   t_object  "  & _
         "   INNER JOIN t_connector INNER JOIN t_object AS Object_1 ON
t_connector.End_Object_ID = Object_1.Object_ID "  & _
         "   ON t_object.Object_ID = t_connector.Start_Object_ID "  & _
         "WHERE " &  _
         "    t_object.Object_ID = " & theElement.ElementID
      Dim queryResult
      queryResult = Repository.SQLQuery(sqlCmd)
      'LOGInfo (queryResult)
      getDiagramOccurences  (queryResult)

                The result id:
                2021-8-7 14:27:24 [INFO]: <?xml version="1.0"?>
               <EADATA version="1.0" exporter="Enterprise Architect">
                But I want to <DestID> value
End Sub

Thanx a lot


Automation Interface, Add-Ins and Tools / interaction points
« on: August 04, 2021, 10:28:26 pm »
Hi Guys,

I'd like to know where is stored relation between the element and its interaction points?

I have a diagram with class element and ProvidetInterface, but I can't find their relationship in the BD (MS SQL)?


My Goal:
I want to create VBScript that copy ProvidetInterface data and add them (insert) into t_attributes.

What am I missing?


Hi Guys,

is it possible to create the package by VBScript with "Exclude from Generated Report"?

sub main

   dim i

   dim msg
   dim iBox
   dim appName
   appName = "Package"
   dim thePackage as EA.Package
   set thePackage = Repository.GetTreeSelectedPackage()

   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()

   dim packages as EA.Collection
   set packages = thePackage.Packages
   dim elements as EA.Collection
   set elements = thePackage.Elements

   dim subPackage as EA.Package
   set subPackage = packages.AddNew("[data]", "Class")
end sub

Thanks for HELP :)


General Board / Enum Class as Table Column?
« on: April 22, 2021, 08:26:14 pm »
Hi guys,

I can't figure out how can I add ENUM class associated (aggregation) to another Class?
I'd like to add the ENUM class name as Tabel Columnt name?



Hi Gus,

Please help me: In my model, I have a class that has an attribute with a tagged value that
I want to use as destination DB Table.attribute.type.

Class(Person).Attribute(firstName).Type(string) ----> DB.Table(Person).Attribute(fistrName).Type(Varchar(250)

How can I achieve that?

Thanks for the advice.


Suggestions and Requests / VBScript: Select element in the browser tree
« on: January 21, 2021, 08:54:42 pm »
Hi Guys,

I can't figure out how c I select the element in the browser tree after adding new attributes to the element?
My code will select the newly added attribute in the Class, and I'd like to select the parent Class where I startred from.
Thanks for the advice.

sub main
   Repository.ClearOutput "Script"
   Repository.EnsureOutputVisible "Script"
   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()
   if not theElement is nothing and theElement.ObjectType = otElement then
      dim i, addedAttributeID
      Session.Output( "Working on element '" & theElement.Name & "' (Type=" & theElement.Type & _
         ", ID=" & theElement.ElementID & ")" )
      ' Create an attribute to work on
      dim attributes as EA.Collection
      set attributes = theElement.Attributes
      dim attName, attType, attScope
      dim newAtt, splitAtt
      dim iBox
      iBox=InputBox("Enter attribute", "Class Attribute", "attribute_name, string(150), public")
      if IsEmpty(iBox) Then
         exit sub
         newAtt = iBox '"fullname, string(150), public"
         splitAtt = Array(Split(newAtt, ","))
         for each i in splitAtt
            attName = trim(i(0))
            Session.Output  attName
            attType = trim(i(1))
            Session.Output  attType
            attScope = trim(i(2))
            Session.Output  attScope
         dim newAttribute as EA.Attribute
         set newAttribute = attributes.AddNew( attName, attType )
         addedAttributeID = newAttribute.AttributeID
         Session.Output( "Added attribute: " & newAttribute.Name & _
            "(Type=" & newAttribute.Type & _
            ", ID=" & addedAttributeID & ")" )
      end if
   end if
   -->> SELECT the ELEMENT?

General Board / Tagged Value Window in EA 15.1.1526
« on: February 25, 2020, 08:22:25 am »
Hi Guys!

What is to happen when I click on the Editor's icon (Element group) and then click on the Tagged values? Because I do not see tagged value window :(
What I missed?



Automation Interface, Add-Ins and Tools / MDG profile examle?
« on: July 31, 2019, 07:31:44 pm »
Hi Guys!

Does anyone have some MGD example with toolbox and icons for elements?
Somehow ea help does not help me :/


Hi Guys,

I'm here again with the 2nd step of my code. The code below works on MSSQL, JET but PROGRES NO :/
Is there some special workaround for update/insert for PROGRES repository.

On PROGRES repository I've got the error: Object variable or With block variable not set.


Public Sub UpdateEAObject(objName As String, objNote As String, objGUID As String, objType As EAObjectType)
        'Saving EA element by element type.
        'The eaObject could be a Package, a Diagram, and an Element.
        Dim eaObject As Object = Nothing

        If objType = 0 Then
            eaObject = EARep.GetPackageByGuid(objGUID)
        ElseIf objType = 1 Then
            eaObject = EARep.GetDiagramByGuid(objGUID)
        ElseIf objType = 2 Then
            eaObject = EARep.GetElementByGuid(objGUID)
        End If

        With eaObject
            .Name = objName
            .Notes = objNote
        End With

    End Sub

Automation Interface, Add-Ins and Tools / .NET Repository List
« on: June 26, 2019, 03:34:11 pm »
Hi Guys,

is there a way how get a list of opener repository?

I have opened a few EA projects. And I want to get a list of opened repositories and select the one to import diagram element to MS Word.
I tried it by processes, but can't "set" the EA repository witch be the main for importing element to MS Word.



Hi Guys!

I have vb.NET 2019 Microsoft Word Add-in that can connect to EA repository, and gets
currently opened diagram element(s).

The problem is that if I have MS SQL repository, my code works fine, but on the PostgreSQL repository
my code returns nothing (without any error).

I'm parsing XLM string:

            Dim eaXML As String = GetDiagramElements(EARep.GetCurrentDiagram.DiagramID, EARep)

            Dim xmlData As String = eaXML
            Dim doc As XElement = XElement.Parse(xmlData)

            'Parse XML Data.
            Dim query = From d In doc.<Dataset_0>.<Data>.<Row>
                        Select New With
                             .ElementName = d.<ElementName>.Value,
                             .ElementNote = d.<ElementNote>.Value,
                             .ElementGUID = d.<ElementGUID>.Value

            'Import current diagram elements.
            For Each d In query
                With .ActiveDocument.Tables(1)
                    .Cell(rIdx, 1).Range.Font.Bold = True
                    .Cell(rIdx, 1).Range.Text = d.ElementName

                    If d.ElementName <> "" And d.ElementNote = "" Then
                        .Cell(rIdx, 2).Range.Text = "N/A" & vbCr & d.ElementGUID
                        .Cell(rIdx, 2).Range.Text = d.ElementNote & vbCr & d.ElementGUID '& vbCr & d.ElementStereo
                    End If
                End With
                rIdx += 1

Is there some another way to parse XML on the PostgreSQL repository?

Thankx a lot


Hi Guys,

I have word 2016 add-in (VB2017) and it works on a local account (win10pro), but on the user with domain it shows error:

The exception thrown: 'System. Exception' in Microsoft.VisualBasic.dll
Cannot create an ActiveX component.

Imports EA

Module Module1
    Sub Main()
            Dim vRep As EA.Repository
            Dim vApp As EA.App = GetObject(, "EA.App")
            vRep = vApp.Repository
        Catch ex As Exception
        End Try
    End Sub

So, it is a domain problem, or something different?

Thanx 4 all advice.


Hi Guys!

I am trying do the same thing as  "Access Sparx Ea from Visual Basic" by Robert Glover Jr but with EA 13.5.
I made it with EA 12.1.1230, but with 13.5 I don't.!OEkAqM6Von7X/sparx13-4-errorvs2017-png

I am trying to create Word 2016 Add-In for importing diagram element and update them. With EA 12.1 it works perfectly :)

Thanx for advice.


Pages: [1]