Spin Edge

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:

Hi Rui,

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().

For the edge selection you will want to use PolygonObject::SetSelectedEdges(), see also BaseSelect and Neighbor class. Just for completeness, in C++ there's also the SelectionChanger class.

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.

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   
# get the BaseSelect of the point of the object   
# get the BaseSelect of the edges of the object   
# make a copy of it and empty it   
# go through all the list of vertexes   
for i in points_list:   
    # get the two vertexes that define the edge   
    # clear the point and edge selection of the object   
    # select the two points   
    # 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()   
    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.   
# finally, select all the edges that should be in the edges_final list   
# but the wrong edges get selected.   

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:

  c4d.CallCommand(16351) # Edges  
  c4d.CallCommand(440000044, 440000044)