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 - Barrie Treloar

Pages: [1] 2 3
1
General Board / Re: New Roadmap Diagram - How to add elements?
« on: August 01, 2025, 03:04:57 pm »
Necro an old post.

But I just had the exact same problems as the original poster, 10 years later.

The documentation is not clear on how to create a roadmap diagram.
It was only through blind luck clicking on the see also links in the legend column that I noticed the auto-apply options and with some fiddling of filter setting can auto-apply the legend colours to the elements that I choose to drop onto the roadmap.

Then the next problem is alignment, the diagram grid points do not align to the tick points.
Going into preferences and fiddling the grid size is an exercise in futility, as there is no way to establish the left edge to start from.
Even if that was possible its a nightmare to eyebal the tick spaces...

2
Was for logging.

But can do that via Repository, and I've sent a pull request with the transmogrification of EA-Matic scripts for Session.ouput -> Repository equivalent.

3
Thanks for looking.

I've got my workaround working.

EA's J-stuff is the same as EA's VB-stuff, which EA automatically adds the global Session into scope for you.

But what I need the Session for is EA's addin-stuff, because I need to inject it into the VBScript engine that is running inside EA addins and not in EA directly.

4
Geert's EA-Matic is running as an Addin. So everything that is VBScript within EA-Matic is loaded into the EA-Matic Addin's process space to run.

When EA runs a script, it looks like it adds Session as a global object.

But I can find nothing in the Enterprise Architect Object Model Reference for Session, and thus can find no way to add Session as a global object for EA-Matic.

As a workaround I'm transmogrifying Session.Output to Repository.WriteOuput, once I pass through RegEx hell to cope with VBScript line concatentation and optional parenthesis usage for one arg subroutines...

5
I'm working with Geert's EA-Matic and when those scripts are run in an Addin environment the Session object is not in the global scope.

See https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/session_object.html

But I can't find anything in the Enterprise Architect Object Model
Reference (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/reference.html) that will return me a Session object so I can place it into the Addin scope.

Does anyone know how I retrieve Session from another Object Model reference?

6
General Board / Re: Addings an element to multiple Diagram Layers?
« on: March 23, 2023, 04:36:04 pm »
Of course there's no way to set a property on multiple selected elements...

Use the filter condition "Contains" (not One of)

This script requires editing before running, as I've not yet learnt how to prompt for user input...

Writing this script was still faster than manually selecting each element and setting keywords...

Code: [Select]
option explicit

'[path=\Element]
'[group=Element]

dim KEYWORD_TO_APPEND
' CHANGE THIS VALUE BEFORE RUNNING
KEYWORD_TO_APPEND = "business_architecture_view"

sub main
dim diagram as EA.Diagram
dim diagramObject as EA.DiagramObject
dim element as EA.Element

Session.Output "Start..."

'get the current diagram
set diagram = Repository.GetCurrentDiagram()
if not diagram is nothing then
'first save the diagram
Repository.SaveDiagram diagram.DiagramID
for each diagramObject in diagram.SelectedObjects
set element = Repository.GetElementByID(diagramObject.ElementID)
Session.Output "Working on '" & element.name & "'"
if InStr(element.Tag, KEYWORD_TO_APPEND) = 0 then
If element.Tag = "" then
element.Tag = KEYWORD_TO_APPEND
else
element.Tag = element.Tag & "," & KEYWORD_TO_APPEND
end if

if not element.Update() then
Session.Output "Update failed: " & element.GetLastError()
end if
end if
next
end if
logger.INFO "Done"
end sub

main

7
General Board / Re: Addings an element to multiple Diagram Layers?
« on: March 23, 2023, 03:21:43 pm »
Thanks Paolo.

I *did* search before posting, and so I have no idea how I missed those threads.

It was easier to look through your posts to find it!

https://sparxsystems.com/forums/smf/index.php/topic,47573.msg277302.html#msg277302

As usual, another feature of Sparx not yet implemented.

I'll fiddle with Filters and One Of..

