3D animation,rigging,coding, math ,fun stuff welcome !

mobu_toggleGrid.py

"""
Copyright (C) 2009 Rick Fronek
melvin.3d@gmail.com
gridToggle.py
Python Script File
MODIFY THIS AT YOUR OWN RISK
Update Date: Jan 08 2010
Description:
Very simple script that toggles the grid on/off .
Map the script to one of the 12 ActionScript shortcuts.
or execute from python editor or drag and drop and then
execute. Choice is yours.
"""
#------------------------------------------------------------------------------------------------------------
def rf_gridToggle(fFarPlane, bShowGrid):
     '''
     This function sets the farPlaneDistance and grid on/off
     fFarPlane = float number in units. ex. [5000]
     bShowGrig = boolean on/off to turn the grid
     '''
     # must import the module before you start working...
     from pyfbsdk import FBSystem
     # get all scenes elements and store it
     myScene = FBSystem().Scene
     # get cams from the scene
     myCams = myScene.Cameras
     # look each cam and set what you need.
         for cam in myCams:
         print cam.Name
     # set the backplate to soemthing better than default
     cam.FarPlaneDistance = fFarPlane
     # set the nearPlane to 1.0
     cam.NearPlaneDistance = 1.0
     # check if the grid is set to tru or false
     if bShowGrid == 1:
          # set grid to 0
          cam.ViewShowGrid = False
     else:
     # set grid to 1
         cam.ViewShowGrid = True
#-------------------------------------------------END--------------------------------------------------#
# run function
rf_gridToggle(5000,0)