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 - Andre_b_b

Pages: [1]
1
Hello guys, i have written a code in VBScript inside Enterprise Architect and it is working but it is taking so long to execute it. Is there any command in VBScript such as "Application.ScreenUpdating = False" in VBA, so my code does not last 3 minutes to execute?

2
Hello,
with the help of the forum during the last weeks, i have made a script that i can generate "parent" and "child" element and it appears the hierarchy in the project browser. I could also, generate a relationship(Realization) between the elements, when they are generated in a diagram. But, in fact, i would like to put the child element inside the parent element, does anyone know if it is possible using VBscript? For now, i have the parent element as a "stakeholder" and the child element as an "Action". For know i have this script, which works to build the relationship between parent and child.
Code: [Select]
Dim objElement
Set objElement = objElementParent.Elements.AddNew(child, "Action") 
objElement.Update

dim newObjectparent 
set newObjectparent = diagram.DiagramObjects.AddNew("", "")
newObjectparent.ElementID = objElementParent.ElementID   
newObjectparent.Update()
dim newObjectchild 
set newObjectchild = diagram.DiagramObjects.AddNew("", "")
newObjectchild.ElementID = objElement.ElementID   
newObjectchild.Update()
Set connector = objElementParent.Connectors.AddNew("", "Realization") 
connector.SupplierID = objElement.ElementID 
connector.Update()

3
Hi guys, i am able to add packages to a model, add diagrams and elements to a package, add elements do diagram and connectors between the elements. Almost perfect, except for the fact that when i finish running my script, the elements are all in the same position and the layout options of the menu are not so useful because they cannot separate some elements. Anyone have an idea of a method  to arrange the elements and the connectors in a better visualization? I have seen some discussions here in the forum, but none of them were useful to me /:   Is it better to arrange during the generation of the elements, generation of the connectors, or is there a function that organizes everything and i could put in the end of the script?

4
Hi guys,
i have been working with Enterprise Architect for 2 months and my objective is, from a Excel file, generate a diagram within the relations between the elements(mainly "InformationFlow", "Derive","Usage"). In order to achieve this, i use the MDG Integration Office Add-in and i could do it, but i need to do the process in an automatic way: Run a script inside EA should be enough. I have developed a code in VBScript but it is not working - in fact, i can run the script but anything happens/changes in the software. Can you help me with the code or suggest any other way to achieve my objective? Unfortunately i only have 2 months to finish this project... Here i let the code that was written in the scripting Window of my Enterprise Architect.
Code: [Select]
option explicit

!INC Local Scripts.EAConstants-VBScript

'
' Script Name: import excel into EA
' Author:  Andre
' Purpose: import an excel file in order to generate a diagram and its elements
' Date: 19/06/2023
'
Sub importexcel()   


    ' Set the path and filename of the Excel file to import 
    Dim filePath
    Dim fileName
    filePath = "MyPathtomyFile" 
    fileName = "my_file.xlsx" 
     
    ' Set the name of the package to import the data into 
   Dim packageName
    packageName = "New Package" 
     
    ' Set the name of the object profile and connector profile to use 
   Dim objProfileName
   Dim conProfileName 
    objProfileName = "my_objprofile_name" 
    conProfileName = "my_conprofile_name" 
     
    ' Import the data from the Excel file 
    Dim repository As EA.Repository 
    Set repository = GetObject("MyPathtomyFile", "EA.App").Repository 
    repository.ImportCSVEx filePath & fileName, objProfileName, conProfileName, packageName, False, False, False, False, False, False 
     
    ' Create a new diagram to represent the imported data 
    Dim diagram As EA.Diagram 
    Set diagram = repository.Diagrams.AddNew("name_of_diagram", "ActivityDiagram") 
     diagram.PackageID = repository.GetPackageByGuid(repository.Models.GetAt(0).PackageGUID).PackageID 
     diagram.Update 
     
 
 

    ' Find the objects that were imported and add them to the diagram 
    Dim objects As EA.Collection 
    Set objects = repository.GetElementsByQuery("SELECT Object_ID FROM t_object WHERE Stereotype = 'YourStereotypeName' AND Package_ID = " & repository.GetPackageByName(packageName).PackageID) 
    Dim obj As EA.Element 
    For Each obj In objects 
        Dim diagramObject As EA.DiagramObject 
        Set diagramObject = diagram.DiagramObjects.AddNew("", "") 
        diagramObject.ElementID = obj.ElementID 
        diagramObject.Update 
    Next   
     
    ' Find the connectors that were imported and add them to the diagram 
    Dim connectors As EA.Collection 
    Set connectors = repository.GetElementsByQuery("SELECT Connector_ID FROM t_connector WHERE Package_ID = " & repository.GetPackageByName(packageName).PackageID) 
    Dim con As EA.Connector 
    For Each con In connectors 
        Dim diagramLink As EA.DiagramLink 
        Set diagramLink = diagram.DiagramLinks.AddNew("", "") 
        diagramLink.ConnectorID = con.ConnectorID 
        diagramLink.Update 
    Next 
     
    ' Refresh the view to show the imported data and the new diagram 
    repository.RefreshModelView (packageName) 
     
End Sub 

5
Hi guys,
i am using the MDG Integration for Office, but i still have problems regarding its features. How do i generate a diagram and its elements inside antoher element from a Excel file?
Example: i have activities A,B, C and D in a diagram and i would like to create a child diagram of C, which contains C.1, C.2, etc...
Can you help me?
Thanks in advance

6
Hello guys,
i have a diagram that has relationships "Information Flow" between activities, but the links do not carry any information. I would like to fill the "Information Conveyed", so i could see in the diagram what are the informations exchanged between the activites. For that, i have an Excel file with the informations  to be used in the process, but i do not know how if i have to import from a differentsheet, or if i should add the lines in the same sheet of the import of the elements and the information flow. If so, can you help me? How should i classify the informations? What is the specification to generate a diagramme that has Elements and Informations Flow between them, and what informations are being exchanged?
Thank you, guys.

7
Hi, i am trying to make some imports from Excel to EA and i am doing it with MDG Intregration Office, but i did not manage to import elements inside another element, for example, put an action inside an activity in an automatic way. Can you help me?
André Boggio

Pages: [1]