Below is a sample script for creating an ellipse from a centerpoint and radii in Grapher. To run this script:
- Copy the script below.
- Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
- Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
- Press Ctrl+V to paste it into the Script Manager.
- Click the green arrow Start/Resume icon in the Script Manager.
Sub Main
'Initializes Grapher
Dim GrapherApp, Docs, Plot, Shapes As Object
Set GrapherApp = CreateObject("Grapher.Application")
GrapherApp.Visible = True
Set Docs = GrapherApp.Documents
Set Plot = Docs.Add(grfPlotDoc)
Set Shapes = Plot.Shapes
'-----------------------
'User-defined variables
'-----------------------
'Vertical radius
RadV = 0.5
'Horizontal radius
RadH = 1
'Horizontal (x) coordinate of the center point
CenterH = 3
'Vertical (y) coordinate of the center point
CenterV = 7
'---------------------
'Calculate the left, top, right, and bottom of the ellipse
L = CenterH - RadH
R = CenterH + RadH
B = CenterV - RadV
T = CenterV + RadV
'Add Ellipse
Set Ellipse1=Shapes.AddEllipse( L, T, R, B, "Ellipse1" )
End SubGolden Discoveries (Blog)
Updated September 24, 2018
Comments
Please sign in to leave a comment.