Orient Object to the Curve Normal

Hello Community ! Happy Holidays to you all! Well, please take a look at the script provided. I have an object and the object has front and a back. The front will be identified as the pyramids top and the back would be the base. In my script I’d like the objects front to always face the curve normal and stay on the point which I can move it up and down another curve. I hope that is enough information.

Orinet Object On Point Facing Normal.gh (16.9 KB)

I’ve found a resolution. Once I’ve completed the script I will share.

To help you a bit:

A Brep is a mini database (so to speak) with vertices, edges and faces. So there’s 9 conn trees possible for these 3 classes of objects. Like (Note: 2 dim trees shown since we are talking Brep Lists - first dim is the Brep index in the List):

Conn trees are collections of type int (for indices). Let’s stick to the FF (face to face) and VF (vertex to face) trees. A pyramid “top” vertex index is the one in VF where the item (indices) count is faces.Count-1 . A pyramid base index is the one in FF where the item (indices) count is faces.Count -1.

So your “orient/pyramid axis” is a Line from base (BrepFace to Brep) center to top. You can obviously move center (center = line.PointAt(t)). So there’s a (from) perp Plane (center, line.Direction). The curve defines a (to) Plane from some crv point and the Normal.

So … a plane to plane Transformation is defined.

Update:

Found 5 minutes for a test C# (and some random pyramids) using the conn Trees mentioned above. Spot the obvious: if the Pyramid is a tetrahedron (i.e. 4 Faces) … there’s no way to tell what is the top/bottom pair (unless there’s rules for the base Face) so all combos are picked.

2 Likes

Wow ! This is very different from what I was looking for and a bit more complicated. However it is an interesting concept and has lead me to explore something more. I love this community. It helps so much toward learning and investigating the potential of grasshopper. Thank You!

For this particular case you may mean the potential of coding (less than 5 minutes job).