Re: So why won't this conditional work?

Date : Wed, 19 Apr 2006 12:27:03 -0400
To : XSI(at)Softimage.COM
From : Joey Ponthieux <j.g.ponthieux(at)LaRC.NASA.GOV>
Subject : Re: So why won't this conditional work?
Stephen Blair wrote:
> 
> To compare testA and testB, which are both SubComponents, you could use
> the IsEqualTo method.
> 
> Point, Vertex, and Edge objects also support IsEqualTo.
> 

That did the trick nicely, Thanks!
Joey



> Testing Index is comparing integer values. Two vertices on two distinct
> objects can have the same index value.
> 
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
> Of Joey Ponthieux
> Sent: April 19, 2006 12:00 PM
> To: XSI(at)Softimage.COM
> Subject: Re: So why won't this conditional work?
> 
> Ok, I follow this as it is pretty much what I was expecting might be the
> case. So then the question is what is the most reliable way to
> de-reference the components I am trying to match. While I've got years
> of experience with Perl, I have absolutely no experience with Jscript.
> Would you convert the content of the reference to a string then use
> regex, or is there a simpler method. I note that Ian's example using
> .Index does work, but would any two elements from two separate objects
> with the same index match or is the Index also providing a backtrace to
> the object or origination. In other words is the conditional just
> testing the integer represented by the index or the actual element? My
> thinking is that it is only testing the integer value of the Index,
> correct? Therefore any two elements which happen to have the same index
> could fool the conditional into providing a true return value.
> 
> Joey
> 
> Stephen Blair wrote:
> >
> > Hi Joey
> >
> > Because you are comparing objects.
> > In most cases, when you get an object you are getting a reference, or
> > handle, to the corresponding XSI object.
> >
> > If you have two references to the same object, those references are
> > not equal.
> >
> > Example:
> >
> > var o1 = Dictionary.GetObject( "cube" ); var o2 =
> > Dictionary.GetObject( "cube" ); LogMessage( o1 == o2 );
> >
> > -----Original Message-----
> > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > Behalf Of Joey Ponthieux
> > Sent: April 19, 2006 10:37 AM
> > To: xsi(at)Softimage.COM
> > Subject: So why won't this conditional work?
> >
> > var oCube = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" ); var
> > oGeometry = oCube.ActivePrimitive.Geometry; var oEdge =
> > oGeometry.Polygons(0).Edges(1); var oPolyNeighbors =
> > oEdge.NeighborPolygons(1); var oPolyVerts =
> > oPolyNeighbors(0).NeighborVertices(1);
> > var oEdgeVerts = oEdge.NeighborVertices(1);
> >
> > var testA = oPolyVerts(2).SubComponent; var testB =
> > oEdgeVerts(1).SubComponent;
> >
> > //What they look like
> > LogMessage (oPolyVerts(2));
> > LogMessage (oEdgeVerts(1));
> > LogMessage (testA);
> > LogMessage (testB);
> >
> > //test it even further, both select the same exact point
> > SelectGeometryComponents(oPolyVerts(2));        //"cube.pnt[3]"
> > SelectGeometryComponents(oEdgeVerts(1));        //"cube.pnt[3]"
> >
> > //but these conditionals fail
> > if( oPolyVerts(2) == oEdgeVerts(1) ){           //would this be a bad
> > test even
> > if the conditional worked
> >         LogMessage("hello");                    //I expext it is
> testing
> > if Vertex == Vertex
> >
> > }else if (eval(oPolyVerts(2)) == eval(oEdgeVerts(1)) ){ //same results
> 
> > as above,
> >         LogMessage("world")                             //still no joy
> > on the condition
> >
> > }else if (testA == testB ){             //this would be a better test,
> > but still
> > why does this fail
> >         LogMessage("foo")
> >
> > }else{
> >         LogMessage("Why won't this work?") }
> >
> > --
> >
> > 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
> 
> --
> 
> 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

-- 

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


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.