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.


Messages - shimon

Pages: [1] 2 3 ... 12
1
Hi,
It indeed works as you said.
There are some SQL errors when Claude reads the model. Do you want me to post them here (or send them to you)?

I tried creating Use Cases and found that I cannot. Claude created classes ( and later Requirements, after I requested that). I assume that this is by design.

As there exist already some add-ins ( that I did not experiment with, yet) to create sequence diagrams from text, via plantUML, I assume that Claude would have no problem creating sequence diagram from log files of a running program. This opens the possibility of Reverse Engineering ( to be more exact, creating a Design Model from)  a/an existing Software Project.
Are you planning to extend the abilities of the MCP to include sequence diagrams ( and / or Statecharts)?
These possibilities are really exiting.
Sincerely,
Shimon
 

2
Uml Process / Re: Find and Replace
« on: August 13, 2025, 09:34:23 pm »
See https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki

q.

Hi,
I tried installing HO_Tools on two laptops that have EA Version 17 installed, and EA failed to start after the install.
Do any of you have experience using this on version 17?
Thanks,

Shimon

3
No you still need a brain.  And lots of hard work.

Yeh, but these days you have to apply your brain to utilize AI.
The answer to his question is "Yes". You can use AI to create and enrich diagrams and elements in Enterprise Architect.

In order to use this feature, you have to adjust the MCP to enable edits. This is what  www.sparxsystems.jp/en/MCP/ writes.

Create models: To use these features, you need to add '-enableEdit' as an argument when launching the MCP3.exe.
create_diagram
create_element
create_connector
create_package
set_element_property
place_element_on_diagram
layout_diagram


As I am not an expert on MCP, I tried a few variations and still failed. I then "used my brain" to ask Claude how I should implement this and he showed me the correct usage ( a comma and then a new entry for the args).

4
Hi,
I tried it yesterday, and this is an amazing piece of work. I gave Claude a System Engineering Requirements document and asked it to create the Classes, associations, attributes and operations for it's implementation.
I am not judging the quality of the results, as the document that I gave him underwent some drastic changes by various AI.
I am just relating the ability of a layman to create a rich class model based on a total textual description.
Thanks for a great advance in the implementation of MBSE AI integration.
Shimon

P.S. The MCP_EA_x86.msi is not really an x86 installer. It is exactly the same size as the MCP_EA_x64.msi and installed it into the 64 bit directory. I installed the 64 bit EA in order to get it working, but I can't leave it that way for long.
Thanks.
 

5
Automation Interface, Add-Ins and Tools / Re: Searching Linked Documents
« on: August 10, 2025, 05:12:29 pm »
Hi,
I now saw that the quirk of the dependency not being registered was fixed in version Build 1712.

Notes for Enterprise Architect v17.1 (Build 1712)
27th of June 2025
General
Corrected loading of Model Add-ins with dependencies.


So maybe I should at least make one with the proper division of responsibilities, instead of packing all the functions into one Class.
Sincerely,
Shimon

6
Hi,
This is the original script of Geert. I just added the Util functions used, so that this script is usable as is, without installing the framework.
Thanks alot to Geert, who has always been helpful and shares so much of his work with all of us.
Sincerely,
Shimon

7
'[path=\Projects\Project A\Search Scripts]
'[group=Search Scripts]
'GB_SearchInLinkedVB.vbs Util functions of Geert,  added by SJ

option explicit

!INC Local Scripts.EAConstants-VBScript
' !INC Wrappers.Include

'
' This code has been included from the default Search Script template.
' If you wish to modify this template, it is located in the Config\Script Templates
' directory of your EA install path.   
'
' Script Name: In Linked Documents
' Author: Geert Bellekens
' Purpose: Search for a certain string in the linked documents
' Date: 2021-06-25
'

' TODO 1: Define your search specification:
' The columns that will apear in the Model Search window
dim SEARCH_SPECIFICATION
SEARCH_SPECIFICATION = "<ReportViewData>" &_
       "<Fields>" &_
        "<Field name=""CLASSGUID""/>" &_
        "<Field name=""CLASSTYPE"" />" &_
        "<Field name=""Name"" />" &_
        "<Field name=""Type"" />" &_
        "<Field name=""Stereotype"" />" &_
        "<Field name=""Description"" />" &_
        "<Field name=""Path"" />" &_
       "</Fields>" &_
       "<Rows/>" &_
      "</ReportViewData>"

