Sub Evaluate_OnLoad
Set Context = CreateObject("SCF.ScriptContext")
Set Document = Context.ScriptDocument
Set Framework = CreateObject("SCF.ScriptFramework")
Set Model = Framework.CurrentModel
Set ModelMRObject = Model.AsObject
Document.WriteLine "--- start ---"
Set ModelSubset = ModelMRObject.ChildByName("Model Subset", "Model Subset 1")
Set Diagram = ModelSubset.ChildByName("Diagram", "Diagram 1")
'-------------------------------------------
' Get the Graphics for table "actor"
'-------------------------------------------
Set TableGraphics = Diagram.ChildByName("Table Graphics", "actor")
'-------------------------------------------
' Read position
'-------------------------------------------
PropName = "Top Left Point"
LeftTop = TableGraphics.Property(PropName).AsString
Document.WriteLine "actor Position: " & LeftTop
PointStrToXY LeftTop, X, Y
X = X + 100
Y = Y + 10
' Document.WriteLine "X Y " & X & "," & Y
'-------------------------------------------
' Set position
'-------------------------------------------
Model.BeginTransaction "Fiddle with graphics"
Set PropValue = Framework.CreatePropertyValue("Table Graphics", PropName)
PropValue.FromString X & "," & Y
TableGraphics.SetProperty PropName, PropValue
Model.EndTransaction
end sub
'---------------------------------
sub PointStrToXY(PointStr, X, Y)
'---------------------------------
P = InStr(PointStr, ",")
LStr = Trim(Left(PointStr, P-1))
RStr = Trim(Mid(PointStr, P+1,1000))
X = 1 * LStr
Y = 1 * RStr
end sub |