On 12/07/2016 at 14:12, xxxxxxxx wrote:
Oh, damn!!! I can't select all at once.
I will have to select just two vertexes and change them to an edge selection. I already know how to do that.
But them I will have to add that selected edge to an empty list, building it, one by one.
I'm using this code, to build the selection list, but it is not selecting the correct edges
# initialize the neighbor structure
nbr=utils.Neighbor()
nbr.Init(op)
# get the BaseSelect of the point of the object
pointSel=op.GetPointS()
# get the BaseSelect of the edges of the object
edgesSel=op.GetEdgeS()
# make a copy of it and empty it
edges_final=edgesSel.GetClone()
edges_final.DeselectAll()
# go through all the list of vertexes
for i in points_list:
# get the two vertexes that define the edge
a1,b1=i[0],i[1]
# clear the point and edge selection of the object
pointSel.DeselectAll()
edgesSel.DeselectAll()
# select the two points
pointSel.Select(a2)
pointSel.Select(b2)
# print them...
# I checked that the vertexes are correct, but the wrong edges
# get selected at the end, not corresponding to the edges that
# are defined by the two points
print "%s - %s" % (a2,b2)
# convert the point selection to an edge selection
settings = c4d.BaseContainer()
settings.SetLong(c4d.MDATA_CONVERTSELECTION_LEFT,0)
settings.SetLong(c4d.MDATA_CONVERTSELECTION_RIGHT,1)
settings.SetLong(c4d.MDATA_CONVERTSELECTION_TOLERANT,False)
res = utils.SendModelingCommand(command = c4d.MCOMMAND_CONVERTSELECTION,
list = [op],
mode = c4d.MODELINGCOMMANDMODE_POINTSELECTION,
bc = settings,
doc = doc)
# mix this with the initially empty edge selection
# this should add the selection to an empty list,
# slowly building a complete list of selected edges.
edges_final.Merge(edgesSel)
# finally, select all the edges that should be in the edges_final list
# but the wrong edges get selected.
op.SetSelectedEdges(nbr,edges_final,c4d.EDGESELECTIONTYPE_SELECTION)