Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
Getting Application object in Python

Getting Application object in Python

2005-03-28       - By Bernard Lebel

 Back
Reply:     1     2  

The issue was brought up not later than... today!

import win32com
Application = win32.client.Dispatch( 'XSI.Application' )
xsi = Application.application

xsi.logmessage( 'hello!' )
xsi.logmessage( xsi.classname( xsi.selection(0) ) )



Setting module globals never really worked well for me, so instead I
instantiate the Application object in every module I import.


Cheers
Bernard



Luke Emrose wrote:
> Hi there,
>
> I think from memory that this may have been discussed before but I
> cannot remember if a solution was ever found.
>
> At the moment in Python, if I use modules I have to pass in the
> Application object from the main piece of code in order for everything
> to work as expected.
>
> Originally I thought I could use:
>
> *    from win32com import client
>     ap = client.Dispatch('XSI.Application')*
>
> which for most things seems to work, but for some strange reason doesn't
> seem to work for the ClassName and GetValue commands.
>
> At the moment this is driving me nutz, as I have a very large module
> library for a large tool I'm building and for some stupid reason if I
> have to pass in the Application object to an object more than two levels
> deep it stops working (i.e, *module1.module2.module3.ap = Application*
> doesn't work but *module1.module2.ap = Application* does, huh!!!!).
>
> Surely there is an easier and foolproof way to get the Application
> object without having to pass it in from one place (which sucks),
> especially since this is completely painless in every other language
> that is supported (i.e. C++, JavaScript and VBScript).
>
> thanks,
>
> Luke


---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi