If you wish to hook into a specific object by name, rather than using a variable such as the Selection object, you can do this in a number of ways:
// ===========================================================
// 1) FindChild Method (if no child is found, returns NULL)
var obj = ActiveSceneRoot.FindChild('crvlist1')
if(obj){
LogMessage(obj)
}
else{
LogMessage('No object found')
}
// ===========================================================
// 2) Populate an empty XSICollection (if no obj exists, collection remains empty)
var coll = new ActiveXObject('XSI.Collection')
coll.items = 'crvlist1'
if(coll.count){
obj = coll(0)
LogMessage(obj)
}
else{
LogMessage('No object found')
}
// ===========================================================
// 3) GetObject Method (this will raise an error if the object does not exist, so you might want to try/catch)
var obj = GetObject('crvlist1')
if(obj){
LogMessage(obj)
}
else{
LogMessage('No object found')
}
> -------Original Message-------
> Hello,
> I'm trying to get the distance along a path/curve that a specific knot
> lies. I can do this via:
>
> percentage =
> Selection(0).ActivePrimitive.Geometry.Curves(0).GetPercentageFromU(3.0)
>
>
> This will effectively return the U distance between the start and end of
> the curve for the 4th knot of the curve.
>
>
> However, I'd like to be able to do this by defining the specific curve
> without using the selection Object, something like:
>
> percentage = crvlist1.GetPercentageFromU(3.0);
>
>
> but this does not work. Is there a way to accomplish this, preferrably
> using the OM?
>
> --
>
> 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.
> ---
> 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