Rs.AddPolyline not culling duplicate points as per Help


#1

I notice that the Python rhinoscriptsyntax does not automatically cull duplicate points as the Help indicates (Help which was copied over from VB essentially), if consecutive duplicates are found, the method fails. If non-consecutive duplicates are found, it does create a polyline (albeit potentially a problematic one)…

I notice that the syntax for rs.AddPolyline does not call cull duplicates (Point3d.CullDuplicates Method) nor does rs.coerce3dpointlist; so as it is coded now, I guess behavior is expected… However, CullDuplicates cullls ALL duplicates, not just consecutive ones, so this is a bit different than culling consecutive ones…

Just a heads-up… Either the Help needs to be changed or the method needs a bit of tweaking…

–Mitch

Fails:

import rhinoscriptsyntax as rs
pointlist=[]
for i in range(10):
    pointlist.append(rs.coerce3dpoint((i,i,i)))
    pointlist.append(rs.coerce3dpoint((i,i,i)))
rs.AddPolyline(pointlist)

Succeeds, but not a good idea…

import rhinoscriptsyntax as rs
pointlist=[]
for i in range(10):
    pointlist.append(rs.coerce3dpoint((i,i,i)))
    pointlist.append(rs.coerce3dpoint((i+1,i+1,i+1)))
    pointlist.append(rs.coerce3dpoint((i,i,i)))
rs.AddPolyline(pointlist)

Better…

import rhinoscriptsyntax as rs
pointlist=[]
for i in range(10):
    pointlist.append(rs.coerce3dpoint((i,i,i)))
    pointlist.append(rs.coerce3dpoint((i+1,i+1,i+1)))
    pointlist.append(rs.coerce3dpoint((i,i,i)))
    pointlist=rs.CullDuplicatePoints(pointlist)
rs.AddPolyline(pointlist)

(Dale Fugier) #2

Added to the pile - thanks.

– Dale


(Steve Baer) #3

This should be fixed in SR9