RE: OM scripting

Date : Fri, 14 Apr 2006 12:50:38 -0400
To : <XSI(at)Softimage.COM>
From : "Stephen Blair" <Stephen_Blair(at)Softimage.COM>
Subject : RE: OM scripting
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.


-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
Of Joey Ponthieux
Sent: April 13, 2006 6:35 PM
To: XSI(at)Softimage.COM
Subject: Re: OM scripting


Stephen,
	Thanks, this worked perfecly for my oFilter.Subset input,
however I am now more confused than ever. I have two pieces of code that
are supposed to select all the edges of a particular facet, one works,
one doesnt, they are:


//1.DOES NOT WORK
SelectObj("cube", null, true);
var oColl = XSIFactory.CreateActiveXObject("XSI.Collection")
oColl.AddItems(Selection(0).ActivePrimitive.Geometry.Facets);
SelectGeometryComponents(oColl(0).Edges);

//2.WORKS
SelectObj("cube", null, true);
var oSelList = Selection(0).ActivePrimitive.Geometry.Facets;
SelectGeometryComponents(oSelList(1).Edges);



If Selection(0).ActivePrimitive.Geometry.Facets is a facet collection,
how does it differ from an XSI Collection? In this case it would seem
that the XSI Collection is being passed to SelectGeometryComponents in
example 1 and a Facet Collection is being sent to
SelectGeometryComponents in example 2. Why would the XSI Collection work
in the case of filter.subset but not here?  


-- 

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
> 
> Instead of messing about with the selection, just get all the edges
into
> a collection and then filter the collection.
> 
> Here's an example, but with polygons and the Quad filter:
> 
> var oCone = ActiveSceneRoot.AddGeometry("Cone","MeshSurface");
> var oPolygons = oCone.ActivePrimitive.Geometry.Polygons;
> 
> var oColl = XSIFactory.CreateActiveXObject("XSI.Collection");
> oColl.AddItems(oPolygons);
> LogMessage( oColl.Count );
> 
> var oFilter = Application.Filters("Quad");
> var oQuads = oFilter.Subset( oColl );
> LogMessage( oQuads.Count );
> 
> Also
> 
> Application.Selection is a Selection object
> Selection(0).ActivePrimitive.Geometry.Segments is a SegmentCollection
> 
> that's why you get the error
>
---
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

  • Follow-Ups:

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.