The image shows some curves from which a set of surfaces were created. The resulting polysurface had a tiny naked edge at the junction arrowed, fixed it up by adjusting the grip points - the question, is there a method to check if a set of grip points are coincident within the system tolerance?
i´ve not been aware of a built in command which does this, but below script might help to check if selected control points (grips) are within your absolute unit tolerance:
Option Explicit ' Check if selected grips are within tolerance Call CheckGripsWithinTolerance() Sub CheckGripsWithinTolerance() Dim arrG, i, j, d, dblTol, intCheck arrG = Rhino.GetObjectGrips("Select grips", True, True) If Not IsArray(arrG) Then Exit Sub If UBound(arrG) <= 0 Then Exit Sub dblTol = Rhino.UnitAbsoluteTolerance() intCheck = 0 For i = 0 To UBound(arrG) - 1 For j = i + 1 To UBound(arrG) d = Rhino.Distance(arrG(i)(2), arrG(j)(2)) If d > dblTol Then intCheck = intCheck + 1 Next Next If intCheck > 0 Then Rhino.Print "Selected grips are out of tolerance" Else Rhino.Print "Selected grips are within tolerance" End If End Sub
Alternatively, this script might be suited for your task as well. It checks if the selected controlpoints are within tolerance and only if they are not, it uses _SetPoint and relocates them to their average centerpoint. Note that if two or more controlpoints from the same object are selected, it does not care and will set them as well. For both scripts, at least two controlpoints have to be selected.
Hi Brian- If you turn on control points for all of the curves, window select the end points and SetPt in X,Y,Z, you can slam them all together in one shot.
Thanks Pascal, that’s exactly what I figured out after posting, also good if the points need to end up in a specific location - I used a temporary circle to locate the points in this case.
@clement, Your scripts are just great, the checking one will be really useful and time-saving confirming grips are together before creating the surfs and the other is a very elegant, one-click way of bringing the points together if needs be …
thanks Brian, i´ve just updated the last script to act a bit more clever when coincident grips are found. eg. if 2 or more curves are ending in one endpoint and only one is not, the coincident grips are preserved instead of the average. So only the grip which is off will be changed.
You can as well control the possible case when multiple coincident grips are found, eg. 2 curves end in one point and another 2 curves end in a different coincident point. If you use post-selection of the grips, the first found coincident point is the point which is set to.
Excellent, thanks Clement. I’ve renamed your 2nd version of the script here, as I see a need for both methods, that’s 3 new buttons…