Offset, Perpendicular Line and Array Crv


I’m developing some Python scripts and I need help.
What I want to achieve is an script which will be a combination of Offset and ArrayCrv.
For better understanding I’ll describe the proccess in points.
The input is a planar curve.

  1. I want to offset this curve in two directions at once (at constant distances) (I have this part already done)
  2. I want to draw a perpendicular line on one of the end of input curve in the direction which has been pointed when selecting the offset direction.
  3. Then I want to ArrayCrv this perpendicular line whith constant number of items (input line is the path)

How can I achieve the points 2 and 3? Please give me some hints.

Also I have an additional question.
How to use a written script as a function, I mean not by loading it every time with the RunPythonScript function.

You are not showing what you have, but you could use this and that. (1.4 KB)
That’s what I have for the moment.
So. Is my approach sensible?
To draw a perpendicular line on the end of selected line, first I have to find it’s end with for example CurveStartPoint, then draw a line with AddLine, but I need to calculate EndPoint somehow. (what’s the easiest way to find this point?)
Then (if there is no ArrayCrv method in RhinoScript) I could divide the input curve and repeat the proccess on each part.

And then you are just drawing a line at every point given by PointAt()

Ok, but I want to write it in Python. Are there equivalents of those metods?
And how to draw a perpendicular line to curve?

This is generally how it’s done. But it’s in GH… (3.4 KB)