cgmFuncCls


Description:

When creating functions there are several things that are common to many functions:

  • Validate arguments/kws — sometimes you can just run try/excepts but with complicated functions it is helpful to make sure you have the appropriate data before staring a process that will fail 2 minutes in with the wrong info
  • Catch and report exceptions and errors
  • Execute steps
  • Time functions/steps
  • Get useful information when things fail
  • Progress bars
  • Logger handling — it’s rather annoying having to set the logging level per python module. By having functions pass through here, when we set logging level to debug in cgmGeneral, every function that pass through there will get that logging level
  • Connects to maya’s reporting level for exceptions
  • Get Help

Instead of doing many or all of these things in lots of functions separately, the idea was for a class from which subfunctions could inherit a solid function set and improvements on that set down the road rather than editing many functions.

Superclass : None
Subclass:  many
Location: cgm.core.cgm_General.cgmFuncCls

It’s kinda hard to wrap one’s head around so we’ll look at some examples…

Example 1

Example 2

Example 3


 
Creative Commons License

Categories