The following Amos Graphics plugin resizes each rectangle in the path diagram so that it is 1.4 times larger than the largest observed variable name. The Undraw method hides each rectangle before the size changes, and the Draw method draws it after the change. The UndoToHere / UndoResume method pair allows you to undo the changes by pressing .
Imports Amos
Imports Amos.pd
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
Implements IPlugin
Public Function Mainsub() As Integer Implements IPlugin.Mainsub
Dim x As PDElement
Dim LargestWidth As Single, LargestHeight As Single
LargestWidth = 0
LargestHeight = 0
For Each x In PDElements
If x.IsObservedVariable Then
If x.NameWidth > LargestWidth Then LargestWidth = x.NameWidth
If x.NameHeight > LargestHeight Then LargestHeight = x.NameHeight
End If
Next
LargestWidth = LargestWidth * 1.4
LargestHeight = LargestHeight * 1.4
UndoToHere()
If LargestWidth > 0.2 And LargestHeight > 0.1 Then
For Each x In PDElements
If x.IsObservedVariable Then
x.Width = LargestWidth
x.Height = LargestHeight
End If
Next
pd.Refresh()
End If
DiagramRedrawDiagram()
UndoResume()
End Function
Public Function Name() As String Implements IPlugin.Name
End Function
Public Function Description() As String Implements IPlugin.Description
End Function
End Class