Book a Demo

Author Topic: Recursive diagram export as SVG  (Read 5392 times)

Tilo

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Recursive diagram export as SVG
« on: March 26, 2020, 04:58:52 pm »
Hello

I want to export all diagrams of a project as SVG. I found a VBA script which uses the function projectInterface.SaveDiagramImageToFile.
Unfortunately EA can't export directly to SVG. My approach was to export as emf and use inkscape to convert the emf files to svg.
That worked for some diagrams but not for all. Inkscape is not able to handle everything correct, some images are broken.

I found an add-on which can be used to export directly into SVG: https://community.sparxsystems.com/community-resources/706-svg-diagram-export-add-in This add-on is able to export diagrams which have been broken before.

Now my question is:
Can anybody tell me how to use an add-on in a VBA script?

I have no clue how to proceed.

Thank you very much

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Recursive diagram export as SVG
« Reply #1 on: March 26, 2020, 05:54:51 pm »
In theory you should be able to use the add-in exactly the same way EA uses it.
Create an instance of the add-in class, and then call the add-in functions such as EA_Menuclick.
You basically want to fool the add-in and pretend like your script is EA.

Since EA does all of this over COM, it should work for scripts as well.

I never tried it, but it looks like a fun project :D

Geert

Tilo

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Recursive diagram export as SVG
« Reply #2 on: March 26, 2020, 10:13:35 pm »
Hello Geert

Thank you very much for your fast reply.
I'm a microcontroller programmer. I know C and assembler but don't much about windows programming :)
I have no clue about COM etc.
Sounds like not many have thought about using add-ons in scripts yet?

I have to think about it.
The SVG add-on contains a visual studio example how to do mass convert. Maybe it's easier to modify.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Recursive diagram export as SVG
« Reply #3 on: March 27, 2020, 12:27:53 am »
If it's open source then you could indeed simply modify the code to convert the diagrams starting from package

Geert

timoc

  • EA User
  • **
  • Posts: 201
  • Karma: +14/-0
    • View Profile
Re: Recursive diagram export as SVG
« Reply #4 on: March 27, 2020, 01:09:58 am »
If it's open source then you could indeed simply modify the code to convert the diagrams starting from package

Geert
Do you know where the source for it is?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Recursive diagram export as SVG
« Reply #5 on: March 27, 2020, 01:29:34 am »
If it's open source then you could indeed simply modify the code to convert the diagrams starting from package

Geert
Do you know where the source for it is?
No, looks like it's Siemens' proprietary code.
Might be worth asking the author about it.

Geert