Author Topic: Setting initial type for generated diagrams  (Read 1142 times)

Rich Anderson

  • EA User
  • **
  • Posts: 71
  • Karma: +2/-0
    • View Profile
    • LinkedIn
Setting initial type for generated diagrams
« on: April 02, 2018, 01:31:29 pm »
Hi There, 

I have a case where I'm programatically generating several diagrams and I'm not able to properly set the diagram type on creation with this code:

Code: [Select]
Dim archimatediagram As EA.Diagram
archimatediagram = parentelement.Diagrams.AddNew(parentelement.Name, "Archimate3::Business")
archimatediagram.Update()

I've read in other posts that it's not possible to change the diagram type programatically using the Metatype property because that was deemed to be unsafe, and there appear to be ways to do this in SQL (which I prefer to avoid). 

It seems however, reasonable that I should be able to set the type of diagram based on the MDG at creation and the AddNew method takes type as a parameter.  However, this code above always yields a basic class diagram. 

What, if anything, am I missing here?

Rich Anderson
Urgnt Limited

qwerty

  • EA Guru
  • *****
  • Posts: 9590
  • Karma: +168/-148
  • I'm no guru at all
    • View Profile
Re: Setting initial type for generated diagrams
« Reply #1 on: April 02, 2018, 07:28:02 pm »
I don't have Archimate3, but with Archimate2 I had no issue creating the analogous diagram this way.

q.

Rich Anderson

  • EA User
  • **
  • Posts: 71
  • Karma: +2/-0
    • View Profile
    • LinkedIn
Re: Setting initial type for generated diagrams
« Reply #2 on: April 03, 2018, 10:52:10 am »
Querty, you are correct.  I re-ran the code to generate using Archimate 2 and it worked as expected.  It must be something wrong with the Archimate 3 MDG, I think.   I will log it as a bug.   

Thanks.
Rich Anderson
Urgnt Limited

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2526
  • Karma: +33/-2
    • View Profile
Re: Setting initial type for generated diagrams
« Reply #3 on: April 03, 2018, 10:59:23 am »
It is probably case-sensitive. Try "ArchiMate3::Business".
The Sparx Team
support@sparxsystems.com

Rich Anderson

  • EA User
  • **
  • Posts: 71
  • Karma: +2/-0
    • View Profile
    • LinkedIn
Re: Setting initial type for generated diagrams
« Reply #4 on: April 03, 2018, 11:29:13 am »
Well, KP, that was it!  I re-ran with this change and it worked as before.  However, it's a bit odd that "Archimate2:Business" works, but "Archimate3:Business" does not.  It seems that the Archimate 2 MDG is either not case sensitive or uses lower case but the Archimate 3 MDG behaves differently!   
Rich Anderson
Urgnt Limited

qwerty

  • EA Guru
  • *****
  • Posts: 9590
  • Karma: +168/-148
  • I'm no guru at all
    • View Profile
Re: Setting initial type for generated diagrams
« Reply #5 on: April 04, 2018, 01:43:42 am »
They are likely all case sensitive. At a guess "ArchiMate2::..." will not work too.

However, typical Sparx (?) the case of the M has changed.

q.

Sunshine

  • EA User
  • **
  • Posts: 658
  • Karma: +45/-3
  • Emoji's make you look younger
    • View Profile
Re: Setting initial type for generated diagrams
« Reply #6 on: April 04, 2018, 05:52:19 am »
I guess that Sparx are just correcting errors as ArchiMate is how its supposed to be.

Rich Anderson

  • EA User
  • **
  • Posts: 71
  • Karma: +2/-0
    • View Profile
    • LinkedIn
Re: Setting initial type for generated diagrams
« Reply #7 on: April 04, 2018, 04:32:34 pm »
Actually "Archimate2" with the lower case M does work.  That's what got me so confused.  I never tried "ArchiMate2".  My guess is that it won't work because the case sensitivity, but stranger things have happened!
Rich Anderson
Urgnt Limited