RE: [scripting:python] external access to XSI

Date : Wed, 3 Jan 2007 08:36:07 -0000
To : <XSI(at)Softimage.COM>
From : "Kim Aldis" <XSI(at)kim-aldis.co.uk>
Subject : RE: [scripting:python] external access to XSI

Expect, which this is but using Python instead of the horrible Tcl, is pure brilliance but it only handles keyboard input, not graphical. It was great because it would cope quite happily with things like FTP that you couldn’t drive using pipes and input redirect.

 

 Last year when I was desperately flailing around for something to renderfarm Vue that would actually work,  I found quite a few quite neat things for more general gui input. I’ve lost the links now but I think there were at least a couple for Perl and one from Microsoft that looked most interesting. The grand-daddy of them all, harping back to early Mac days, is Quickkeys from cesoft.

 

From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Steven Caron
Sent: 03 January 2007 02:19
To: XSI(at)Softimage.COM
Subject: Re: [scripting:python] external access to XSI

 

so i was talking with a guy at imageworks a few months back and he was telling me about some python module they were using to control houdini and maya. then this thread came up... then the mention of XSIServer example in C#, then kim's xsi-blog post about how to do it in python...

well here is a module that may come in handy for greg and others..

http://pexpect.sourceforge.net/

"Pexpect makes Python a better tool for controlling other applications.

Pexpect is a pure Python module for spawning child applications; controlling them; and responding to expected patterns in their output. Pexpect works like Don Libes' Expect. Pexpect allows your script to spawn a child application and control it as if a human were typing commands.

Pexpect can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup scripts for duplicating software package installations on different servers. It can be used for automated software testing. Pexpect is in the spirit of Don Libes' Expect, but Pexpect is pure Python. Unlike other Expect-like modules for Python, Pexpect does not require TCL or Expect nor does it require C extensions to be compiled. It should work on any platform that supports the standard Python pty module. The Pexpect interface was designed to be easy to use."


enjoy!
steven

On 12/29/06, Joey Ponthieux < j.g.ponthieux(at)larc.nasa.gov> wrote:

Yes, I've got experience with this. A couple of years ago we were
attempting to to import flight data of aircraft landing at a terminal. I
had position and attitude data and was attempting to import that into a
Maya scene. After numerous attempts trying to convert the data via a
Maya move file, I instead imported via the command port. Basically I had
too many aircraft to process the move files easily. I was able to
automate the whole process outside of Maya, process the data standards
conversion, import the external data into maya, generate the
connections, keyframes, etc, via command port. It worked really well,
.....and I got to use Perl to script my Maya scene instead of
MEL...Muwhahahahaa! In fact everything was automated straight from the
perl script I wrote, just start Maya, open the command port, write the
perl script with a port connection to Maya, and execute.

In the case of Maya I found it most useful because there are things you
just can't do well with MEL if they aren't directly tied to a MEL
function or Maya command. This is more to do with the fact MEL is
lacking decent regex tools and is not useful for anything not directly
associated with Maya. XSI doesn't exactly suffer the same restriction
because you have so many different language options for scripting. As
long as you can draw the data into your scripting session, you really
don't need to be outside of the application to get use of a decent
programming language. However, if you are trying to coordinate data back
and forth between two applications using perl or python to synchronize
between say Maya and XSI or XSI and some other scientific visualization
app, having a command port available in XSI would be quite useful.

Joey Ponthieux
NCI Information Systems Inc.
NASA Langley research Center
____________________________________________________________
Opinions stated here-in are strictly those of the author and
do not represent the opinions of NASA or any other party.



Ben Barker wrote:
> That sounds pretty cool. Anyone have experience using Maya's
> commandPort in production (or something similar) and care to share any
> thoughts? Seems like you could do some pretty useful things, besides
> sending X rated geometry to Graham's workstation during reviews.
>
> On 12/29/06, Luc-Eric Rousseau <lucer(at)softimage.com> wrote:
>>
>>
>> Well basically it's not possible to call scripting functions from
>> outside of
>> XSI,
>> because that means calling functions across two processes, and we don't
>> expose a socket port for scripting.
>>
>> So what that XSI 6.0 sample does is implement a server in XSI that
>> listens
>> to a network socket.  Then, outside of XSI you send scripting
>> commands to
>> that
>> socket which are then executed in XSI.
>>
>> This could be used for example to force an update of a plug-in while
>> users
>> are running XSI.
>>
>>
>> -----Original Message-----
>> From: Kim Aldis
>>
>> Interesting -and useful - example but wouldn't it have been easier to
>> do the
>> same thing using only a few lines of Python or Perl code?
>>
>> > -----Original Message-----
>> > From: Stephen Blair
>> >
>> > Hi
>> >
>> > If you have XSI 6, take a look at the XSIServer example in the SDK
>> > example workgroup.
>> >
>> > Steve
>> >
>> > -----Original Message-----
>> > From: Greg Smith
>> >
>> > I was curious if it was possible to run a script outside of XSI that
>> > could control some aspect inside XSI. The simplest thing I would like
>> > to do is to invoke a XSIUIToolbox.Msgbox pop up inside xsi from an
>> > external script using string data collected from outside of xsi.
>> >
>> > Just Curious
>> >
>> > Greg
>>
>
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi

 


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.