Hello,
Last week I started learning XSI scripting. I've been attempting to
expand
my undersatnding of the OM and I've run into some issues that I can't
seem
to resolve. I want to select all the border edges in an object, but I
want
to do it with the object model. I know I can do it with a command using:
SelectAllUsingFilter("Border_Edge", siCheckComponentVisibility, null,
null);
on a selected object, however the point of this is to try and get a
broader
understanding of the object model. What I have at the moment is a cube
subdivided
4x4 with some holes in it, the first example of code I have is an object
to
component conversion:
//Select the object
SelectObj("cube", null, true);
//get a collection of all the edges on the selected object
var oSelList = Selection(0).ActivePrimitive.Geometry.Segments;
//select all edges in collection
SelectGeometryComponents(oSelList);
//set filter to border edges
var oFilter = Application.Filters("Border_Edge");
//create a new collection of only the border edges from the currently
selected edges
var oBEdges = oFilter.Subset( Application.Selection );
//select all of the filtered border edges in the collection
SelectGeometryComponents(oBEdges);
//This results in a selection of all border edges on the object
I would like to execute this by only using SelectGeometryComponents once
at the
end. As it stands I have to use the following to convert from an object
selection
to an edge collection to an edge selection to border edge collection:
var oSelList = Selection(0).ActivePrimitive.Geometry.Segments;
SelectGeometryComponents(oSelList);
var oFilter = Application.Filters("Border_Edge");
var oBEdges = oFilter.Subset( Application.Selection );
how can I shorten this to do it strictly in OM avoiding the use of
SelectGeometryComponents? For example the following fails giving me an
invalid argument error:
var oSelList = Selection(0).ActivePrimitive.Geometry.Segments;
var oFilter = Application.Filters("Border_Edge");
var oBEdges = oFilter.Subset( oSelList);
Why does Application.Selection work but not oSelList, don't they return
the same thing?
I want to get the OBedges collection without ever accessing a selection,
is that possible?
--------------------------
the second example of code I have is a component(edge) to
component(border edge)
conversion, two of the previously required steps which convert the
object selection
to an edge collection can be removed from this code since edges are
already selected:
//Select some edges on the cube
SelectGeometryComponents("cube.edge[26,27,30,39-44,52-57,65-69,89,90,93,94,97-103,122,130-135,164,166]");
//set filter to border edges
var oFilter = Application.Filters("Border_Edge");
//create a new collection of only the border edges from the currently
selected edges
var oBEdges = oFilter.Subset( Application.Selection );
//select all of the filtered border edges in the collection
SelectGeometryComponents(oBEdges);
//This results in a selection only the border edges defined in the
partial edge selection
this works fine however I want to modify it so I can filter border edges
from
a collection of polys instead of the object or edges. I tried:
SelectGeometryComponents("cube.poly[10-12,16-19,22-25,28-30,38,40,42,43,45-47,61,63,79]");
var oFilter = Application.Filters("Border_Edge");
var oBEdges = oFilter.Subset( Application.Selection );
But this doesnt work. Not that I am suprised much but I can't seem to
determine if there
is an OM method to convert a collection of polys into a collection of
edges like there was
for objects as in Selection(0).ActivePrimitive.Geometry.Segments. I
tried using ComponentCollection
but that didn t work either. I know I can do this with SelectAdjacent
command but again I'm trying
to do this with the OM. I'm sure this has to be easier than I am making
it.
--
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