Hi,

I’d like to generate a drag knife toolpath using python/grasshopper.

It basically comes down to this:

For each point on a line (with the distance of the points approaching 0), IF continuous, offset this point in the direction of the tangent by the distance the drag knife is from the centre. With all these points combined, you should get a new curve.

However, if it isn’t continuous, it should make a circle segment, with the radius being the distance the drag knife is from the centre.

Here is an illustration of what i mean:

Further down the road i’d also like to export this to gcode.

This is what i’ve written so far (or well, found it in a video) :

import rhinoscriptsyntax as rs

class TanLines:

def **init** (self, INcurve, INnumOfDivs):

self.curve = INcurve

self.numOfDivs = INnumOfDivs

```
def tanPoints(self):
doms = rs.CurveDomain(self.curve)
minDom = doms[0]
maxDom = doms[1]
for i in range(0, 30):
param = (maxDom-minDom)/30 * i
pt = rs.EvaluateCurve(self.curve, param)
tan = rs.CurveTangent(self.curve, param)
tanPt = rs.VectorAdd(tan, pt)
rs.AddLine(pt, tanPt)
curve = rs.GetObject("Select a curve")
obj = TanLines(curve, rs.GetReal("number", 30, 0, 100))
obj.tanPoints();
```

Kind regards,

Thomas