Author Topic: Accessing diagram frame of SysML diagrams  (Read 2650 times)

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Accessing diagram frame of SysML diagrams
« on: May 06, 2023, 01:36:36 am »
Hello all,

I would like to move a SysML diagram from one package to another using EA API.
To do so I need to disable the diagram frame, safe (refresh) the diagram and package upfront.
Is there a way how the diagram frame can be accessed? Unfortunately documentation is quite weak here.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Accessing diagram frame of SysML diagrams
« Reply #1 on: May 06, 2023, 03:07:26 am »
I think it's a property of the diagram, so probably to be found in either Diagram.Pdata or Diagram.ExtendedStyle

The way I find out stuff like that is to use SQL Profiler. This tool records all database queries. So I turn it on, change whatever I'm investigating in EA, and then turn it off again.
Then by looking through the logs I find what exactly EA changed in the database.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Accessing diagram frame of SysML diagrams
« Reply #2 on: May 06, 2023, 06:03:33 am »
My way is a bit different. I create an XML dump of all tables from a (as unpopulated and small as possible) repo, make the changes and compare the 2nd dump via WinMerge. That shows exactly the changes.

q.

Takeshi K

  • EA User
  • **
  • Posts: 593
  • Karma: +39/-1
    • View Profile
Re: Accessing diagram frame of SysML diagrams
« Reply #3 on: May 08, 2023, 09:51:31 am »
Hello vrieg,

Diagram frames of SysML are just DiagramObjects of the parent packages or elements (e.g. Blocks).

So, removing the DiagramObject from the Diagram.DiagramObjects collection can disable the diagram frame.

HTH,
--
t-kouno

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Accessing diagram frame of SysML diagrams
« Reply #4 on: May 08, 2023, 04:56:45 pm »
I think it's a property of the diagram, so probably to be found in either Diagram.Pdata or Diagram.ExtendedStyle

The way I find out stuff like that is to use SQL Profiler. This tool records all database queries. So I turn it on, change whatever I'm investigating in EA, and then turn it off again.
Then by looking through the logs I find what exactly EA changed in the database.

Geert

 
I am not sure how this should work. Can SQL Profiler can access local EA fies as eapx files?
Recording commands and transactions might be really beneficial.
Could you explain this a bit more?

My way is a bit different. I create an XML dump of all tables from a (as unpopulated and small as possible) repo, make the changes and compare the 2nd dump via WinMerge. That shows exactly the changes.

q.

This was working for me. The actual command was
Code: [Select]
EA.Diagram Diagram1 = currentlySelectedPackage.Diagrams.AddNew("DiagramName","");
                Diagram1.MetaType = "SysML1.4::BlockDefinition";
                Diagram1.Update();
                string currentstyleex = Diagram1.StyleEx;
                outputTab.WriteInfoMsg("current extended string" + currentstyleex);
                Diagram1.StyleEx = "SF=0;";
                Diagram1.Update();
                repository.SaveDiagram(Diagram1.DiagramID);
                repository.RefreshModelView(currentlySelectedPackage.PackageID);
                repository.RefreshOpenDiagrams(true);
                repository.ReloadDiagram(FunctionalArchitectureDefinitionDiagram.DiagramID);
« Last Edit: May 08, 2023, 05:06:31 pm by vrieg »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Accessing diagram frame of SysML diagrams
« Reply #5 on: May 08, 2023, 05:11:44 pm »

I am not sure how this should work. Can SQL Profiler can access local EA fies as eapx files?
Recording commands and transactions might be really beneficial.
Could you explain this a bit more?

No, SQL Profiler is a MS SQL Server tool. There might be similar tools voor jet files as well, but I do all of my development on MS SQL, so I haven't really looked into that.
99% of my clients use SQL Server anyway as their backend.

You can install and use MS SQL Server Express completely for free, so if you have admin rights on your machine you can install and use it.

Geert