Strange, for me
dictionary.getobject(objFullname)
requieres a second boolean parameter == false to avoid non-existant object
error... :
dictionary.getobject(objFullname, False)
but maybe VB and jscript are different on that point ?
Also make sure you use obj.FullName and not obj.Name when working with models
and children
Adam Seeley wrote:
>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
>
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi