DelayedRefresh

Introduced

5.0

Description

Redraws the 3D viewports when the script is done executing and control has returned to the application. Calling this command multiple times will only produce a single redraw after the script execution.

Note: This is different from Refresh which redraws the scene immediately when it is called.

Scripting Syntax

DelayedRefresh( [Time] )

Parameters

Parameter

Type

Description

Time

Double

Frame at which to refresh

Default Value: Current frame

Examples

VBScript Example

'
' This example demonstrates the effect of the DelayedRefresh command by creating a few objects and 
' then translating them with delayed refresh calls after each step.
'

NewScene , false

' Set up some variables and constants to start
Set oSmarmy = CreateObject( "XSI.Collection" )
iDisplacement = 0
Const MAX_ARMY = 19

' This is just a utility loop that makes it easier adding a lot of elements to the scene
For i = 0 To 19
   ' Make a new soldier and add it to the army
   Set oSoldier = ActiveSceneRoot.AddNull()
   oSmarmy.Add oSoldier

   ' Get the array of position values for the soldier
   aPos = Array( oSoldier.posx.Value, oSoldier.posy.Value, oSoldier.posz.Value )

   ' If we've already made half the army, position them in one direction
   If i >= (MAX_ARMY/2) Then
       oSoldier.posx.Value = aPos(0) + iDisplacement 
       oSoldier.posy.Value = aPos(1) + iDisplacement 
       oSoldier.posz.Value = aPos(2) + iDisplacement 
   Else
       oSoldier.posx.Value = aPos(0) - iDisplacement 
       oSoldier.posy.Value = aPos(1) - iDisplacement 
       oSoldier.posz.Value = aPos(2) - iDisplacement 
   End If

   ' When we're half done, we need to reset the displacement counter 
   If iDisplacement = CInt(MAX_ARMY/2) Then
       iDisplacement = 0.1
   Else
       iDisplacement = iDisplacement + 0.2
   End If
Next

' Now that our army is built, let's move them towards us a set at a time for a few steps.
' (Only the end result will be displayed)
move3Steps oSmarmy

sub move3Steps( in_collection )
   ' Local settings
   iStep = 0.25
   Const STEP_LIMIT = 30

   ' First clear the selection (just in case we get unwanted members)
   Selection.Clear

   ' Then set the selection according to the collection members specified 
   Selection.SetAsText in_collection.GetAsText

   ' Now we can move everything at one (using a loop to make it easier)
   For j = 0 To STEP_LIMIT
       Translate , , , +iStep
       DelayedRefresh
   Next
end sub

See Also

Refresh



Autodesk Softimage v7.5