'
' Search Script main function
'
sub OnSearchScript()
 'get the search term
 dim searchTerm
 searchTerm = InputBox( "Please enter term to search for", "search term" )
 'ask if we should look only under selected branch
 dim response
 response = MsgBox("Search only in selected package branch?", vbYesNo+vbQuestion, "Search scope")
 dim package as EA.Package
 if response = vbYes then
  set package = Repository.GetTreeSelectedPackage
 else
  set package = nothing
 end if
 'get the linked documents
 dim allLinkedDocuments
 set allLinkedDocuments = getAllLinkedDocuments(package)
 
 
 ' Create a DOM object to represent the search tree
 dim xmlDOM
 set xmlDOM = CreateObject( "MSXML2.DOMDocument.6.0" )
 xmlDOM.validateOnParse = false
 xmlDOM.async = false
 
 ' Load the search template
 if xmlDOM.loadXML( SEARCH_SPECIFICATION ) = true then
 
  dim rowsNode
  set rowsNode = xmlDOM.selectSingleNode( "//ReportViewData//Rows" )
 
  ' TODO 2: Gather the required data from the repository
  dim element as EA.Element
  for each element in allLinkedDocuments.Keys
   dim ldText
   ldText = allLinkedDocuments(element)
   if instr(1,ldText, searchTerm,  1) > 0 then
    AddRow xmlDOM, rowsNode, element
   end if
  next
'  'debug
'  dim debugFile
'  set debugFile = new TextFile
'  debugFile.Contents = xmlDOM.xml
'  'save the debug file
'  debugFile.FullPath = "I:\temp\scriptDebug.xml"
'  debugFile.Save
'  'end debug
  ' Fill the Model Search window with the results
  Repository.RunModelSearch "", "", "", xmlDOM.xml
 
 else
  Session.Prompt "Failed to load search xml", promptOK
 end if
end sub

'
' TODO 3: Modify this function signature to include all information required for the search
' results. Entire objects (such as elements, attributes, operations etc) may be passed in.
'
' Adds an entry to the xml row node 'rowsNode'
'
sub AddRow( xmlDOM, rowsNode, element)
 
 ' Create a Row node
 dim row
 set row = xmlDOM.createElement( "Row" )
 
 ' Add the Model Search row data to the DOM
 AddField xmlDOM, row, "CLASSGUID", element.elementGUID
 AddField xmlDOM, row, "CLASSTYPE", element.Type
 AddField xmlDOM, row, "Name", element.Name
 AddField xmlDOM, row, "Type", element.Type
 AddField xmlDOM, row, "Stereotype", element.Stereotype
 AddField xmlDOM, row, "Description", element.Notes
 AddField xmlDOM, row, "Path", element.FQName
 
 ' Append the newly created row node to the rows node
 rowsNode.appendChild( row )

end sub

'
' Adds an Element to the DOM called Field which makes up the Row data for the Model Search window.
' <Field name "" value ""/>
'
sub AddField( xmlDOM, row, name, value )

 dim fieldNode
 set fieldNode = xmlDOM.createElement( "Field" )
 
 ' Create first attribute for the name
 dim nameAttribute
 set nameAttribute = xmlDOM.createAttribute( "name" )
 nameAttribute.value = name
 fieldNode.attributes.setNamedItem( nameAttribute )
 
 if len(value) > 0 then
  ' Create second attribute for the value
  dim valueAttribute
  set valueAttribute = xmlDOM.createAttribute( "value" )
  valueAttribute.value = value
  fieldNode.attributes.setNamedItem( valueAttribute )
 end if
 ' Append the fieldNode
 row.appendChild( fieldNode )

end sub

'returns a dictionary of all elements that have a linked document as key and the text of the linked document as value.
function getAllLinkedDocuments(package)
 dim queryString
 queryString = "select o.object_ID from t_document d              " & vbNewLine & _
     " inner join t_object o on d.ElementID = o.ea_guid " & vbNewLine & _
     " where d.ElementType = 'ModelDocument'            "
 if not package is nothing then
  'get package tree id string
  dim packageTreeIDString
  packageTreeIDString = getPackageTreeIDString(package)
  queryString = queryString & vbNewLine & _
      " and o.package_ID in (" & packageTreeIDString & ")"
 end if
 dim elementsWithLinkedDocument
 set elementsWithLinkedDocument = getElementsFromQuery(queryString)
 dim linkedDocumentsDictionary
 set linkedDocumentsDictionary = CreateObject("Scripting.Dictionary")
 dim element as EA.Element
 'loop the elements and add element and its linked document to the dictionary
 for each element in elementsWithLinkedDocument
  dim linkedDocumentText
  linkedDocumentText = getLinkedDocumentContent(element, "TXT")
  linkedDocumentsDictionary.Add element, linkedDocumentText
 next
 set getAllLinkedDocuments = linkedDocumentsDictionary
