Eliminate duplicate curves (including reversed)?

You are probably right with the rounding @vanman , as the String representation of the value for start and end points only goes to 3DP, where as Curve.Length goes further into the decimal.

I might look at this unit issue in the morning and see if deconstruction of the line coordinates further changes anything. :+1:

1 Like

@vanman moving your added coded inside the Python node by adding the Length value ( as per the observation by @danail.momchilov :+1: ) to the String Curve representations should allow for better accuracy when identifying duplicate Curves.

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

## For removing duplicate Curves
def cleanLines(curves):
	C0 = []
	C1 = []
	for c in curves:
		sL = str(c.Length)
		sO = str(c)
		sR = str(Line.Reverse(c))
		# Added Length to allow for better accuracy identifying duplicates
		if sO+sL not in C1 and sR+sL not in C1:
			C0.append(c)
			C1.append(sO+sL)
			C1.append(sR+sL)
	return C0
	
OUT = cleanLines(IN[0])
3 Likes

to awesome. Thank you

Also duplicates can be cleaned with Bimorph nodes.

Thanks Vladimir, I tried Bimorphs node but it takes quite awhile or currently freezes the whole script and I need a shut down. Ewans is working quick as.

Interesting the returns I get. @Ewan_Opie less curves without the length included :thinking: :rofl: Pretty sure your orginal one is doing the job well and quick though thank you