Reconstruct complex non planar curve with precise radius

Let me start saying that I’m just starting with Grasshopper, so the steps I took are probably not very clean, so any help in optimizing the process is very welcome (and please be clement whith what I did :sweat_smile:).

A bit of context: I have to take a piece of art that is made by a bended tube, divide it into sections and send it to the factory, that will take straight tubes and bend them in the shape I need. The problem is that they can bend the tubes in only one fixed axis, and the art piece has sections that are bended in more than one axis.

The Structure
I created a structure that takes a curve as input, divides it into sections and allows me to flatten and manipulate the radius in every section. this is the way I structured it:

  1. Take curve, divide it into sections (with a number slider, so I can decide the precision). I actually divided the curve, and then create single curves to work on them, and have a number slider to choose on which section of the curve I want to work.

  2. I create a plane from 3 points: starting point, end point and the chosen point on the curve where I want to manipulate the curvature.

  3. I use a Curvature component to find the radius on the precise point I want, and extract its center point. From that I can manipulate the position of this center point (x,y) and the radius of a circle, created from this center point.

  4. I create tangent lines from the 2 boundary points to the circle. I tried to use Trim to create a final curve, but it was not working, so I used the circle to manipulate the tangent lines, and then created the final curve using an Arc between the tangent lines.

  5. After all this, I saw that I actually wasn’t able to recreate the curve, because I cannot swap the new modified section with the old one on the curve list. So I used a Data Recorder with a stream gate and a boolean, so when I was done modifying the curve, I would change the boolean from false to True to save the curve on the data stream, and then tur it to false again and go work on a new section.

  6. The final piece of the puzzle is a simple pipe and boolean to create a tube from the final curve.

The problems: There are some unsolved problems on the file that I’ll be working on, mostly safegards, like "what happens when the tangent becomes null, etc (but feel free to offer solutions to any issue you find on the file, as they can be better and help me improve)

Main problem 1: The initial idea was that I could take this curve and modify it, seeing the result in real time. What I achieve with this is to see in real time one section of the curve being modified, but I can’t see how it impacts the rest. I only see the result of the pieces of curves that I “save” on the Data Recorder. Is there a way to do it using the lists?

Main Problem 2: As I cannot see the hole end result, Sometimes I get sharp corners between sections, as I’m modifying single segments and not the whole curve. That could be solved maybe if I was able to see the whole new curve while modifying a segment, or, maybe the approach is wrong and I should think about working on the tangents of the starting and end point, so the connection between the tubes is always smooth.

I hope I explained it well. This is my first grasshopper project, so I have a bit of a knot in my head, and it’s probably visible on how I structured the file:

Pipes.gh (49.1 KB)

Every help is welcome. Thanks!

Not enough time now to do check this now, but have a suggestion, what could speed up the proces:
You say:
“The problem is that they can bend the tubes in only one fixed axis”

You could cut the curve in pieces, and check if the section is planar.
If yes, then the curve has one axis.
Maybe they can only bend in one direction? If so, you have to check the planar curve with curvature (as you did) to find where the curve goes the otherway.

Below a quick thing to check if a part of the curve is planar.
It seems you have to accept/choose a deviation from “flat” to consider it “one axis”.
I used galagagos to quickly find a setting what could work.


Pipes_curve_flat?.gh (23.3 KB)

Thank you for the fast answer. I stumbled on something like this in a much less “clean” way. On one of the iterations that I did, I would take create the circle from the curve radius, and then create the tangents to the upper and lower points, and I was always getting erros because I couldnt find (manually) the points where the circle was planar with the 2 points.

On another iteration (the first of all), the idea was to find max and mins on the curve, and create circles connecting them, but I was not able to find the precise points. I found some of them, but not all, so I moved to something closer to what I have now.

Anyways, I saw the file and understood how it works. I’ll see if I can understand better how it could help me, and I’ll check some of the components (specially galagagos), because I didn’t know about some of them.

Just as an example, if someone wants a more immediate example, this is the type of curves I’m working with:

Hi @CarlosFilho,

I bet I’m not grasping the problem here, plus I’m no expert :slight_smile:

So, given tihs:

May I ask what is the ‘hole end result’ here? A rebuilt curve that’s as close as possible to the original ‘complex’ curve but ensuring all the segments are planar and then find or fit a circle they can exist on? *Does it matter how big this circle is per segment?

Does this mean the original curve is allowed to change ‘aspect’ slightly while still keeping its overall shape?

A rebuilt curve that’s as close as possible to the original ‘complex’ curve but ensuring all the segments are planar and then find or fit a circle they can exist on?

Does this mean the original curve is allowed to change ‘aspect’ slightly while still keeping its overall shape?

Well, I think you explained better than myself :sweat_smile:

That’s exactly it. The new curve is allowed to change it’s original aspect, but should stay as close to the original as possible.

The circles are needed because the factory can bend a single tube with a precise radius, so each segment can contain a single planar curve that has a single radius.

So, If I take the original curve, I would have to rebuild it through circles, so every segment has a precise radius, and the final curve is as similar as possible to the original ones.

I get pretty close with what I did, but as I segmented the problem to work on small pieces, at the end I’m able to manipulate the radius of the segments, but as output I get the single segments (that often intersect with sharp angles instead of a smooth curve), and not a smooth curve, mostly because I was not able to rebuild the curve swapping the old segments with the new ones.

Wedon’t need to stick to what I did. If you understand the problem and think of a better way to face it it would help also. I’ve been doing it by myself researching commands on internet, so any other input would be of great help :grinning_face_with_smiling_eyes:

Does it matter how many segments you end up with? Is there an economizing factor for the amount of pieces you want? I think maybe because you were deciding how many points to rebuild the curve with…

For example, and apologies if this is silly, here just by using discontinuity and then forming polyarcs? Technically the curve is ‘rebuilt’.

All 447 segments are planar and can be joined back into a single curve.

Ah, that’s very interesting. I’ll check polyarcs. 447 segments are a bit much though :rofl:

I added a number slider to add a bit more precision to where I could cut the curve. the biggest tube height is of about 9 meters. The number of divisions depends a bit on how the tube is bended, and there’S also a minimum size that the factory can work with. I don’t remember precisely now, but I wouldn’t go under 40cm segments. I think for this one, manually I was able to divide it il around 16 pieces (This is also the most complex curve, the other ones are a bit simpler).

As I was not able to find precise points automatically, I added the sliders so I could move through the curve and find where fhe radius would represent it better.

This is key info, of course - good thing my bet was I didn’t grasp the problem :wink:

Maybe that or multiple methods out there of dividing curve into workable arcs - or looking into dividing based on curvature.

1 Like

Ok, Thank you very much :+1: