Follow

Can I make my map fill the page, using MapViewer's Scripter?

This article provides a sample script for fitting the plot to the page in MapViewer's Scripter.
 

The map can be made to fill the page in MapViewer's Scripter.  In the program, the map will automatically scale to fill the page when you import new objects.  But, in the script, you need to tell the program to do this after you load the map.  Use the SetScale command to change the map scale to fit the page.

 

To run this script:

  1. Copy the text below, from the Sub Main start line to the End Sub end line.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines.
  5. Press Ctrl+V to paste your copied script over top of these existing lines.
  6. Click Script | Run to run the script.


**********


Sub Main

Dim mvApp, Plot As Object
Set mvApp = CreateObject("MapViewer.Application")
mvApp.Visible = True
Set Plot = mvApp.Documents.Add(mvDocPlot)

'Declares the Polygon object and declares the x,y coordinates of the polygon vertices as an array of doubles
Dim Polygon As Object
Dim Coords(7) As Double
Coords(0) = 5: Coords(1) = 4
Coords(2) = 3: Coords(3) = 6
Coords(4) = 6: Coords(5) = 7
Coords(6) = 5: Coords(7) = 4
Set Polygon = Plot.Layers.ActiveLayer.Shapes.AddPolygon(bSpline:=False, Vertices:=Coords)

'Wait 2 seconds so you can see the size of the shape before the scale is changed
Wait(2)

'Change the scale to fit the page
Plot.SetScale(bFitPage:=True)

End Sub


Updated February 16, 2015

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.