The Amos Graphics plugin below draws the following path diagram.
Imports Microsoft.VisualBasic
Imports Amos
Imports Amos.pd
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
Implements IPlugin
Public Function Mainsub() As Integer Implements IPlugin.Mainsub
If FileNew() Then
Return 0
End If
Dim E As PDElement
'Coordinates of variables
Dim Y1 As Single, Y2 As Single, Y3 As Single, Y4 As Single
Dim X1 As Single, X2 As Single, X3 As Single
Y1 = 1
Y2 = 2
Y3 = 3
Y4 = 5
X1 = 1
X2 = 3
X3 = 4.5
'Height and width of variables
Dim XHeight As Single, XWidth As Single
XHeight = 0.5
XWidth = 0.7
'Draw the variables
E = DiagramDrawObserved(X1, Y1, XWidth, XHeight)
E.NameOrCaption = "Var1"
E.NameFontSize = 16
E = DiagramDrawObserved(X1, Y2, XWidth, XHeight)
E.NameOrCaption = "Var2"
E.NameFontSize = 16
E = DiagramDrawObserved(X1, Y3, XWidth, XHeight)
E.NameOrCaption = "Var3"
E.NameFontSize = 16
E = DiagramDrawObserved(X2, Y2, XWidth, XHeight)
E.NameOrCaption = "Var4"
E.NameFontSize = 16
E = DiagramDrawUnobserved(X3, Y2, XWidth, XHeight)
E.NameOrCaption = "Other"
E.NameFontSize = 12
'Draw the paths
DiagramDrawPath("Var1", "Var4")
DiagramDrawPath("Var2", "Var4")
DiagramDrawPath("Var3", "Var4")
E = DiagramDrawPath("Other", "Var4")
E.Value1 = 1
E.ParameterFontSize = 14
'Draw the covariances
DiagramDrawCovariance("var3", "var2")
DiagramDrawCovariance("var2", "var1")
DiagramDrawCovariance("var3", "var1")
'Improve the path diagram's appearance
EditSelectAll()
EditTouchUp("Var1")
pd.Refresh()
EditTouchUp("Var1")
EditDeselectAll()
EditFitToPage()
End Function
Public Function Name() As String Implements IPlugin.Name
End Function
Public Function Description() As String Implements IPlugin.Description
End Function
End Class