How can I use Scripter to draw an ellipse from a centerpoint and radii in Grapher?

Below is a sample script for creating an ellipse from a centerpoint and radii in Grapher. To run this script:

  1. Copy the script below.
  2. Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
  3. Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
  4. Press Ctrl+V to paste it into the Script Manager.
  5. 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 Sub

 

Updated September 24, 2018

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.