91
Sample Code
Here is a simple example showing how to render an adjustable Sun-cycle study using the plugin's animation capability
through RhinoScript:
Option Explicit
Sub Maxwell_SunStudy()
Dim Maxwell
' create the ScriptObject
Set Maxwell = CreateObject("Maxwell.Script.ScriptObject")
' successfully created?
If Maxwell Is Nothing Then
Rhino.Print("Unable to create Maxwell.Script.ScriptObject.")
Exit Sub
End If
' successfully connected?
If Not Maxwell.IsConnected Then
Rhino.Print("Unable to connect to the current Maxwell scene.")
Exit Sub
End If
' enable sun and set physical sky active
Maxwell.Environment.SunEnabled = True
Maxwell.Environment.EnvironmentType = "PhysicalSky"
' no objects will move, so cache meshes
Maxwell.PluginOptions.CacheMXSMeshes = True
' loop vars
Dim endTime, frameLength
' set start time
Maxwell.DateAndTime.TimeOfDay = 7
' set end time
endTime = 19.5
' set frame interval
frameLength = 0.1
' activate the plugin's animation loop
Maxwell.Rendering.BeginAnimation()
' loop
While Maxwell.DateAndTime.TimeOfDay < endTime
' increment
Maxwell.DateAndTime.TimeOfDay = Maxwell.DateAndTime.TimeOfDay + frameLength
' write frame to disk
Maxwell.Rendering.RenderToMxs()
Wend
' done
Maxwell.Rendering.EndAnimation()
End Sub
Maxwell_SunStudy
Comentários a estes Manuais