Page 1 of 1

Sketch curve transition between two other curves

Posted: Tue Aug 27, 2024 3:54 pm
by laukejas
Hi,

Sometimes in SW I need to get a parametric 2D sketch curve that is exactly in the middle between two other curves:

Image

This bit is easy enough, I typically draw another sketch, convert the curves, close them off, make an extruded boss, and add draft to the side walls. The edge formed by the tip of the prism is the mid-curve I'm looking for, which can then be converted:

Image

Image

Image

Image

You probably know this trick, it is easy enough.

However, sometimes I need something different - a mid curve that doesn't stay in the middle, but transitions from the end of one curve to the end of the other curve. Something like this (drawn freehand, very approximately):

Image

The idea is that this should be like a gradually varying offset that takes both curves into account. The goal is to have a very smooth and gradual transition, meaning that the "thickness" between one of the original curves and the new curve is linear, without any irregularities.

I can't think of a way to achieve this in an easy and parametric way, something like that mid-curve example. The only (bad) way I can think of is to draw tons of perpendicular lines, with points on them to guide the new curve, spaced equally through tons of equations, looking something like this...

Image

...and then draw a spline on these points. But this is extremely time consuming to set up, and the final curve will not be accurate, just an approximation that highly depends on how many points I create.

Can anyone suggest an easier and accurate way to get this transitioning curve between two other curves? Attaching this sample file (saved in SW 2022).

Re: Sketch curve transition between two other curves

Posted: Tue Aug 27, 2024 4:33 pm
by laukejas
P.S. While searching for a solution, I came up with an easier way to do the mid-curve: instead of making boss-extrude and draft, you can do a surface sweep with a profile sketch that consists of two lines that are equal and perpendicular, and their ends pierce the original curves:

Image

Then in Surface Sweep, select one line as the edge, the second one as guide curve:

Image

And again, this creates an edge that can be converted back into the desired plane.

Image

This doesn't solve the issue of transitioning curve, but I have a feeling that Sweep might be somehow able to do the transition as well, not just a mid-curve. But so far I can't figure out how to do it. Still, posting this, maybe it will give you some ideas.

Re: Sketch curve transition between two other curves

Posted: Tue Aug 27, 2024 6:27 pm
by laukejas
Here is another idea I tried... So I was thinking of doing a surface sweep of a single line, where this line would rotate by 90° along the sweep path, and also get shorter:

Image

So I built an intricate profile sketch that rotates that line and adjusts it's length depending on the distance between the original curves...

Image

Which results in a sweep like this, and it's gets edge converted...

Image

But as you can see the transition of the final curve is not linear, it starts off too aggressive and feathers in way too soon at the other end.

Image

This is probably because the rotation of the line is driven through a circle, and basically follows a sine gradient. I admit I am terrible at trigonometry, I basically eyeballed this solution since I don't know how to drive the rotation of that line in a linear gradient that would (probably) result in a curve I need.

Still, attaching this attempt, maybe you have some ideas on how to make it work? Or is there a simpler way?

Re: Sketch curve transition between two other curves

Posted: Thu Aug 29, 2024 2:31 pm
by Tim Hoover
I was able to get a smooth curve by using a loft instead of a sweep. Equal length vertical and horizontal lines at each end,
image.png
image.png
And use the original curves for guide curves.
image.png
I have no idea how "exact" this is...
image.png

Re: Sketch curve transition between two other curves

Posted: Thu Aug 29, 2024 3:46 pm
by DanPihlaja
You can get a curve @ 50% on a face, if you use face curves.

(but not on a planar surface. If all the sketch entities are all on the same plane, then you have to use filled surface for face curves to work)
image.png
image.png
You can also vary the percentage and put one at 20% if you want.

Re: Sketch curve transition between two other curves

Posted: Thu Aug 29, 2024 3:48 pm
by DanPihlaja
In addition to the 50% curve on a face curve, you can also use the "mesh" option and put as many equidistant curves as you want.
image.png

Re: Sketch curve transition between two other curves

Posted: Fri Aug 30, 2024 2:42 am
by laukejas
DanPihlaja wrote: Thu Aug 29, 2024 3:46 pm You can get a curve @ 50% on a face, if you use face curves.

