Frames acting unpredictably on curve

I’m trying to make a simple script for creating string lighting. The script takes a straight polyline, creates catenary curves (with straight sections using Kangaroo) and then arranges a series of bulbs (created within the script) along the wire at fixed internals.

The frame component act unpredictably, sometimes working in parallel with the curve, sometimes flipping or orientated incorrectly. See below for a video of the script in action, which shows the frames (and thus lights flipping depending on the depth of the wire), plus showing incorrect orientation (they should be facing perpendicular to the wire’s direction, which they don’t).

Could anyone help with creating aligned base points for the light bulb geometry?

Ps. I’ve tried this with Grasshoppers built in catenary function, though the same problem also occurs.


fairylights.gh (19.3 KB)

Here’s something without Kangaroo.


fairylights-b.gh (19.9 KB)

Thank you! It works well. I’ve added some random rotations to the lamps.

I also added text and flags as an alternatives to the lights :slight_smile:

All three scripts take a base poly line as a starting point. I hope it’s useful for someone!

string-lights-text-flags.gh (37.3 KB)

You can use tangents and a Z vector to define the planes instead of relying on the orientation of perpendicular frames.

fairylights.gh (26.0 KB)

I would start a little different however. The lights are at fixed positions so it’s one cable with lights. Not two segments with divisions. The cable is fixed at the end points and to an anchor point somewhere in between.

I had to reset the solver once after moving an end point.

fairylights_mrtn.gh (24.7 KB)

PS: Maybe someone else can explain the logic behind the orientation of perpendicular planes on lines and curves?

perp_frame.gh (18.2 KB)

1 Like

With a continuous curve you can use the The Frenet –Serret formulas to get the tangent, normal and binormal at a point; maybe Rhino uses this with nurbs and arcs to get consistent perp frames. In the case above, the catenary is really a polyline, so you’re basically evaluating discontinuous line segments unrelated to their neighbors except by end points. That’s why I couldn’t use perp frames here.

1 Like