end function


'--

'get the package id string of the given package tree
function getPackageTreeIDString(package)
   dim allPackageTreeIDs
   set allPackageTreeIDs = CreateObject("System.Collections.ArrayList")
   dim parentPackageIDs
   set parentPackageIDs = CreateObject("System.Collections.ArrayList")
   if not package is nothing then
      parentPackageIDs.Add package.PackageID
   end if
   'get the actual package ids
   getPackageTreeIDsFast allPackageTreeIDs, parentPackageIDs
   'return
   getPackageTreeIDString = Join(allPackageTreeIDs.ToArray,",")
end function


function getPackageTreeIDsFast(allPackageTreeIDs, parentPackageIDs)
   if parentPackageIDs.Count = 0 then
      if allPackageTreeIDs.Count = 0 then
         'make sure there is at least a 0 in the allPackageTreeIDs
         allPackageTreeIDs.Add "0"
      end if
      'then exit
      exit function
   end if
   'add the parent package ids
   allPackageTreeIDs.AddRange(parentPackageIDs)
   'get the child package IDs
   dim sqlGetPackageIDs
   sqlGetPackageIDs = "select p.Package_ID from t_package p where p.Parent_ID in (" & Join(parentPackageIDs.ToArray, ",") & ")"
   dim queryResult
   set queryResult = getVerticalArrayListFromQuery(sqlGetPackageIDs)
   if queryResult.Count > 0 then
      dim childPackageIDs
      set childPackageIDs = queryResult(0)
      'call recursive function with child package id's
      getPackageTreeIDsFast allPackageTreeIDs, childPackageIDs
   end if
end function

function getVerticalArrayListFromQuery(sqlQuery)
   dim xmlResult
   xmlResult = Repository.SQLQuery(sqlQuery)
   set getVerticalArrayListFromQuery = convertQueryResultToVerticalArrayList(xmlResult)
end function

function getSingleValueFromQuery(sqlQuery)
   dim singleValue
   singleValue = ""
   dim result
   set result = getArrayListFromQuery(sqlQuery)
   dim row
   for each row in result
      dim column
      for each column in row
         singleValue = column
         exit for
      next
      exit for
   next
   getSingleValueFromQuery = singleValue
end function


Function convertQueryResultToVerticalArrayList(xmlQueryResult)
    Dim result
   set result = CreateObject("System.Collections.ArrayList")
    Dim xDoc
    Set xDoc = CreateObject( "MSXML2.DOMDocument" )
    'load the resultset in the xml document
    If xDoc.LoadXML(xmlQueryResult) Then       
      'select the rows
      Dim rowList
      Set rowList = xDoc.SelectNodes("//Row")
      Dim rowNode
      Dim fieldNode
      dim firstRow
      firstRow = true
      'loop rows and find fields
      For Each rowNode In rowList
         if firstRow then
            For Each fieldNode In rowNode.ChildNodes
               'add an arraylist for each column
               result.Add CreateObject("System.Collections.ArrayList")
            next
         end if
         'loop the field nodes
         dim i
         i = 0
         For Each fieldNode In rowNode.ChildNodes
            'add the contents to the correct column arraylist
            result(i).Add fieldNode.Text
            i = i + 1
         Next
      Next
   end if
    set convertQueryResultToVerticalArrayList = result
end function


'returns an ArrayList with the elements accordin tot he ObjectID's in the given query
function getElementsFromQuery(sqlQuery)
   dim elements
   set elements = Repository.GetElementSet(sqlQuery,2)
   dim result
   set result = CreateObject("System.Collections.ArrayList")
   dim element
   for each element in elements
      result.Add Element
   next
   set getElementsFromQuery = result
end function

'gets the content of the linked document in the given format (TXT, RTF or EA)
function getLinkedDocumentContent(element, format)
   dim linkedDocumentRTF
   dim linkedDocumentEA
   dim linkedDocumentPlainText
   linkedDocumentRTF = element.GetLinkedDocument()
   if format = "RTF" then
      getLinkedDocumentContent = linkedDocumentRTF
   else
      linkedDocumentEA = Repository.GetFieldFromFormat("RTF",linkedDocumentRTF)
      if format = "EA" then
         getLinkedDocumentContent = linkedDocumentEA
      else
         linkedDocumentPlainText = Repository.GetFormatFromField("TXT",linkedDocumentEA)
         getLinkedDocumentContent = linkedDocumentPlainText
      end if
   end if