(but not on a planar surface. If all the sketch entities are all on the same plane, then you have to use filled surface for face curves to work)

image.png

image.png

You can also vary the percentage and put one at 20% if you want.
Thank you for the suggestion, this is a good idea for that regular mid curve, or a percentage off from the middle. But like I said, my main question is how to do a transitioning curve, that starts off at 0% at one end, and gradually transitions to 100% at the other end, like in the last picture of my first post.
Tim Hoover wrote: Thu Aug 29, 2024 2:31 pm I was able to get a smooth curve by using a loft instead of a sweep. Equal length vertical and horizontal lines at each end,

image.png

image.png

And use the original curves for guide curves.

image.png

I have no idea how "exact" this is...

image.png
Damn, this does look quite good actually! I was so hung up on Sweep that I forgot to consider a simple Loft. It doesn't provide much control over the final curve, but the more I think about it, the more it seems that the logic of how Loft generates geometry should be exactly what is needed in this case. Thank you very much!!

Re: Sketch curve transition between two other curves

Posted: Fri Aug 30, 2024 6:16 am
by laukejas
Tim Hoover wrote: Thu Aug 29, 2024 2:31 pm I was able to get a smooth curve by using a loft instead of a sweep. Equal length vertical and horizontal lines at each end,

image.png

image.png

And use the original curves for guide curves.

image.png

I have no idea how "exact" this is...

image.png
Update: I tested this more thoroughly, and although your method worked for that initial example I showed, I tried a more complex set of curves, and unfortunately it doesn't seem to hold up (unless I set it up wrong):

Image

Attaching the file, could you check if I set it up correctly, or did I miss something?

Re: Sketch curve transition between two other curves

Posted: Fri Aug 30, 2024 8:24 am
by Tim Hoover
Your example is starting and ending on the same curve. But even if I modify the sketch the "mid curve" intersects with the other 2 curves, so that does not solve the problem.

I am definitely out of my depth now...

Re: Sketch curve transition between two other curves

Posted: Fri Aug 30, 2024 2:04 pm
by laukejas
Tim Hoover wrote: Fri Aug 30, 2024 8:24 am Your example is starting and ending on the same curve. But even if I modify the sketch the "mid curve" intersects with the other 2 curves, so that does not solve the problem.

I am definitely out of my depth now...
Oh, sorry, I missed that in a hurry to reply before the end of my shift. But yeah, even fixing that doesn't solve the issue. I am not sure why.

Re: Sketch curve transition between two other curves

Posted: Fri Aug 30, 2024 10:49 pm
by Dennis Bacon
Do you think there is any validity to the following? I majored in mathematics but that was a long, long, time ago so I didn't attempt any math on this. Your file is a future version for me so I took a pic of it then sketched over a sketch picture. I went with the face curves on a very shallow sweep. Thinking the shallower the better in order to get the traversing elements. Then put a planar lofted surface over the top. Sketched on that surface, convert and segment (points).. The theory being it would give me a percentage of each element. 8 elements with 8 points each. As the curve progressed from one corner to the other (diagonally) it would move from point to point. The curve was achieved using "Curve Through Reference Points"
image.png
image.png
image.png
image.png

Re: Sketch curve transition between two other curves

Posted: Sat Aug 31, 2024 4:13 am
by laukejas
Dennis Bacon wrote: Fri Aug 30, 2024 10:49 pm Do you think there is any validity to the following? I majored in mathematics but that was a long, long, time ago so I didn't attempt any math on this. Your file is a future version for me so I took a pic of it then sketched over a sketch picture. I went with the face curves on a very shallow sweep. Thinking the shallower the better in order to get the traversing elements. Then put a planar lofted surface over the top. Sketched on that surface, convert and segment (points).. The theory being it would give me a percentage of each element. 8 elements with 8 points each. As the curve progressed from one corner to the other (diagonally) it would move from point to point. The curve was achieved using "Curve Through Reference Points"image.pngimage.pngimage.pngimage.png
Thank you, that is an interesting solution! But it still has the issues I mentioned in my first post, that any curve based on points highly depends on the number of these points (in this case the number of face curves), so if the initial curves are more extreme in their change of curvature, you would need a lot of face curves to get a good approximation, and that's a lot of work. Another issue is that once face curves are created, they can't be modified - can't add more of them (shifting the already existing ones), move the existing ones, or repair references if they get broken.

