On 06/01/2018 at 18:59, xxxxxxxx wrote:
Hello Plugincafe! :)
With this python generator, I want to remove short segments of a spline.
In line 17 I'm exploding spline into segments and in line 30 I'm trying to delete short segments but seems like I'm doing something wrong.
minLength = op[c4d.ID_USERDATA,1] #User defined Minimum lenght
for i in xrange(pcount) :
pointA = spline.GetPoint(spline.GetPointCount()-i-1)
pointB = spline.GetPoint(spline.GetPointCount()-i-2)
direction = (pointB - pointA)
distance = direction.GetLength()
if distance == 0:
continue
elif distance < minLength:
sel.Select(spline.GetPointCount()-i-1)
sel.Select(spline.GetPointCount()-i-2)
res = utils.SendModelingCommand(command = c4d.MCOMMAND_DELETE,list=[spline],mode=c4d.MODELINGCOMMANDMODE_POINTSELECTION,doc=doc)
sel.DeselectAll()