*On 07/05/2013 at 03:18, ***xxxxxxxx** wrote:

Hi ello,

here, some example code quickly plucked together.

```
import c4d
class Tag(c4d.plugins.TagData) :
SIZE_SPHERE = c4d.Vector(10)
COLOR_SPHERE = c4d.Vector(1, 0.66, 0.02)
LENGTH_TANGENT = 20
COLOR_TANGENT = c4d.Vector(0.1, 0.95, 0.5)
def Draw(self, tag, op, bd, bh) :
if not isinstance(op, c4d.SplineObject) :
return True
bd.SetMatrix_Matrix(op, op.GetMg())
segments = [op.GetSegment(i) for i in xrange(op.GetSegmentCount())]
if not segments:
segments = [{'cnt': op.GetPointCount(), 'closed': op.IsClosed()}]
pi = 0
for segment in segments:
cnt = segment['cnt']
closed = segment['closed']
start = pi
end = pi + cnt
i_start = start
i_end = end
if not closed:
i_start += 1
i_end -= 1
bd.DrawSphere(op.GetPoint(pi), self.SIZE_SPHERE, self.COLOR_SPHERE, 0)
bd.DrawSphere(op.GetPoint(pi + cnt - 1), self.SIZE_SPHERE, self.COLOR_SPHERE, 0)
bd.SetPen(self.COLOR_TANGENT)
if start < end:
for i in xrange(i_start, i_end, 1) :
left = i - 1
right = i + 1
if left < start:
left = end - 1
if right >= end:
right = start
print left, i, right
pleft = op.GetPoint(left)
pright = op.GetPoint(right)
point = op.GetPoint(i)
mid = (pleft + pright) * 0.5
bv = point - mid
n = bv.Cross(point - pleft)
tangent = n.Cross(bv).GetNormalized() * self.LENGTH_TANGENT
pmin = point - tangent
pmax = point + tangent
bd.DrawLine(pmin, pmax, 0)
pi += cnt
print "-------------------"
return True
if __name__ == "__main__":
c4d.plugins.RegisterTagPlugin(100003, "Spline Tangents", c4d.TAG_VISIBLE, Tag, "Tsplinetangents", None)
```

Best,

-Niklas

http://www.file-upload.net/download-7562607/spline-tangents.zip.html