Split object by selection plugin?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  12 December 2017
Split object by selection plugin?

Guys,
Over the years there have been a few plugins for doing this... taking an object with selection tags and using those tags to split that object into multiple new objects.
None of the plugins that I've used in the past seem to work in R19.

Anyone know of any that do?
 
  12 December 2017
I save such script from Niklas Rosenstein
NR_Extract_from_Sel_s.py
import c4d

is_polyselection = lambda x: x.CheckType(c4d.Tpolygonselection)

def main():
 if not op or not op.CheckType(c4d.Opolygon):
 c4d.gui.MessageDialog('Please select a Polygon Object')
 
 selections = filter(is_polyselection, op.GetTags())
 if not selections:
 return

 result = []
 points = op.GetAllPoints()
 polys = op.GetAllPolygons()

 for tag in selections:
 sel = tag.GetBaseSelect()
 new_polys = []
 for i, v in enumerate(sel.GetAll(len(polys))):
 if not v:
 continue
 new_polys.append(polys[i])
 obj = c4d.PolygonObject(len(points), len(new_polys))
 obj.SetAllPoints(points)
 for i, p in enumerate(new_polys):
 obj.SetPolygon(i, p)
 obj.SetName('%s - %s' % (op.GetName(), tag.GetName()))
 c4d.utils.SendModelingCommand(c4d.MCOMMAND_OPTIMIZ  E, [obj])
 result.append(obj)

 root = None
 if len(result) == 1:
 root = result[0]
 else:
 root = c4d.BaseObject(c4d.Onull)
 root.SetName(op.GetName())
 for obj in result:
 obj.InsertUnderLast(root)

 doc.StartUndo()
 doc.InsertObject(root)
 doc.AddUndo(c4d.UNDOTYPE_NEW, root)
 doc.EndUndo()
 c4d.EventAdd()

if __name__ == '__main__':
 main()
 
  12 December 2017
You don't need any plugin :
Mesh > Conversion > Polygon groups to objects
 
  12 December 2017
Originally Posted by lenogre01: You don't need any plugin :
Mesh > Conversion > Polygon groups to objects
Hi, it does not work with object with selection tags

selection tags = new objects
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:23 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.