Yet another change to the Python shortcuts



To fix it so that the 2012 Python shortcuts would work in 2013 SP1, we did an Undo on the changes to the siutils module. So now, scripts that use the 2012 siutils shortcuts will work unchanged in 2013 SP1.

We moved all the changes [which included some bug fixes] to a new module named sipyutils. When you use the Syntax Help in the 2013 SP1 script editor, you’ll get these shortcuts:

#
# Softimage 2013 SP1 shortcuts
#
from sipyutils import si		# win32com.client.Dispatch('XSI.Application')
from sipyutils import siut		# win32com.client.Dispatch('XSI.Utils')
from sipyutils import siui		# win32com.client.Dispatch('XSI.UIToolkit')
from sipyutils import simath	# win32com.client.Dispatch('XSI.Math')
from sipyutils import log		# LogMessage
from sipyutils import disp		# win32com.client.Dispatch
from sipyutils import C			# win32com.client.constants
from sipyutils import logf

si = si()
logf( "Version %s has %d commands", si.Version(), si.Commands.Count )

Note that you get an si shortcut that is a function, so you have to call it to get the actual XSIApplication object.

In summary:

  • 2012 shortcuts work unchanged in 2013 SP1
  • 2013 shortcuts won’t work in 2013 SP1. This line will give you an error:

    si = si()					# win32com.client.Dispatch('XSI.Application')
    

    You have to either comment that line out, or edit siutils and uncomment the definition of si(). Or just switch to using the new sipyutils shortcuts.

  • 2013 SP1 shortcuts come from the new sipyutils module. The si shortcut is a function, call the function and bind the result to an identifier eg si = si().

For reference, here’s the shortcuts from previous versions:

#
# 2013 shortcuts
#
from siutils import si
si = si()					# win32com.client.Dispatch('XSI.Application')
from siutils import log		# LogMessage
from siutils import disp	# win32com.client.Dispatch
from siutils import C		# win32com.client.constants
#
# 2012 shortcuts
#
from siutils import si		# Application
from siutils import sidesk	# Desktop
from siutils import sidict	# Dictionary
from siutils import sifact	# XSIFactory
from siutils import simath	# XSIMath
from siutils import siproj	# ActiveProject2
from siutils import sisel	# Selection
from siutils import siuitk	# XSIUIToolkit
from siutils import siut	# XSIUtils
from siutils import log		# LogMessage
from siutils import disp	# win32com.client.Dispatch
from siutils import C		# win32com.client.constants

2 thoughts on “Yet another change to the Python shortcuts

    • Use the new sipyutils module to avoid that mem leak problem.
      AFAIK if you use the old shortcuts, you could still hit that memory leak issue.

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 )

Google+ photo

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

Connecting to %s