Re: Old vbscript error

Date : Mon, 29 Oct 2007 12:37:34 -0700
To : XSI(at)Softimage.COM
From : "Gene Crucean" <emailgeneonthelist(at)gmail.com>
Subject : Re: Old vbscript error
Gravy. Thanks Stephen.



On 10/29/07, Stephen Blair <Stephen_Blair(at)softimage.com> wrote:
In the last for loop, change the addtoselection line to this:

addtoselection item.value

 
It seems like 6.02 and later don't like it when you add a CollectionItem to the selection list.
 


From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Gene Crucean
Sent: Mon 29 October 2007 2:37 PM
To: XSI(at)Softimage.COM
Subject: Old vbscript error

Can anyone spot a reason this script would cause 6.02 to error out? It's an old script Graham wrote (2003) that's on the netview. It converts instances to dup's.



Set oCollection = CreateObject( "XSI.Collection" )
Set oColl = CreateObject("XSI.Collection")
set osel = application.Selection

for i = 0 to osel.count-1
    oCollection.add osel(i)
next

for i = 0 to oCollection.count-1
    if oCollection(i).type = "#model" then
        if oCollection(i).Children.count > 0 then
            On Error Resume Next
            set instlist = GetInstances(oCollection(i))    
            'for each inst in oCollection(i).Groups(0).members 'not used experiment
            'logmessage inst
            'next
            logmessage "instances "& GetInstances(oCollection(i))    
            if (Err.Number = 0) then
            for j = 0 to instlist.count-1
                set dupe = Duplicate ("B:"&oCollection(i))
                MatchTransform dupe, instlist(j), siSRT
                if instlist(j).parent <> "Scene_Root" then    
                    ParentObj instlist(j).parent, dupe
                end if
                if instlist(j).IsAnimated( siAnySource ) = True then
                    CopyAllAnimation2 instlist(j), siAnySource, siAllParam, False
                    PasteAllAnimation dupe
                end if
                oColl.Add dupe
            next
        end if
    end if
    if oCollection(i).Children.count <= 0 then
        set master = GetMaster(oCollection(i))
        set dupe = duplicate("B:"&master)
        MatchTransform dupe, oCollection(i), siSRT
        if oCollection(i).parent <> "Scene_Root" then    
            ParentObj oCollection(i).parent, dupe
        end if
        if oCollection(i).IsAnimated( siAnySource ) = True then
            CopyAllAnimation2 oCollection(i), siAnySource, siAllParam, False
            PasteAllAnimation dupe
        end if
        oColl.Add dupe
    end if
end if
next
DeselectAll
for each item in oColl
    addtoselection item
next



After you run it... it gives me this error pretty much when I click on anything.


' ERROR : 21000-SELE-SelectObj - Unspecified failure
SelectObj "Model_Name_Was_Here", , True






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.