Stephen,
I wanted to let you know that this example you provided has gone a long
way to resolving some of my confusion regarding collections in general.
Specifically the classname example you provided. I was not aware of this
method. However, I'm more confused than ever about
SubComponent.ComponentCollection. I realize that it can be used as a
"subset"?(subcollection?) of either a selection object or collection
object, but I'm confused as to when is the most appropriate time to use
it. When does it provide advantage or even disadvantage in the parsing
of elements in a collection. For example, I have discovered that at 4,
and possibly more possibilities exist with
SubComponent.ComponentCollection. The following code illustrates this:
SelectObj("cube", null, true);
var oSel4 = Selection(0).ActivePrimitive.Geometry.Facets;
LogMessage(classname(oSel4(2).Edges(1).Points(0))); //Vertex
LogMessage(classname(oSel4(2).Edges(1).Points.SubComponent.ComponentCollection(0)));
//Vertex
LogMessage(classname(oSel4(2).Edges(1).SubComponent.ComponentCollection(0).Points(0)));
//Vertex
LogMessage(classname(oSel4(2).SubComponent.ComponentCollection(0).Edges(1).Points(0)));
//Vertex
What is the Subcomponent.ComponentCollection? The 3 examples of it all
do the same exact thing, at least they appear to anyway or appear to
return the same element. If I run SelectGeometryComponents on all 4
examples they all select the same exact point. And I'm not convinced
that these are all the possible combinations for isolating the point
element in item (0) of the vertex collection. So I guess what I'm really
wondering is wouldnt:
LogMessage(classname(oSel4(2).Edges(1).Points(0)));
be most efficient here? What advantage would there be to use the
component collection at this level? Is there a time when using the
component collection is unwarranted? Or am I missing the point?
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.
Stephen Blair wrote:
>
> Hi Joey
>
> In example 1, oColl(0) is a CollectionItem, whereas in example 2,
> oSelList(1) is a PolygonFace.
> A CollectionItem object does not have an Edges property.
>
> I've added some LogMessage calls to your examples, and fixed example 1
> to work.
>
> //1
> SelectObj("cube", null, true);
> var oColl = XSIFactory.CreateActiveXObject("XSI.Collection")
> oColl.AddItems(Selection(0).ActivePrimitive.Geometry.Facets);
>
> LogMessage( classname( oColl(0) ) );
> LogMessage( classname( oColl(0).Subcomponent ) );
>
> LogMessage ( oColl(0).Subcomponent.ComponentCollection.Count );
> LogMessage ( oColl(0).Subcomponent.ComponentCollection(0) );
>
> SelectGeometryComponents(oColl(1).Subcomponent.ComponentCollection(0).Ed
> ges);
>
> //2
> SelectObj("cube", null, true);
> var oSelList = Selection(0).ActivePrimitive.Geometry.Facets;
> LogMessage( classname( oSelList(1) ) );
> SelectGeometryComponents(oSelList(1).Edges);
>
> An XSICollection object is not the same as a FacetCollection object (or
> a PolygonFaceCollection object). They are distinct types of collections
> with different properties, methods, and implementation.
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi