Creating Types (Structures) in a Script
Creating your own structures / classes are possible. These are called "Types" or "User Types" in FRED Basic Scripting environment.
A couple of examples are below:
'#Language "WWB-COM" Type Employee FirstName As String LastName As String Title As String Salary As Double End Type Sub Main Dim e As Employee e.FirstName = "John" e.LastName = "Doe" e.Title = "President" e.Salary = 100000 Debug.Print e.FirstName '"John" Debug.Print e.LastName '"Doe" Debug.Print e.Title '"President" Debug.Print e.Salary ' 100000 End Sub
A FRED Example which creates a custom set of raytrace configurations for a batch processing:
Option Explicit Type myConfig numRays As Double wavelength As Double isMonteCarlo As Boolean calcIrradiance As Boolean End Type Sub Main Dim allConfigs(2) As myConfig allConfigs(0).numRays = 100000 allConfigs(0).wavelength = 0.5 allConfigs(0).isMonteCarlo = True allConfigs(0).calcIrradiance = True allConfigs(1).numRays = 200000 allConfigs(1).wavelength = 0.6 allConfigs(1).isMonteCarlo = True allConfigs(1).calcIrradiance = True allConfigs(2).numRays = 300000 allConfigs(2).wavelength = 0.7 allConfigs(2).isMonteCarlo = True allConfigs(2).calcIrradiance = True 'a separate function that does these traces doRaytraceConfigs(allConfigs) End Sub