Jump to content

Convert poly selection to edge selection

Recommended Posts

I'm trying to convert polygons to edges. Can someone tell me how to get edge id's?


import c4d
from c4d import utils

def main():
    nbr = utils.Neighbor()
    edges = c4d.BaseSelect()

    poly_count = op.GetPolygonCount()
    sel_polys = op.GetPolygonS()
    list_polys = sel_polys.GetAll(poly_count)
    for i in xrange(poly_count):
        if list_polys[i]:
            print "Poly at index %i is selected." % (i)

    op.SetSelectedEdges(nbr, edges, c4d.EDGESELECTIONTYPE_SELECTION)

if __name__=='__main__':


Share this post

Link to post
Share on other sites

Is this more of a practice on how to accomplish this?
Otherwise I'd suggest the use of the Convert Selection command.This can also be used via Python (MCOMMAND_CONVERTSELECTION) with SendModelingCommand().

By the way, are you aware of Plugin Café? There MAXON pays a team to answer questions like these and often the answer can already be found there right away.

Having said this, we (sorry, I didn't mean to MoClone myself, I was thinking of the community of this forum) could certainly also talk you through this here. The thing is, C4D doesn't really know the concept of an edge, there are only points/vertices and polygons. Edges are implicitly defined due to the order of points which form a polygon. The Neighbor class you are already using provides some helpers to make this a little easier. Yet, it's no one liner. Actually the docs of the Neighbor class already contain roughly the code you need in the description of GetPolygonInfo(). So, if this is more a learning thing, I'd suggest to start there.




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...