Archive for March 4th, 2005



Tired of LogMessage?

March 4th, 2005 by Patrick Boucher. Viewed 1766 times.

OK…

1
Application.LogMessage("Whatever")

Am I tired of writing this in my XSI Python scripts you think? In Python, variables are basically pointers to the actual object and everything in Python is an object, functions included… Hmmm…
Try using this at the top of your python scripts:

1
2
xsi = Application
pr = xsi.__getattr__("LogMessage")

Now you can do:

1
2
xsi.Whatever(attrib)
pr(whatever.Property)

instead of

1
2
Application.Whatever(attrib)
Application.LogMessage(whatever.Property)

All of this with absolute minimal [...]

Python’s win32com and XSI

March 4th, 2005 by Patrick Boucher. Viewed 2974 times.

So I”m tinkering with Python inside XSI and I”m noticing a lot of people talking about win32com and constants. Some of these people are using these items, often puting import statements at the top of their Python files, without necessarilly understanding why. For those who wish to understand why, here’’s my stab at an explanation.