Author Topic: extract diagram as bpmn2.0 xml  (Read 7012 times)

nealthereader

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
extract diagram as bpmn2.0 xml
« on: August 10, 2016, 11:02:43 pm »
is it possible to extract bpmn2.0 xml from programatic interface?

PeterHeintz

  • EA User
  • **
  • Posts: 976
  • Karma: +58/-18
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #1 on: August 10, 2016, 11:18:48 pm »
I assume, you need to be a bit more precise in what you intend to achieve.
In a modelling environment a diagram is nothing/empty without the model behind.
What do you want to do with you extracted xml file?
Best regards,

Peter Heintz

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #2 on: August 10, 2016, 11:34:30 pm »
IIRC there is a XMI export specific to BPMN. I seem to remember some Sparxian was talking about that in another thread. And at the same level of memory there is the information that this export format is not (yet) realized.

q.

nealthereader

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #3 on: August 10, 2016, 11:51:16 pm »
I use extracted bpmn file to show on web UI with http://bpmn.io/ library.

What I am trying to do is use powershell with Interop.EA.dll and programmatic extract diagram in bpmn2.0 xml
http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/project_2.html
« Last Edit: August 10, 2016, 11:53:28 pm by nealthereader »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: extract diagram as bpmn2.0 xml
« Reply #4 on: August 11, 2016, 02:09:31 am »
I think that's possible yes, where are you having difficulties?

Geert

nealthereader

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #5 on: August 11, 2016, 03:18:44 am »
Here is my powershell script.
ExportPackageXMI may have some direction to answer but need help how to get there.

$eapDll="C:/Program Files (x86)/Sparx Systems/EA/Interop.EA.dll"
$eapFile="C:/eap/test.eap"
$extractedFile="C:/eap/extracted.xml"
[system.reflection.assembly]::LoadFile($eapDll)
$rep=New-Object EA.RepositoryClass
$rep.OpenFile($eapFile)
$project=New-Object EA.ProjectClass
#peaid is package guid
$peaid = $project.GUIDtoXML('{EB97F043-D87E-42ff-B58C-6645F9143C2C}')
#eaid is model guid
$eaid = $project.GUIDtoXML('{7598E729-E4D3-4f78-B339-01765F583D7A}')
#$project.ExportPackageXMI($peaid, 'xmiEA20', 1, '-1', 1, 1, $extractedFile)
#$project.PutDiagramImageToFile("{7598E729-E4D3-4f78-B339-01765F583D7A}",$extractedFile,0)
#$project.ExportPackageXMIEx($peaid, 'xmiEADefault', 1,'-1',1, 1, $extractedFile, 'epSaveToStub')
#Write-Output $project.EnumDiagramElements($eaid)
$project.Exit()

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #6 on: August 11, 2016, 05:08:53 am »
To export BPMN2.0 (I was wrong with the export, it's just the import which is missing), you need to supply 20 (xmiBPMN20 = 20) as 2nd. parameter.

See http://sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/xmitypeenum.html and http://sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/project_2.html

q.

nealthereader

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #7 on: August 11, 2016, 07:44:41 am »
Thanks Everyone
Solved

$project.ExportPackageXMI($peaid, 20, 1, '-1', 1, 1, $extractedFile)

somehow file path need back slash instead of forward.
$extractedFile="C:\eap\extracted.xml"

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #8 on: August 11, 2016, 08:07:15 am »
You're using Windoze\

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: extract diagram as bpmn2.0 xml
« Reply #9 on: August 11, 2016, 08:57:14 am »
The '20' in that call corresponds to the constant xmiBPMN20. Which is documented at http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/xmitypeenum.html