Start a new topic

Selecting the bottom edges of an object

I am trying to use the API script to select the bottom edges of a model and then to run the close holes tool. I have it working except once i run thte close holes tool half of the selected edges do not seem to be getting used. 


If I do this in the creator modeling environment is works fine (select the bottom edges, deselect the extras that I don't need, then run close holes)


but this process doesn't translate well in the API script. I am using an mgFind to grab the vertices then filtering them out based on z height. then looping through them and selecting the edges with mgSelectOneEdge, I can't seem to figure out the way to deselect the extras after this. but even without doing so the close holes tool seems to miss half the edges that are selected.


any help would be great....



I see a few options:


You can change the code to do a mgWalk of polygons, then loop over all children in the polygons to find any edges where both vertices are at the correct level and select only them. Then you would not have any extra to de-select. (assuming you mgDeslectAll at the beginning of the script)


Or you could mgWalk with walk vertices on. Then look at each vertex and it's mgNext vertex (special care is needed for the last vertex, if there is no mgNext, then the first child of the parent is the first.) Same logic though, if both vertices are at the desired height you can mgSelect that edge.


If you don't want to throw out your existing code, you can mgDeselectAll, then loop over your list and select only edges that meet your criteria. Each vertex will either have a mgNext vertex, or a parent with a first child to make an edge to test.

Walking through with MWALK_VERTEX is already what I am doing. It works for the most part, then I go through that list and make a reclist of the verts below a threshold value. then loop through that reclist while calling select one edge. The biggest issue i am having is that the Close Holes tool seems to ignore half the selected edges leaving a final polygon that is only half the size it should be. weirdly doing the same thing but using the modeling environment works without issue. 

Ok, I misunderstand your procedure. You mentioned you were using mgFind. I assumed you were selecting every vertex as an edge as long as the vertex is at the correct elevation. The comment about deselecting the 'extra' edges is what led me to believe this. Having extra edges can confuse the close holes algorithm.


Can you share your script?


Login to post a comment