Delete double segments in a spline - (Select Specific Knots & Delete)
Hi, i try to delete double segments in a spline:
i find knotPoints which have the same position, and try to get their Segment Idx & Knot Index to delete the segments
deleteKnot (shape) (spline_index_integer) (knot_index_integer)
... but i got stuck.
here is what i have so far (sry if it is stupid)
maybe someone can help me and give a little tip?
iam not realy good in scripting... still learning :)
Looking forward , best regards sno
clearlistener() theArray =#() pos =#() spl = selection[1] duplKnots =#() for s = 1 to (numsplines spl) do ( for k = 1 to (numknots spl s) do ( format "spline_%_knot_%_pos = %\n" s k (getKnotPoint spl s k) pos = getKnotPoint spl s k append theArray pos ) ) --- sucht nach doppelten vertices ( print "Before:" print theArray fn compareSubArrays first second = ( result = true if first.count != second.count then result = false else for i = 1 to first.count do if first[i] != second[i] do result = false result ) for i = 1 to theArray.count do ( for j = theArray.count to i+1 by -1 do ( --format "Comparing %:% to %:% \n" i theArray[i] j theArray[j] test = (compareSubArrays theArray[i] theArray[j]) if test do ( append duplKnots j deleteItem theArray j format"Deleting %\n"j ) )--end j loop )--end i loop print"After:" print theArray ) print duplKnots
--Now iam not sure whats the next step:
I tried in different version getting the index of the duplicates to specifiy which knots i want to delete - but without success.