Disabling command logging temporarily


From the curiosity drawer. This python snippet uses “v1.5 command” functionality from back in the day to disable command logging for a specific command invocation.

from siutils import si		# Application
from siutils import log		# LogMessage
from siutils import disp	# win32com.client.Dispatch
from siutils import C		# win32com.client.constants


sClassID = "{19085F81-CDD6-471C-9CA1-7C7F4F2A0166}"

# This command is logged
si.FindObjects( "", sClassID )

log( "--------------------------" )
# Get the command and disable logging
oCmd = si.Commands("Find Objects")
oCmd.SetFlag( C.siNoLogging, True )
 
# Not allowed to update existing commands with Update()
# so we have to manually set arguments and execute the command
oCmd.Arguments(0).Value = ""
oCmd.Arguments(1).Value = sClassID

oICETrees = oCmd.Execute();    # Execute - nothing logged
for t in oICETrees:
	log( t.FullName )
log( "--------------------------" )
 
# This still is logged, no need to reset flag because we never updated the command
si.FindObjects( "", sClassID )

The typical way to [temporarily] disable command logging is by setting the cmdlog preference:

Application.Preferences.SetPreferenceValue( "scripting.cmdlog", False )
Application.CreatePrim("Cone", "MeshSurface", "", "")

Softimage resets the pref automatically.

You could use a Python decorator to do this.

4 thoughts on “Disabling command logging temporarily

  1. It being from the “curiosity drawer”, does this mean it doesn’t work anymore or could be done more easily. This post leaves some questions unanswered… 😉

    • The typical way to [temporarily] disable command logging is by setting the cmdlog preference:

      Application.Preferences.SetPreferenceValue( “scripting.cmdlog”, False )
      Application.CreatePrim(“Cone”, “MeshSurface”, “”, “”)
      [/python]

      Softimage resets the pref automatically.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s