问题:我们的许多设计和架构文档都是在Enterprise Architect中创建和维护的--不管是好是坏,它就是这样的。这些文档存储在我们的subversion存储库中-这对于创建和更新它们的人来说工作得很好-因为我们有EA的许可证-但是许多开发人员(内部和外部的)在我们的代码库上工作,他们需要使用图表,但并不是所有的人都有EA许可证。
糟糕的解决方案:我们可以手动将EA文档导出为可移植格式,然后将其签入,但肯定会有可移植格式版本与EA文档过时的情况,因为它依赖于人工采取步骤进行手动转换。
更好的解决方案:我们一直在寻找一种自动化转换的方法。这可以作为提交后钩子运行,也可以作为持续集成系统的一部分运行。我们缺少的部分是允许我们自动化转换的部分。有什么想法吗?
发布于 2012-02-02 18:43:35
在示例代码中,我刚刚发现了一个函数whish将执行您想要的操作。但是被ProjectInterfaceExample这个无用的全名所隐藏
option explicit
!INC Local Scripts.EAConstants-VBScript
'
' Examples of how to access and use the Project Interface.
'
' Related APIs
' =================================================================================
' Project Interface API - http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/project_2.html
'
' Global reference to the project interface
dim projectInterface as EA.Project
sub ProjectInterfaceExample()
' Show the script output window
Repository.EnsureOutputVisible "Script"
Session.Output( "VBScript PROJECT INTERFACE EXAMPLE" )
Session.Output( "=======================================" )
set projectInterface = Repository.GetProjectInterface()
' Iterate through all model nodes
dim currentModel as EA.Package
for each currentModel in Repository.Models
' Iterate through all child packages and save out their diagrams
dim childPackage as EA.Package
for each childPackage in currentModel.Packages
DumpDiagrams childPackage
next
next
Session.Output( "Done!" )
end sub
'
' Recursively saves all diagrams under the provided package and its children
'
sub DumpDiagrams ( thePackage )
' Cast thePackage to EA.Package so we get intellisense
dim currentPackage as EA.Package
set currentPackage = thePackage
' Iterate through all diagrams in the current package
dim currentDiagram as EA.Diagram
for each currentDiagram in currentPackage.Diagrams
' Open the diagram
Repository.OpenDiagram( currentDiagram.DiagramID )
' Save and close the diagram
Session.Output( "Saving " & currentDiagram.Name )
projectInterface.SaveDiagramImageToFile "c:\\temp\\" + currentDiagram.Name + ".emf"
Repository.CloseDiagram( currentDiagram.DiagramID )
next
' Process child packages
dim childPackage as EA.Package
for each childPackage in currentPackage.Packages
DumpDiagrams childPackage
next
end sub
ProjectInterfaceExample您可能需要对其进行一些微调(例如,不将所有内容都写入C:\Temp),但这是一个很好的开始。
发布于 2009-09-17 22:12:38
我对这个产品不太熟悉,但是您链接的网站提到了一个自动化接口。这应该允许您从诸如VBScript或JavaScript之类的脚本语言控制企业架构师。可以通过此接口打印;如果是这样,您可以安装PDF printer driver (或使用通用PostScript打印机驱动程序打印到文件,然后使用GhostScript将其转换为PDF。
发布于 2009-09-17 22:17:06
我们有企业架构师,我们将其与Word很好地集成在一起。我们编写了自己的Wicket/Jetty WebApp,它将指向EA diragram的链接发布为HTTP URL,然后我们将其“插入和链接”到我们的UCR (或任何其他)文档中。web应用程序显示一个树状的链接结构,每个包一个链接,然后我们只需将链接复制到word文档中。
它真的工作得很好。我们可以在EA中进行任意多的更改,然后在Word文档中,只需转到CTRL+A选择all,然后点击F9更新所有链接。不幸的是,代码不是我写的,所以我不能确切地告诉你它是如何从EA发布的。我认为有一些Java代码只是轮询EA服务器,如果它检测到更改,就会把所有东西都吸出来。
https://stackoverflow.com/questions/1441479
复制相似问题