# Script for perpendicular lines in defined points

Dear colleagues,
Can somebody create small script, which generates perpendicular lines 5mm long (or 10mm long in case of midpoint line) in exact defined points with direction inwards the closed curve.
Basically it is one simple closed curve with 15 - 40 points on it. Till now I generated these lines manually. So I’ve got idea if this operation can be scripted.

Small explanation: The curve represents flattened shape of automotive (car) glass, the generated lines are engraved and all this is 2D checking fixture (gauge) for production lines.
Thanks

Can you post a sample model (e.g. 3dm file) of what you are looking for?

Hi!

Because I have always believed that is good first to try by yourself I will explain you my logic to solve this. Give it a try in GH.

1. Take your points and calculate the closest point to the curve from those points (we are looking for the parameter at the curve here).
2. Evaluate the curve at the obtained parameters.
3. Try to think about a vector operation that with a constant vector (this only work “well” if the curve is flat) and the tangent vectors obtained evaluating the curve is going to give you your inward vector. TIP: the operation name starts with “Cross”.
4. Use SDL component in GH to create your curves using the vectors obtained in step 3.

Step 3 could be done in other different ways but I like this general way to control the direction of your resultant vectors.

Cheers.

Thank you Dale.
Here is the file, on the left is “before” and on the right is “after”. Although this “glass” is 10 years old I removed all sensitive informations due to restrictive condition in automotive industry.
test_file.igs (121.9 KB)

Here is a script you can start with. Just drag & drop the attachment on top of a running Rhino. Then run `AddCurvatureHair`.