## Twirling Iso curves

I recently made a quick script commonly used in 3D printed jewerly design for fun.

The function below will take a surface and parameters to get iso curves out of it.

To get the result you want, the input surface will have to be carefully modeled with consideration of direction of U and V on the surface.

As you can see in the script below, output curves will not exactly follow input surfaces as those are only approximated by creating curves from points on the surface.

Function getTwirlCrvs(isrf As surface, no_u As Integer, no_v As Integer, offset As Double) Dim returnpls As New list (Of polyline) Dim returncrvs As New list (Of curve) Dim ubtm As Double = isrf.Domain(0).Min Dim ulimit As Double = isrf.Domain(0).max Dim vbtm As Double = isrf.domain(1).min Dim vlimit As Double = isrf.domain(1).max For i As Integer = 0 To no_u Print("curve #" & i) Dim temppts As New list (Of point3d) For j As Integer = 0 To no_v Dim tempu As Double = i + (ulimit * offset * j) Dim tempv As Double = j Dim currentv As Double = vbtm + ((vlimit - vbtm) / no_v * tempv) Dim currentu As Double = ubtm + ((ulimit - ubtm)) / no_u * tempu currentu = doublediv(currentu, ulimit) If currentu < 0 Then currentu = ulimit + currentu End If Dim pt As point3d pt = isrf.PointAt(currentu, currentv) temppts.add(pt) Next Dim temppl As New polyline(temppts) Dim tempcrv As curve tempcrv = curve.CreateControlPointCurve(temppts, 3) returnpls.add(temppl) returncrvs.add(tempcrv) Next Return returncrvs End Function

**Categorised as:** Product

## Leave a Reply