8
General Board / Re: Addings an element to multiple Diagram Layers?
« on: March 21, 2023, 07:53:34 pm »
Aren't filters global?
I didn't really want to pollute my model with them just for one diagram.

9
General Board / Addings an element to multiple Diagram Layers?
« on: March 20, 2023, 04:03:19 pm »
If I have an element that should belong to multiple Diagram Layers, how do I do that?
It looks like the Filter & Layers tool only allows a 1:1 relationship.

10
General Board / Re: Using ChatGPT to create EA Scripts
« on: March 20, 2023, 04:01:08 pm »
The problem is that documentation is difficult to come by.
EA makes some odd choices as you traverse down its internal object model, and is missing some functions/methods that would seem obvious.

Coming from someone who doesn't know VBScript but can code in other languages there are quite a few gotchas that really blocked me from making any progress.

Purely for my own benefit for when I come back to scripting in EA in a few years time, I've added to Geert's VBScript-Library with Documentation:
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/tree/master/Documentation

His repository of scripts give me the major benefit that I can use the EA Automation Reference https://www.sparxsystems.com/enterprise_architect_user_guide/15.2/automation/reference.html to find what I want to use and grep for example of its use.

11
General Board / Re: Setting default hyperlink details type?
« on: April 13, 2017, 07:30:26 am »

12
General Board / Setting default hyperlink details type?
« on: April 12, 2017, 10:31:23 am »
In the notes toolbar, then hyperlink button opens the Hyperlink Details with the default type of "File".

Is there any way to change this?

My most common hyperlink is to a web address.

This would save me a few microseconds over the years...

13
Thanks for the replies.

qwerty,

setting
DiagramLink.LineStyle = 7
works fine.
This must do the black magic behind the scenes as the resultant .Style is
DiagramLink.Style = Mode=3;EOID=7502739F;SOID=859B351F;Color=-1;LWidth=0;TREE=LH;   

Geert,
Have you got some thoughts one how to get those IDs?
The diagram is never very large, nor are the number of connectors on an element very large, so the speed penalty of a scan is not great.
Rather it's just a tedious indirect process.

I have the selected object, but I can't get at its DiagramLinks easily to make the adjustments.

qwerty,
With the SQL I can get the row I want, then I need to use the black magic to mangle the style back in, and then Repository.Execute to put it back.
I'll need to think about that some more.
The indirect scan is solving my problem well enough now without introducing this complexity.

14
DiagramLinks says
SourceInstanceUID : String - Returns the Unique Identifier of the source object.
TargetInstanceUID : String - Returns the Unique Identifier of the target object.

And when debugging the script I printed out some IDs and GUIDs
selectedElement id = 505 guid={EB58D0E1-1B80-4db2-AAD4-C2CBBC3B5C0C}   
diagramLink ConnectorID=458 SourceInstanceUID=859B351F   

Looking at the UID output... what's that?

There is nothing in Repository to get something by UID, only by Guid or ID.
Repository.GetElementByGuid
Repository.GetElementByID

I'm trying to write a script that takes selected elements and then to change the line style of the element's connectors.
SelectedObjects returns DiagramObjects which only knows about the Element via ElementID, it doesn't know anything about the connectors.

From Repository.GetCurrentDiagram.SelectedObjects and locating the element via Repository.GetElementByID(selectedObject.ElementID) I can get at the Connectors but not the DiagramLinks for those connectors.

Iterating over Repository.GetCurrentDiagram.DiagramLinks gives me SourceInstanceUID and TargetInstanceUID but as noted above those values dont appear useful. I can check whether the DiagramLinks.ConnectorID is in the selectedElement.Connectors Collection, but this seems rather roundabout.

So, should I be using UIDs?
Is there a more direct what than all the indirection I have mentioned.


15
General Board / Re: Ordering run state
« on: February 08, 2017, 05:02:32 pm »
Is there still no way to re-order run state variables?
Once created they seem to be in the reverse order of setting.

I'm assuming that the only way to change this is to edit the values in the database (and hack the horrible run state for @VAR;Variable=NAME;Value=VALUE;Op==;@ENDVAR; format)

Pages: [1] 2 3