Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Benny on February 16, 2017, 11:14:12 pm

Title: Adding Diagram Properties Note to Diagram using a Script
Post by: Benny on February 16, 2017, 11:14:12 pm
HI,

I would like to add the Diagram Properties Note to the diagram using a script which already adds some Boundaries.

The Diagram Properties Note is just a text so I tried it like this:

   dim Overview as EA.Element
   set Overview = currentPackage.Elements.AddNew( "", "Text" )
   call Overview.Notes("Name: " & currentDiagram.Name & vbCrLf & _
   "Author: " & currentDiagram.Author & vbCrLf & _
   "Version: " & currentDiagram.Version & vbCrLf & _
   "Created: " & currentDiagram.CreatedDate & vbCrLf & _
   "Updated: " & currentDiagram.ModifiedDate )
   Overview.Update

I looks quiet the same, but what I did not consider, that the Name ModifiedDate is fix in the notefield once the text was created.
In die original diagram properties note the values are self updating.

Is there a possibility to insert the original one within a script.
I cloud insert it in the diagram like this: http://sparxsystems.com/enterprise_architect_user_guide/13.0/modeling_tools/addpropertiesnote.html
So there must be a way, or ?

Benny
Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: qwerty on February 17, 2017, 02:16:17 am
Try Diagram.ShowDetails

q.
Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: Paolo F Cantoni on February 17, 2017, 10:19:40 am
Benny,

Once you create the Text element, you need to set the subtype to the value 18.  I think this is mentioned in qwerty's Inside EA book (if not, it will be ;) )

Overview.Subtype=18;

just before the update.  Then EA will create the TitleBlock element (as it should be properly called).

HTH,
Paolo
Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: qwerty on February 17, 2017, 08:21:56 pm
I described it as "18: Special Text" on p. 9. Will make an update so it's clear that those are diagram notes.

q.
Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: Benny on February 17, 2017, 08:28:29 pm
Hi,
thank you for your answers.

@qwerty:

afaik are the Show Diagram Note not equal to the Diagram porperty note? O_o

I´ll try the Subtype=18 solution.

bdw: I bougth your Book Scripting EA last week ; )

Many Thanks

Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: qwerty on February 17, 2017, 08:49:07 pm
You are right. The ShowDetails is equivalent to the Show Diagram Notes option (which fixes a header top left). The 18-text will create a floating note with similar content. I just uploaded an update (just replaced "Special Text" with "Diagram Notes" which should be clear then).

q.
Title: Re: Adding Diagram Properties Note to Diagram using a Script
Post by: Benny on February 17, 2017, 09:31:20 pm
Hi,

i did it with the Subtype=18, it worked fine thank you very much.

many thanks

Benny