Author Topic: Adding Diagram Properties Note to Diagram using a Script  (Read 4856 times)

Benny

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Adding Diagram Properties Note to Diagram using a Script
« 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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #1 on: February 17, 2017, 02:16:17 am »
Try Diagram.ShowDetails

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #2 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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #3 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.

Benny

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #4 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

« Last Edit: February 17, 2017, 08:32:37 pm by Benny »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #5 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.

Benny

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Adding Diagram Properties Note to Diagram using a Script
« Reply #6 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