Still, your method is a lot better than the one I thought of (doing the same with equations).

EDIT:

I tested this method on a set of more complex curves, and had some interesting findings:

1. Face curves highly depends on the initial mesh that was used to generate the reference surface between the curves. Also, Sweep often falls short of one of the curves, not following it to the end:

Image

So the face curves, converted lines and the final spline look like this:

Image

Not so great.

2. Using Loft instead of Sweep, and then doing Face Curves results in a very different layout:

Image

As you can see, it's very unevenly spaced, so I didn't pursue this further. Unfortunately Loft does not allow adding connectors in this case to fix this.

3. Using Boundary instead results in probably the most even layout and smooth final spline:

Image

However even here we can see that the lines are not spaced evenly, so having the same number of these lines and points on them (in this example I did 13 lines and 13 points) might result in a bad proportion.

I suppose with gentle initial curves that are similar this method would get a close-enough result (but still with the downsides of being non-editable and non-repairable), but mathematically it is still just an approximation, and as we can see with more complex curves it is not very accurate.

I feel we are getting close. Thank you all who already suggested these great ideas, and hope you have some more :)

Re: Sketch curve transition between two other curves

Posted: Sun Sep 01, 2024 9:02 pm
by Dennis Bacon
You hoped for it you got it (whether you like it or not). I will try this on your more wonky part someday soon. As I said before your file is a future version for me so I traced it from a sketch picture. This one I did a bit different. Used a surface loft with .005" (don't know what your units are) deep arcs on both ends with guide curves. Did a face curve on that. Converted those to a planar surface. Had an equal number of up down and side to side curves. Did a new sketch and with a point connected the intersections from right to left in descending order. had to have enough intersections so that the points would straddle the sharpest curve.
image.png
image.png
image.png
image.png

Re: Sketch curve transition between two other curves

Posted: Thu Sep 05, 2024 11:35 am
by laukejas
Dennis Bacon wrote: Sun Sep 01, 2024 9:02 pm You hoped for it you got it (whether you like it or not). I will try this on your more wonky part someday soon. As I said before your file is a future version for me so I traced it from a sketch picture. This one I did a bit different. Used a surface loft with .005" (don't know what your units are) deep arcs on both ends with guide curves. Did a face curve on that. Converted those to a planar surface. Had an equal number of up down and side to side curves. Did a new sketch and with a point connected the intersections from right to left in descending order. had to have enough intersections so that the points would straddle the sharpest curve. image.png image.png image.pngimage.png
Sorry I couldn't make a file that you could open, my SW 2024 will only allow to save as far back as 2022. Could you please upload the .sldprt solution you showed in this pics? I am not entirely sure I understood it.

Re: Sketch curve transition between two other curves

Posted: Thu Sep 05, 2024 12:31 pm
by Dennis Bacon
The complex one (Wonky Donkey)) is done with a surface loft with 4 profiles ached .010". Probably could have placed them more more beneficially.
Twisted Mutha.SLDPRT
(574.8 KiB) Downloaded 64 times
Wonky Donkey.SLDPRT
(790.63 KiB) Downloaded 65 times

Re: Sketch curve transition between two other curves

Posted: Thu Sep 05, 2024 1:01 pm
by laukejas
Dennis Bacon wrote: Thu Sep 05, 2024 12:31 pm The complex one (Wonky Donkey)) is done with a surface loft with 4 profiles ached .010". Probably could have placed them more more beneficially. Twisted Mutha.SLDPRTWonky Donkey.SLDPRT
Thank you, I appreciate the effort you put into this. The final curve you got is indeed pretty close to my intent. But like i said, there are the issues of editability and repairability, and this is still quite a lot of work to get that curve (and repair it if references get broken). I will keep this solution in mind, but hopefully we can come up with something more automated and robust as well.

Re: Sketch curve transition between two other curves

Posted: Thu Sep 05, 2024 1:44 pm
by Dennis Bacon
I figured as much.. The good is,, I learned a thing or two along the way. All good and better luck with this.