Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Options

How can you smoothly connect two circles on different planes with a tube?

christopher_brettchristopher_brett Member Posts: 17
edited April 8 in Using Onshape
How can you smoothly connect two circles on different planes with a tube? The tube must have constant diameter along its length. The tube must be the shortest possible (i.e. a straight tube with curved connections on either end).

I'm aware of "3D fit spline", which you could use to join the centres of the two circles and then sweep, however this will give the whole thing a curve (though you can fiddle with the curve with magnitudes). This uses more material than ideal, and is a little more awkward to 3D print. I want a straight tube with curved connections at either end instead.

Loft is also out I think, as that wouldn't result in a tube with a constant diameter (it would change from a circle profile to an oval and back along its length).

Here's an example:

Here's very nearly what I want, using a bunch of planes and sketches:



However, I can't get both connections lining up with the straight piece. From one sketch I can get this far:



From the other end, in a different plane, I can then do this:



However I can't connect the points in the way that I want because the geometry from the first sketch doesn't allow it (it would need to change the angle and length of the long straight line):



I achieved basically the same thing with the same problem using revolves and extrudes (find the line of revolution that revolves the circle toward the other circle, extrude from it's end).

I think the basic problem in both cases is I need a line to point to a place that can't be determined until the other side has been defined, but in order to define that side, it needs the first side to be defined. I think I could solve it mathematically in one step, but I think the fact that I'm having to do it in separate sketches prevents this approach. Maybe that means I need to resort to feature script? It really feels like this should be possible without though! What am I missing?

Here's an Onshape document with an example: https://cad.onshape.com/documents/bca273998578cc2603c134a3/w/4c4563f13cf1b97e498478d4/e/5026a0b792d398ad4e365a63?renderMode=0&uiState=6613c033fdf56b1bbead94b4
«1

Comments

  • Options
    eric_pestyeric_pesty Member Posts: 1,524 PRO
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    edited April 8
    Scrap this - Found some more info. Details below.
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @eric_pesty. I've taken a look at that. At first, I thought it wouldn't work, as it seemed more like free-hand 3D line drawing rather than calculated, but by playing with it, I figured out the "anchor" variables. I've managed to get it to do very nearly what I need by having a line coming out from the face of the first circle in the normal, then having a "direct" line coming from that, anchored to a vertex that is out from the centre of the second circle in the normal, then having a line coming from that, anchored to the centre of the second circle. With arcs ticked, and an arc radius of the same radius as the circle, this very nearly does the trick.

    However, the length of the first and last lines is not automatically calculated. If it's too far  away, I get a straight section before it arcs. If it's too close, it fails to generate (because the arc would have to start before the circle). I could figure out the exact right length using the angle of the direct line and the arc radius, however the length of the first and last lines affects that angle, so I'm back in the same situation where I need to base a number on something that the number is itself dependent on. I think I could calculate it with a bit more complex geometry - create a circle jutting out from the first circle, angled towards the second, likewise create a circle jutting out from the second circle, angled towards the first, connect these two new circles with a line, the line must be tangent to both new circles, from that I should be able to work out the right angles / distances. I'd rather not have to do that though.

    I also got pretty close by adjusting the lengths manually until there is only a sliver of straight section before it arcs.

    I would still like a full general solution to this.

    I have updated https://cad.onshape.com/documents/bca273998578cc2603c134a3/w/4c4563f13cf1b97e498478d4/e/5026a0b792d398ad4e365a63?renderMode=0&uiState=6613c033fdf56b1bbead94b4 with the "3D lines" FS plus manual adjustment  of lengths approach.
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @dirk_van_der_vaart. As I mentioned in the question, I'm aware of "3D fit spline", which you could use to join the centres of the two circles and then sweep, however this will give the whole thing a curve (though you can fiddle with the curve with magnitudes). This uses more material than ideal, and is a little more awkward to 3D print. I want a straight tube with curved connections at either end instead.

  • Options
    christopher_brettchristopher_brett Member Posts: 17
    I think I've managed it with vanilla Onshape geometry, no FeatureScript. See https://cad.onshape.com/documents/bca273998578cc2603c134a3/w/4c4563f13cf1b97e498478d4/e/5026a0b792d398ad4e365a63?renderMode=0&uiState=66147d4854861d1b162225b7, from sketch 11 onward. However, it behaves a little strangely. I needed to break my sweep up into 3 sweeps, or it fails. Also if the second sweep is set to "add", it fails. However, having it create a new part then union them together works fine... I don't understand why "new" + "union" doesn't give exactly the same result as "add". What's the reason for that? This feels a bit brittle, so I'm not sure about using the approach I have here...
  • Options
    eric_pestyeric_pesty Member Posts: 1,524 PRO
    I think you are running at the limit of "zero thickness"/"self intersecting" geometry with the ends of your tube being essentially sharp on the shortest area. Not sure if these are meant to be hollow but generally it's better for the bend radius of the tube centerline to be larger than the tube itself.
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @eric_pesty. Interesting. I can understand why you would want a larger bend radius if actually bending some metal, but for 3D printing, I don't think we should need a larger bend radius than the radius of the tube. It is intentionally supposed to revolve around a tangent to the circle. Less material used that way, and more strength (this thing is load bearing). So it does go down to 0 thickness at one vertex, but this is true of any partial revolve where you revolve around a tangent to the face, and should still work, right?

    Maybe I'm in to rounding error territory?

    I could try actually using a revolve feature for the bends. Currently it's using a sweep along the arc, then the straight section, then the other arc. In theory, both methods should produce exactly the same result though, right? And not throw an error...
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    I've put a clean example (without all the random experiments) in the https://cad.onshape.com/documents/bca273998578cc2603c134a3/w/4c4563f13cf1b97e498478d4/e/5c7a16b4af3fc5de975969f6?renderMode=0&uiState=6615102754861d1b1623fee9 in the "Plain Geometry Example" part studio.

    I think the issue is that I've got the wrong arc on both ends, because the arc points at the other circle's centre, rather than the centre of the face that will be created by the other circle's arc sweep. So the arcs are not tangential to the straight line. So sweeping through an arc and the straight section creates intersecting geometry. Even with the bodge of sweeping in 3 parts and unioning, the resultant part is not completely perfect - the angles are fractionally wrong, the faces of the arc sweeps do not perfectly face each other.

    I've blown the diameter up in the new example to highlight the problems with this approach. You can see we end up with an oval profile for the straight section, with gaps, overlaps, and non-tangential lines.

    I'd still like a solution to this that doesn't involve manually fiddling with the section lengths as is necessary in the "3D lines" FS approach.
  • Options
    john_lopez363john_lopez363 Member Posts: 69 ✭✭
    edited April 9
    @christopher_brett
    Using the 3D Lines FS plus a couple of reference lines to help the FS define the vertices...you get this.   The length of the reference lines are not equal because the angles between the 3D Line and the Front plane and Top plane are not equal. You can make the reference lines longer, but make those lines any shorter you start to run into intersecting geometry issues.




    This is the ONLY sketch geometry needed to create this.


    Here is a link to show how I did it.
    https://cad.onshape.com/documents/aa0f564cea4d3c2e58403a32/w/a47373c020f45b158092f9e3/e/153f29ec599c8f67a78ff4ce
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @john_lopez363. That's almost perfect. I managed to get to that solution a few attempts back, however I discarded it because the lengths of the reference lines are manually set, through trial and error. And you end up with something not quite perfect - screenshot taken from your doc:



    The straight section before the bend shouldn't be there. I may settle for it as so close as to be practically perfect, but it's frustrating I can't find a pure calculated solution to this. I'd still like to find one.
  • Options
    dirk_van_der_vaartdirk_van_der_vaart Member Posts: 543 ✭✭✭
    Why don,t you use a 3 point plane and then construct the tube on that plane
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    @dirk_van_der_vaart - I'm not sure exactly what you mean. Which 3 points? I don't think I have the points defined to do this. And the tube isn't on a plane - it bends in 3 dimensions.
  • Options
    rick_randallrick_randall Member Posts: 108 ✭✭
    Christopher, I have an old book titled " Aircraft layout and detail design" printed in 1941 (probably out of print), it has many solutions to problems just like yours. But let me start by saying that the math is just mind blowing, Yes there are ways to solve this mathematically, but it involves an incredible amount of triangulation (old school way) - my suggestion is to learn to live with whatever microscopic deviations it takes to "trick" Onshape into giving you a solution that is as close as possible. All cad programs don't like self intersecting geometry , and the conditions you've laid out kind of set you up for this. Glad you shared this - it is an interesting problem, but I would like to know if you are going to make this part, or is it just an abstract practice exercise?
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @rick_randall. Yes, I'm making this part, 3D printed. I have two use cases for the same problem. One is a support, attaching a held object in an awkward angle to a fixed base. I can live with an approximation here, it just needs to be strong enough, and not too wasteful of material. The other use case however is to roll a ball through. This really needs the consistent diameter (or in places it will be too tight for the ball to roll through). I could potentially live with an approximation if I make the tube a fair bit wider diameter than necessary.

    I'd really like to figure out a full calculated solution for this problem though, to satisfy my own curiosity as well as to avoid the approximations in the part. If I can get my head around the maths, I could then turn it into a feature script so that nobody else needs to get their head around the maths :smile:.
  • Options
    rick_randallrick_randall Member Posts: 108 ✭✭
    edited April 19
    Christopher,
    Remember Onshape deals with 8 (edit , only 6) decimal places - and that's a tolerance no 3D printer can match - so don't get to hung up with absolute accuracy. As long as your print will do what is expected, it's a job well done.
    I do understand, and applaud you for wanting to learn the math - go for it.
      Good luck
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @rick_randall. Yes, a solution that is correct to 8 decimal places would be fine, but I really want something that calculates that, even if it's approximate (as everything is given the finite limit on precision). At the moment, it's still trial and error to get something close.

    Thanks @dirk_van_der_vaart. That's a nice fully calculated solution, but it doesn't quite do what I wanted (bend, straight section, bend, like it's gutter pipe) which means it uses a bit more material than necessary - largely inconsequential, but now I'm driven mostly by my own curiosity to find a full solution. Also, you have to tune the start and end 3d fit spline magnitudes this way, whereas a bend, straight, bend approach should be fully calculable.
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    The maths is straight forward when both circles centres are on a plane and the circles are normal to that plane. Actually, you don't even need to do it yourself as the Onshape solver does it just fine when fed the right constraints: 



    However, I'm struggling to extend this to the case where the circles' angles don't happen to line up so neatly and I need to solve it in 3D. A hand with the maths would be greatly appreciated.
  • Options
    martin_kopplowmartin_kopplow Member Posts: 281 ✭✭✭
    edited April 19
    A tricky one. Why not let onshape do the work? ;0)
    I assume the fitting bend radius is greater than the tube radius. So the tube center line is a tangent on these two funnel shaped faces and is also coincident with both their axis'.
    Now we know the boundary conditions, we could build a little "tube bending machine" in the form of simple helper geometry and a few mates, and we do of course do that "in context", then we can let Onshape adjust the centerline:

    The helper geometry doesn't need to be 3D, simple segment shaped faces would do, it's only there to place the mates on something. The 3D hinges are just for the purpose of demonstration, and fun, of course. Anyway, this appears to work in general, no matter where I put the tube start and end point, and the best is: It all works without doing the math yourself. :0)
  • Options
    rick_randallrick_randall Member Posts: 108 ✭✭
    edited April 19
    Martin I like your solution, very nice, as long as you keep path radius microscopically larger than the circle radius (so you don't have self intersecting issues) you should get good results. And I agree -let the program do the math.
  • Options
    martin_kopplowmartin_kopplow Member Posts: 281 ✭✭✭
    Hi Rick, it would also work if path radius and tube radius were identical, but the sweep for the fittings would possibly be less stable. A rotate would also do. If the radii were identical, the end circles of the tube would merely 'roll' tangentially on the two circles on the 90° planes. I wonder if we could constrain that using mates.
  • Options
    john_lopez363john_lopez363 Member Posts: 69 ✭✭
    edited April 19
    Keep in mind one of the OP's initial requirement was for the tube to be as short as possible...and I assume that is the total length.   To accomplish this the bend radius would need to match the tube radius, wouldn't it....or very close?

    I see this as the top edge and bottom edge of the bend sections being near tangental to each other.  Of course to resolve any non-manifold errors there would have to be some minuscule gap between the two.


  • Options
    christopher_brettchristopher_brett Member Posts: 17
    @brucebartlett - I saw a rather old post from you in this thread: https://forum.onshape.com/discussion/3369/3d-sketching-curves#latest that shows what looks like a solution to this sort of problem using plain Onshape functionality - if you've still got the document, would you mind sharing it? And/or explain how you achieved it?
  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @martin_kopplow, that is awesome! I was trying to find a way of getting Onshape to do the work via constraints, but got tripped up by only being able to constrain in 2 dimensions at a time, and not being able to constrain across sketches. I hadn't thought of using an assembly to constrain in 3 dimensions and then creating the part using that as context! I think that will do exactly what I need, though it's rather complicated. Not sure I can extract that into a feature script either, given it involves creating an assembly and then using the assembly as context. But it's awesome that it's possible! I'll try to apply what you've done to my example, and see if it cooperates with the bend radius being the same as the tube radius.

    In the meantime, I found a sketch solution that does slightly more of what I want than previous approximations. I can get it to bend with the same radius as the tube at one end by constraint, but not the other. In this solution, you only need to manually fiddle with one length to get it to approximate on one side, which is slightly better than the "3D lines" FS solution:


  • Options
    rick_randallrick_randall Member Posts: 108 ✭✭
    edited April 19
    Christopher let me know if you're getting away with the same radius sizes ( I'm curious about self intersection issues with the sweep ) . If it works - cool.
    I've run into this sort of thing in the past and I've just gotten to where I just avoid it by increasing the path radius slightly (maybe I don't have to do that anymore).
  • Options
    martin_kopplowmartin_kopplow Member Posts: 281 ✭✭✭
    edited April 20
    Hi @christopher_brett and @rick_randall, we should keep in mind that a tube can hardly be bent to a zero inner radius. So, with a condition in place that the segment radius be eqal to the tube dimetre/2, the tube can only be manufactured by milling, casting or additive processes. It also makes little sense when it comes to fluid dynamics.
    Anyway, if that's to be the case, the process is much simpler, as takes only half the steps and half the constaints:
    I used a 'telescopic tube' to get the tangency right. That's only a helper. The final tube can be done in context and in one part. The bent part can be done by a sweep or by a rotate. For a sweep I need the center line, and for a rotate I'd need the rotate axis, which would call for one more sketch plane to define it, that's why I went with the sweep. The only critical point here is the tangent mate with the two end circles: The constaint can be met on either side of each circle, so it might flip over, if the changes in the setup are made in overly large steps. Make changes by less than 10mm (<1Radius) at any one time to prevent flipping.

  • Options
    christopher_brettchristopher_brett Member Posts: 17
    Thanks @martin_kopplow. This part is to be 3D printed, so the bend radius should be fine. I'll check both of your approaches out.

  • Options
    martin_kopplowmartin_kopplow Member Posts: 281 ✭✭✭
    edited April 21
    I wanted to know, so I simplified it a bit more, possibly down to a level where it might even be scriptable.
    My helper geometry:
    Two of these form kind of a jig:
    When inseerted in the context of an assembly, they only need one more mate (cylindrical) before the tube can be designed:


    Since I built it on two mates placed on the base geometry, the tube is configurable in end positions, diameter and bend radius.

  • Options
    rick_randallrick_randall Member Posts: 108 ✭✭
    Martin I like your approach with the little hinge tabs, and I believe this could be the simplest method to develop the center-line that is normal to both ends of the elbows. After all it's just the center-line that's needed for the sweep, right?
Sign In or Register to comment.