升级 Enterprise Architect 图元素名称换行

Upgrading Enterprise Architect Diagram Element names wrap

我们最近将 Enterprise Architect 升级到版本 12,当我打开图表时,所有名称现在都换行到元素的宽度。之前它会将服务器名称写在元素下的一行中,即使名称比元素本身长,但现在它们换行到元素的宽度。

如何让它在一行中显示元素的名称而不是换行?

编辑:如果名称中有破折号,这似乎是个问题。如果我将破折号更改为下划线,它不会换行。但我们确实需要在名称中使用破折号。

编辑 #2:这是我的问题的屏幕截图。左边一个有破折号和换行,右边一个有下划线但不换行。其他都一样。

您需要打开Features and Properties/Feature...

你可以为个别元素切换它。要在全球范围内执行此操作,您需要编写以下脚本:

dia = Repository.GetDiagram... # get the diagram itself
for do in dia.DiagramObjects {
  do.ElementDisplayMode = 1 # longest, or 3: truncate (2 = wrap)
  do.Update()
}

编辑:仅适用于 class 的功能,而不适用于其名称。 EA 将名称(如果矩形太小)包装在破折号和空格处(最终还有几个字符?)。这是无法更改的。您可以按以下方式编写脚本:

dia = repository.GetDiagram.... # load the diagram
for do in dia.diagramObjects {
  e = repository.getElementById(do.ElementId)
  width = stringBitWidth(e.Name) # calc width of text in screen pixels; use your phantasy
  currWidth = do.right - do.left
  extend = (width - currWidth) / 2
  do.Left -= extend
  do.Right += extend
  do.Update()
}