Hi Tudor, the problem in your script there is this part:
> .getTopLevelObjects() -> object itself
All the " getXXXXX()" methods on an object list do are filtering mechanisms, they make a new list that only contains the given types that are already present in the current list.
So if you had an object list with 2 objects in it, an edge and a brep, when you call getTopLevelObjects() it would return a list with just the brep in it, that's the only top level object currently in the list.
If you have an object list with just one edge in it, calling getTopLevelObjects() on it will return an empty list because there are no top level objects directly in the list currently.
You need to instead do something like this:
var objs = moi.geometryDatabase.getSelectedObjects(); if ( objs.numEdges == 1 ) { var edge = objs.item(0); var edges = edge.getParentBRep().getEdges(); moi.ui.alert( edges.length); }
So get the edge object, call getParentBRep() on it to get the parent brep, then call getEdges() on that.
- Michael
|