Go to: Synopsis. Return value. Related. Flags. Python examples.
refresh([currentView=boolean], [fileExtension=string], [filename=string], [force=boolean], [suspend=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
refresh is undoable, NOT queryable, and NOT editable.
This command is used to force a redraw during script execution. Normally, redraw is suspended while scripts are executing but sometimes it is useful to show intermediate results for purposes such as capturing images from the screen.If the -cv flag is specified, then only the current active view is redrawn.
None
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
currentView(cv)
|
boolean
|
![]() |
||
|
||||
fileExtension(fe)
|
string
|
![]() |
||
|
||||
filename(fn)
|
string
|
![]() |
||
|
||||
force(f)
|
boolean
|
![]() |
||
|
||||
suspend(su)
|
boolean
|
![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds cmds.refresh() # The refresh command can also be used to take a snapshot of the current scene view and # save it as an image file. See example below. import maya.cmds as cmds # Set up workspace for images in current project ws = cmds.workspace(q = True, fullName = True) wsp = ws + "/" + "images" cmds.sysFile(wsp, makeDir=True) # Prepare unique image name for snapshot imageSnapshot = wsp + "/" + "endSnapshot.jpg" # Take a snapshot of the viewport and save to file cmds.refresh(cv=True, fe = "jpg", fn = imageSnapshot)