end function


'--


OnSearchScript()

8
Hi all,
I got it working as part of an easily importable Model Addin.
This can be found here.
https://github.com/shimonj/ModelAddinStarter.

It is still in work (for me, as I want to add the ability to search RTL characters), so the code is slightly bloated.
If any of you give it a go, let me know how it behaves.
I would have liked to pack all the helper functions in separate classes, but then it wouldn't be (so)easily portable, as I found the the Import of the Utility classes, is not imported automatically.
I will add a credit to Geert, before my next version.
Sincerely,
Shimon


9
Using my free MCP server add-in, we can connect Enterprise Architect and AI.

Check the second video in the following page, I recorded creating a model from AI generation.
https://www.sparxsystems.jp/en/MCP/
(It might be better to mute to avoid my broken English :) - without voice we can understand what happened.)

The book 'AI Assisted MBSE with SysML' explains how to use AI for modeling.

HTH,

WOW !!!
This looks very promising.
Claude did a pretty good job of converting a long VBscript to Javascript for porting it to a Model Addin.
For me, this integration of Claude with EA is great news.
Shimon

10
Hi Geert,
The need arose again, so I got around to trying this. The script fails on the following two lines.

BrsrGRP.In_Linked_Documents error: Variable is undefined: 'getPackageTreeIDString', Line:155
BrsrGRP.In_Linked_Documents error: Variable is undefined: 'getElementsFromQuery', Line:160

I understood that I needed the scripts and functions that the Wrappers.Include refer to.

It took me a while to import all the necessary folders of scripts to my EA environment, but I got it working at the end.

Since I want to use this as a Model Add-in, I  copied the contents of the Utils\Util script into the In Linked Documents script, and it worked fine without the Imports.

Now I have to find an easy way to port this to Javascript.
I tried Perplexity and I didn't manage yet ( about 15 tries, and didn't seem to be getting there).

Claude did a pretty good job after 10 tries, but asked me to go pro if I wanted to continue.

I put down the 20 USD  (for the month) and got a working solution.

It's not perfect, and not yet in a Model Add-in but I hope to get there soon.


Thanks alot,
Shimon

11
General Board / Re: Can no longer post SQL Statements to this forum
« on: July 10, 2025, 06:29:15 am »
Test
Silict * from t_object where t_object.Name like "":

12
Thanks Modesto,
You are indeed right. It is Access that does not support CTE, and I thought that it was MS-SQL.

13
General Board / Re: Can no longer post SQL Statements to this forum
« on: July 07, 2025, 04:19:47 pm »
Hi Eve,
I am wondering if there is a way to require each line to have a character that would make a SQL injection impossible.
Another possibility is giving the members (at least the ones with some history) the ability to attach files.
A third possibility is having a moderator OK all messages that contain SQL. I'm sure there might be some members who would volunteer for that.   
As the saying goes, "Where there is a will, there is a way"


Sincerely,
Shimon

14
Hi,
I created a Model Addin xml package that can be imported and used easily. I later read that there is a ready made one in the EA Example model.
I tested it and it is quite good and informative (not very well documented, but you can still learn allot).
So if you want to test a Javascript that Copilot or any other AI engine produces for you, it's quite easy to use and deploy it in a shared model, via the Model Add-in.
If anybody wants to try and needs help, maybe I'll make an instructional video how to use it.
Sincerely,
Shimon

15
Automation Interface, Add-Ins and Tools / Re: Session.Prompt Dialog
« on: June 27, 2025, 01:21:48 am »
Hi Shimon

This topic come up in another thread and a solution (workaround) was posted by Guillaume:

Use this piece JavaScript in an operation within you model based add-in Class :


//      0 -> OK button
//      1 -> OK/Cancel buttons
//      3 -> Yes/No/Cancel buttons
//      4 -> Yes/No buttons
// Returns a value matching the clicked button:
//      1 -> OK
//      2 -> Cancel
//      6 -> Yes
//      7 -> No

style += 4096;
var WSH = new COMObject("WScript.Shell");
return WSH.Popup(prompt, 0, title, style);


I have tried it and it works perfectly! With the advantage of displaying text of your choice in the dialog title bar :)

Phil

Thanks Phil.
I've tried it too, but still had failures. Perplexity (or was it Copilot) suggested adding ( to Guillaume's solution)  an if else statement to check it you have the WSH.Popup function, else use Session.prompt. This solved the problem for me.

Pages: [1] 2 3 ... 12