On 10/07/2016 at 17:47, xxxxxxxx wrote:
I have two points indexes, that define an edge.
How can I perform the Spin Edge command in that edge?
Must I select the edge first? If yes, how.
Is there and command for Spin Edge in the SendModelingCommand command?
I didn't found any.
On 11/07/2016 at 09:21, xxxxxxxx wrote:
the Spin Edge command is a normal command to be called via CallCommand() not a modeling command.
Unfortunately there's no define for its ID, but you can get the ID from the "Customize Commands..." dialog. In this case the ID is 440000044.
So you will have to select the object and edges and then use CallCommand().
In these threads you find some code on that topic, using the above mentioned classes (although not the final solution). Unfortunately both threads are for C++ SDK, but I think, you'll get the idea:
edge selection -> points
Iterate through all Edges of PolygonObject
Another option could to use SendModelingCommand() with MCOMMAND_CONVERTSELECTION.
I hope this helps.
Edit: Sorry, in a first version, I posted links into C++ docs. Sorry, for the confusion.
On 11/07/2016 at 18:32, xxxxxxxx wrote:
Thank you, Andreas.
I went the MCOMMAND_CONVERTSELECTION way
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,i # 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)
On 12/07/2016 at 14:16, xxxxxxxx wrote:
Ok, ok... replaced the last line with:
and it worked
On 14/07/2016 at 04:54, xxxxxxxx wrote:
This information could be useful also to anyone.
I'm performing a Spin Edge command at the end.
And, since this command only works in Edge mode, it is necessary to change to this mode before executing the command.
Something like this:
old_mode=doc.GetMode() c4d.CallCommand(16351) # Edges c4d.CallCommand(440000044, 440000044) doc.SetMode(old_mode)