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.

Slope between 2 Points

famadorianfamadorian Member Posts: 390 ✭✭✭


I have a spline between 2 points which are 30m apart. Point 1 is also -9m below point 2. 

This is from a map.

I want a road between these two points, so the gradient has to be smooth between the two points.

Is there some way to make the curve be descending smoothly from point to point?

After I have the curve, I can just create an offset to get the road. 


Best Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    Answer ✓
    Try Projected Curve using the spline you created from the map for the first sketch and a straight line (drawn on a plane parallel to the spline plane) for the second sketch.
    Senior Director, Technical Services, EMEAI
«1

Answers

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,938 PRO
    You can add/remove spline points and adjust the manipulators on the start/end points to make any shape you want
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    edited December 2018
    You can add/remove spline points and adjust the manipulators on the start/end points to make any shape you want
    First of all, if I tried that, the spline would deform and not correspond to its shape as found on the map (as seen from above)

    Secondly, I want any point on the curve to have the same gradient.
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,938 PRO
    I don't think I understand what you need.
    You may want to look at this though
    https://www.onshape.com/cad-blog/everything-you-ever-wanted-to-know-about-onshape-splines-part-1-of-2

  • famadorianfamadorian Member Posts: 390 ✭✭✭
    Tell me what is unclear. 

    I have the spline in the image I provided. This was drawn from a map (like google maps). Between the two points is a height difference of 9m and the descent from the first point to the second point is smooth. With that, I mean that there are no sudden height differences. It just goes from -9 to 0m in a smooth manner. Mathematically, the derivative at each point in the curve would be equal. 
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    Answer ✓
    Try Projected Curve using the spline you created from the map for the first sketch and a straight line (drawn on a plane parallel to the spline plane) for the second sketch.
    Senior Director, Technical Services, EMEAI
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    NeilCooke said:
    Try Projected Curve using the spline you created from the map for the first sketch and a straight line (drawn on a plane parallel to the spline plane) for the second sketch.
    Hehe, that's just excellent; thank you

  • famadorianfamadorian Member Posts: 390 ✭✭✭
    ..and the use Project Curve


  • famadorianfamadorian Member Posts: 390 ✭✭✭
    Ok, this used to worked, but when I returned to the same document today, it fails: 
    Projected curve did not regenerate properly: Error regenerating

    Is there any way to get a more thorough error message that can help me troubleshoot this?


  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Can you share the document?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    It fails because the boolean operation would generate two curves.
    See https://forum.onshape.com/discussion/9239/opboolean-on-surface-bodies

    It should work if you extend the ends of the line for the slope
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    It fails because the boolean operation would generate two curves.
    See https://forum.onshape.com/discussion/9239/opboolean-on-surface-bodies

    It should work if you extend the ends of the line for the slope
    I'm not sure I understand; why would it generate two splines? There's only one spline here and it doesn't have gaps like that article mentions.
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    I now tried to move a little on the edges and now it succeeded, but I want to figure out why. 
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    Now I moved it a little bit more and now it's not regenerating again. There's no log that can tell me what's going on here?
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Hello @famadorian
    When Onshape does a project curves feature, it first extrudes the two sketches so that the surfaces intersect. They then do a boolean intersection, which fails if there should be two curves.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    Hello @famadorian
    When Onshape does a project curves feature, it first extrudes the two sketches so that the surfaces intersect. They then do a boolean intersection, which fails if there should be two curves.
    I'm trying to, but I don't understand;) First of all, the two splines intersect, but I can't understand the reason for them to do so, cause I only want one of them to follow the slope of the other one; they shouldn't need to intersect. Also, what fails because there should be two curves? I don't understand the sentence;)


  • famadorianfamadorian Member Posts: 390 ✭✭✭
    It fails because the boolean operation would generate two curves.
    See https://forum.onshape.com/discussion/9239/opboolean-on-surface-bodies

    It should work if you extend the ends of the line for the slope
    I'm trying to wrap my head around this. 

    Why would it generate 2 splines?
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    It is because the line doesn't "quite" touch the end of the spline.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    It is because the line doesn't "quite" touch the end of the spline.
    Not sure what you mean. It doesn't touch it at all in this image. 

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Maybe someone from support could help you.
    @lougallo?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    Maybe someone from support could help you.
    @lougallo?
    They don't traverse this forum?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    It is because the line doesn't "quite" touch the end of the spline.
    Not sure what you mean. It doesn't touch it at all in this image. 

    You can manually build what Onshape is doing internally to help you better understand. Extrude each curve as a surface and see how they 'intersect" (or not). 
    Senior Director, Technical Services, EMEAI
  • famadorianfamadorian Member Posts: 390 ✭✭✭
    NeilCooke said:
    It is because the line doesn't "quite" touch the end of the spline.
    Not sure what you mean. It doesn't touch it at all in this image. 

    You can manually build what Onshape is doing internally to help you better understand. Extrude each curve as a surface and see how they 'intersect" (or not). 
    There must be something fundamental I'm not understanding here. Does it matter if they intersect or not intersect? I just want one spline to follow the slope of another spline, so it shouldn't matter if they intersect or not. Anyways, I do see them intersect at one point, of course, but I don't understand what that tells me. 

    Also, it's equally the same if they intersect or not, because regeneration does not seem to depend on that, as in all cases, they intersect, but regeneration fails randomly. 

    I'm just looking for a way to understand why it won't regenerate and if there are a log file which can explain better why it's not regenerating. I must be lacking some very basic fundamental knowledge here if this is so obvious to you. 



  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    They are not intersecting in your image - extruding the spline as a surface will create it in one direction - extruding the line as a surface will create it in a direction normal to the spline. Just try it. You may then understand why the feature fails (one resultant 3D spline is required).
    Senior Director, Technical Services, EMEAI
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    Just make the line a little longer and all will be fine.
    Senior Director, Technical Services, EMEAI
  • lanalana Onshape Employees Posts: 711
    edited December 2018
    @famadorian This actually illustrates that you probably are not getting what you want using this approach. The lowest point of the resulting curve is not going to be an end point but a point on the loop. Please see if this custom feature works better for you. 

  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    edited January 2019
    I've never been a fan of this curve projected to that curve. It's too hard for the next guy to understand.

    I'd offer up the idea to use surfaces to convey your intent. This is way easier for the next guy to gain a better understanding of what's going on.



    A little more interesting:


    I typically make these surfaces transparent:


    The highlighted 3D curve above, this is the design pattern for how I'd control it. With our 2D monitors, it's too difficult to control 3D curves. You can't see 3D on a 2D monitor. I still fall back to the projection of 2 x 2D sketches = 3D curve. But to help understand these better, I'll extrude a surface for the visual.




    Possibly the fastest gradient for a mountain bike to get down a canyon path:




    For fun, I'm mapping a bridging curve to the 1st 3D curve created by the projection. It's a really good approximation and it's freak'n easy.


    With the bridging curve, what's not well documented, is the "First side" definition can have 2 parameters.
    Bridge curve inputs:
    1. the curve
    2. which vertex on the curve




    @famadorian don't give up curves & surfacing.





  • famadorianfamadorian Member Posts: 390 ✭✭✭
    NeilCooke said:

    Ah;) Thanks.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    edited January 2019
    ok, I have to stop playing around with curves & surfaces.

    Map a 3D curve to the serpentine down hill curve using a 3D fit spline:


    I had to turn on 2nd order curve mapping ("Match curvature at start") and help effect the 3D fit spline to match the downhill gradient. "Match curvature at start" looks at the rate of curvature change and adds it to control the 3D fit spline. Remember 1st order is the direction which you get when you click on "Start direction".

    To get this to map more closely, you'd have to add another node point. I'm not a fan of 3 noded splines.

    Remember that a 2 noded spline can only make an "S" shape with 2 inflection points.

    That's because it's a basic spline which is 3rd order. It's a cubic. a + bx + cx^2 +dx^3. dx^3 is the cubic creating the "S". It also needs the y & z part of the matrix.


    So  awhile back I wrote this curve fitting algorithm that maps a curve on top of another curve:


    Above I'm using 8 nodes to insure that my new curve doesn't deviate more than 1mm from the original curve. Personally I don't like using a lot of nodes when generating curves. It's a lot of math that perpetuates itself through a design. If you extrude a surface from a high noded curve, then that surface is all knotted up. If you cut a solid with that surface, then your solid is all knotted up. It never goes away.


    So below I show your original curve.

    and:
    1. a bridge curve
    2. a fit spline
    3. my fit spline
    4. a 2 noded spline



Sign In or Register to comment.