RE: Scripting :VB - Checking for a Findchild error

Date : Mon, 11 Jun 2007 16:30:38 +0100
To : <XSI(at)Softimage.COM>
From : "Adam Seeley" <adam.seeley(at)clearpost.co.uk>
Subject : RE: Scripting :VB - Checking for a Findchild error
Hi,

This one seemed to work.

Although it needs "Nothing" instead of "Empty" it seems.

Ta chaps,

Adam.


> -----Original Message-----
> From: owner-xsi(at)Softimage.COM 
> [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Sebastian Faber
> Sent: 11 June 2007 10:43
> To: XSI(at)Softimage.COM
> Subject: RE: Scripting :VB - Checking for a Findchild error
> 
> Other solution:
> 
> on error resume next
> set oObj = dictionary.getobject(objFullname)
>     
> if typename( oObj ) <> "Empty" then
>    logmessage oObj.name & " exists!"
> end if
> err.clear
> 
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] 
> Im Auftrag von Julien Stiegler
> Gesendet: Montag, 11. Juni 2007 13:33
> An: XSI(at)Softimage.COM
> Betreff: Re: Scripting :VB - Checking for a Findchild error
> 
> if( Dictionary.GetObject(objFullname, false) ) //your code here
> 
> Adam Seeley wrote:
> 
> >Hi,
> >
> >Scripting some VB.
> >
> >I'm using FindChild to pick some objects out of my Scene, 
> trouble is I 
> >want
> to
> catch an error when an Object is not found.
> >
> >E.g. This works fine
> >''
> >CreatePrim "Cylinder", "MeshSurface", "mycyl"
> >set oObj = ActiveSceneRoot.FindChild("mycyl")
> >logmessage oObj.name
> >''
> >
> >
> >But *this* returns the error " Object required: 'oObj' "
> >''
> >set oObj = ActiveSceneRoot.FindChild("i_dont_exist")
> >logmessage oObj.name
> >''
> >
> >The "set" command works, but I can't check the contents as 
> it doesn't 
> >exist
> to
> access!
> >
> >I've tried this to catch the error but it always returns 
> False whether 
> >it
> exists or not.
> >''
> >logmessage IsNull(oObj)
> >
> >
> >Any pointers welcome,
> >
> >Thanks,
> >
> >Adam.

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.472 / Virus Database: 269.8.11 - Release Date: 06/06/2007 00:00
 

---
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.