Use the .Opacity property of the object to specify the opacity (or transparency) of the object in automation. You can set the opacity for layer properties, the layers themselves, and for other drawn objects. Below is a full example script demonstrating this process.
To run this script:
- Copy the script below.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- Press Ctrl+V to paste it into Scripter.
- Click Script | Run to run the script.
*********
Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Dim Plot As Object Set Plot = SurferApp.Documents.Add 'Creates a filled image map, and sets the opacity of the missing data fill to 0% (completely transparent) Dim MapFrame1 As Object Set MapFrame1 = Plot.Shapes.AddImageMap(GridFileName:=SurferApp.Path+"\samples\goldenblank1.grd") Dim ImageLayer As Object Set ImageLayer = MapFrame1.Overlays(1) 'Sets opacity for the missing data in the image layer properties ImageLayer.MissingDataColorRGBA.Opacity=0 'Sets the opacity for the image layer iteself ImageLayer.Opacity = 50 'Creates a polygon and fills it with a semi-opaque fill Dim Coordinates(5) As Double Coordinates(0) = 4: Coordinates(1) = 4 Coordinates(2) = 8: Coordinates(3) = 1 Coordinates(4) = 5.5: Coordinates(5) = 0.5 Set Polygon = Plot.Shapes.AddPolygon(Coordinates) Polygon.Fill.Pattern = "Solid" Polygon.Fill.ForeColorRGBA.Color = srfColorBlue Polygon.Fill.ForeColorRGBA.Opacity = 50 End Sub
For more information, please see the Opacity Property page in the Help. See also the attached script Opacity.bas, which is also located in the \Samples\Scripts\ folder in the Surfer installation directory.
Updated October 30, 2018
Comments
0 comments
Please sign in to leave a comment.