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.

New Feature: Freeform Spline

24

Comments

  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    edited January 2021



    Evan_Reese said:
    Yesss
    Yesssss


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • wayne_sauderwayne_sauder Member, csevp Posts: 472 PRO
    Thanks a lot, I will find this tremendously helpful.  :)
  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    This is so legit.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • George_AndersonGeorge_Anderson Member Posts: 71 ✭✭
    Very useful tool. I got a couple errors -- it looks like you're not trapping some undefined cases. It seemed to happen when rolling back.



  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Very useful tool. I got a couple errors -- it looks like you're not trapping some undefined cases. It seemed to happen when rolling back.



    Thanks, George. I added this to my backlog of stuff to get to sometime, but I'm not sure when.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • GWS50GWS50 Member Posts: 366 PRO
    Thank you, this will be extremely useful

  • Ignacio_Martos_Ignacio_Martos_ Member, Onshape Employees Posts: 18
    @Evan_Reese
    It seems like the freeform spline FS has been deleted, could you provide a copy for us to use? 

    Its one of my all time favorite and most used FS! 
  • eric_pestyeric_pesty Member Posts: 1,461 PRO
    Yep, seem to be missing! Hopefully this is a temporary glitch!
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Check now. It should be back. We switched to Enterprise which made all of my public docs private so I've been having to track them down and transfer them to my personal account. Must have missed this one.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 858 ✭✭✭✭✭
    @Ignacio_Martos_ I got some issues too when I upgraded to Enterprise
    it would be nice if existing documents doesn't move to Enterprise if you upgrade to Onshape Enterprise
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    Enterprise is secure so outside scripts are blocked. They may have fixed it and there might be a setting now.

    The company I worked at wanted no 3rd party stuff: no apps or feature scripts, so things got locked down in the enterprise edition.

    You do know you can transfer FS through your non-enterprise edition. They won't update with notifications but you can build up a nice FS library for the enterprise by transferring through this account.


  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    @billy2 That's what I ended up doing to make them public again.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • roy_yang375roy_yang375 Member Posts: 10 PRO
    Thank you! That is an amazing tool for freeform spline! 
    Just one question here, is it possible adding a check box to generate my personal axis not the world axis? So I can drag it more liberal along my desired direction. Or any approaches I did not notice for the purpose?
    See below for what I mean.


  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    @roy_yang375
    There's not currently a way to do that, but i've run into situations where I wanted that. I would like to implement it at some point (though there are some other bugs I might want to tackle first), but for now you can do it with a little prep work by setting up a line the drag it along. 


    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • roy_yang375roy_yang375 Member Posts: 10 PRO
    @Evan_Reese Yes, this is similar to what I want. It already helps a lot!!
  • eric_pestyeric_pesty Member Posts: 1,461 PRO
    @Evan_Reese
    Very nice!
    This was already my favourite and most used custom feature but inserting points was always a bit of adventure before, this will really help with usability!

    The "click twice" thing seems to happen pretty much 100% of the time when selecting something from a context (if that helps for debugging...).

    Never realized what the "keep points" did! Might start using it now that I know it's there.
  • S1monS1mon Member Posts: 2,321 PRO
    @Evan_Reese

    Very cool update. I think you've already won the Featurescript contest.

    I'm looking forward to the Control Point mode having G1/G2/G3 constraints. I haven't begun to look at your code yet, but as you probably know, you could copy/learn a lot from Bridging Curve to get G1/G2 constraints. 

    One thing that has been on my mental to-do list is to add the ability like Solidworks has in the sketcher to raise/lower the degree of the current curve. The De Casteljau algorithm says you can always raise the degree and the curve is identical (but then you get to manipulate it more), and you can lower the degree if you've just raised it and it stays the same (Solidworks will lower the degree and keep things the same if possible, Pomax's demo doesn't for some reason). With your feature, this may need to be a separate mode like Insert.

    I'd love to be able to move control points normal and along the curve.

    I'd also love to be able to planarize a series of points, but I don't see a good way to do group edits of selections in Onshape feature vernacular.

    It would be great to be able to reference other curve points in the current curve, but I can see how that would be messy unless they always needed to be relative to the ends (and possibly the first few control poly lines which could be constrained by G1/2/3 settings).

    In playing around with the control point mode, I managed to lose a bunch of deltas from my references when I tried to add a new point and reordered the points. It might take me a little to reproduce it, but right now I think there's something a little buggy there.

    It would be nice if there was an easier way to add points to either end of the spline. Maybe it's just not a great or easy to support workflow, but there are times when you're going to want to do this, and it's not so easy to add a point "zero". The insert mode seems pretty clean and intuitive. I wish there was a way to add points at either end in a way that was just as obvious.

    Another set of ideas:
    1. Duplicate or rebuild mode to copy an existing curve and optionally smooth/simplify it.
    2. Approximate/variable offset mode: there are a bunch of algorithms for this, but Tiller Hanson is pretty simple. With a little tweaking, you can use it to do variable offsets too. See also https://pomax.github.io/bezierinfo/#offsetting and https://pomax.github.io/bezierinfo/#graduatedoffset


  • S1monS1mon Member Posts: 2,321 PRO
    edited January 2022
    Building on the thought about the approximate offsets...

    I did a quick study where I made one control point curve and kept the points. Then I did a transform/scale of the points, and used them as references to create a second control point curve. The scale was non-uniform, so I got this variable approximate offset effect. This not as quick as it would be to just transform/scale the curve itself (which is also possible), but it does show that there are some interesting possibilities with reusing/scaling/moving points from other curves.


  • MichaelPascoeMichaelPascoe Member Posts: 1,695 PRO
    Legit!

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    S1mon said:
    @Evan_Reese

    Very cool update. I think you've already won the Featurescript contest.

    I'm looking forward to the Control Point mode having G1/G2/G3 constraints. I haven't begun to look at your code yet, but as you probably know, you could copy/learn a lot from Bridging Curve to get G1/G2 constraints. 

    One thing that has been on my mental to-do list is to add the ability like Solidworks has in the sketcher to raise/lower the degree of the current curve. The De Casteljau algorithm says you can always raise the degree and the curve is identical (but then you get to manipulate it more), and you can lower the degree if you've just raised it and it stays the same (Solidworks will lower the degree and keep things the same if possible, Pomax's demo doesn't for some reason). With your feature, this may need to be a separate mode like Insert.

    I'd love to be able to move control points normal and along the curve.

    I'd also love to be able to planarize a series of points, but I don't see a good way to do group edits of selections in Onshape feature vernacular.

    It would be great to be able to reference other curve points in the current curve, but I can see how that would be messy unless they always needed to be relative to the ends (and possibly the first few control poly lines which could be constrained by G1/2/3 settings).

    In playing around with the control point mode, I managed to lose a bunch of deltas from my references when I tried to add a new point and reordered the points. It might take me a little to reproduce it, but right now I think there's something a little buggy there.

    It would be nice if there was an easier way to add points to either end of the spline. Maybe it's just not a great or easy to support workflow, but there are times when you're going to want to do this, and it's not so easy to add a point "zero". The insert mode seems pretty clean and intuitive. I wish there was a way to add points at either end in a way that was just as obvious.

    Another set of ideas:
    1. Duplicate or rebuild mode to copy an existing curve and optionally smooth/simplify it.
    2. Approximate/variable offset mode: there are a bunch of algorithms for this, but Tiller Hanson is pretty simple. With a little tweaking, you can use it to do variable offsets too. See also https://pomax.github.io/bezierinfo/#offsetting and https://pomax.github.io/bezierinfo/#graduatedoffset


    Lots of good ideas here. I should be able to come up with something to easily add points to the ends in insert mode (maybe linear manipulators to drag a new one out). I'm also thinking about a delete mode to remove points with a click. I eventually want to make face references an option, which would also have the effect of being able to planarize points if you create a planar reference surface. Group edits would be trickier to implement, but I've also wanted that ability. I'll have to mull on that one a bit. The offset sounds like it might work as a separate feature altogether. Would that do it? I'll check out all of your references when I have time.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • S1monS1mon Member Posts: 2,321 PRO
    @Evan_Reese

    Additional thoughts:

    I like the "keep points" option, but I wonder if it would be better to create curves and and turn them into closed composites. These would be easier to hide/show. 

    Offset as a separate feature could be fine, but I'm not sure how to get the control polygon of an existing curve, unless it's one created with this tool. Then there's the effort to select all the points of the control polygon. 

    Switching from interpolate to control points would be much better if the curve stayed the same and the vertices adjusted accordingly. I imagine that this would be non-trivial for some types of curves, but at least for single span curves, I think it's relatively straightforward.

    Closed spline mode has a bug if you select the start/end point to try to move it, the spline disappears and the feature goes red. As a work-around, if you unselect "closed" you can edit the point and re-close it. 

    It would be really nice to have a mirror option which would allow you to select a mirror plane (or mate connector) and it would double the number of points on the curve/control polygon. 

    I like the capabilities of insert mode, but I find the graphics counter-intuitive every time I use it. I want the existing points to stay the same graphic style always, and the potential new points to be a different color (maybe debug-green?). Once clicked, they would turn into the standard point style.

    There seems to be a bug in the closed curve mode. In theory, if the control points are in an evenly spaced pattern and "isPeriodic" is true, you should be able to get a regular shape. Instead the curve seems "bunched up" at the start/end. I noticed that you aren't doing anything with the knotArray. I haven't done much with periodic curves, but I wonder if the problem is related to how that is set. I don't fully understand the standard library documentation, but it seems like you may need to set them.




    I noticed that the max curve degree is limited to 15 by your code. Is that a limitation you set, or Onshape, or Parasolid?
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Thanks for digging into this. I haven't done anything to handle a closed b-spline curve, so I need to look into that when I have time. tbh, I need to take more time to read all of your suggestions (many great ones) and evaluate which ones I'd like to implement and in what order (probably easier to harder). I agree Insert mode can look confusing, and I agree with what you're suggesting from a usability standpoint. I'm not aware of a way to change the color of a point manipulator, so I'm going to leave it alone for now. I did think a bit more about a delete mode and realized it would be pretty easy, so I knocked it out in some dead time before a meeting: https://cad.onshape.com/documents/cd51f29c6937305f86a9df95/v/8fdf1a1b2c6401525d94ce03/e/be4551428a7861c124c234d3
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    oh, and the degree 15 thing seems like a limit of FeatureScript at least. I don't know how deep in the tech stack the limitation goes.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • S1monS1mon Member Posts: 2,321 PRO
    So one thing that's supremely puzzling me right now is that when I first add a vertex it's called vertex1. When I add the second vertex, it seems like it becomes vertex1, what was vertex1 becomes vertex2. This seems to be happening in both control point and interpolate mode.
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    S1mon said:
    So one thing that's supremely puzzling me right now is that when I first add a vertex it's called vertex1. When I add the second vertex, it seems like it becomes vertex1, what was vertex1 becomes vertex2. This seems to be happening in both control point and interpolate mode.
    Will you do a screen capture of this behavior for me? I'm not seeing that.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • S1monS1mon Member Posts: 2,321 PRO
    @Evan_Reese

    After playing around with it more, I think what's happening is that I was clicking in the Reference collector for the first vertex, but not doing that for the second vertex. I realize that the intent is that when you hit "Add Vertex" that there's essential a new vertex on top of the last one that you can just drag out. Somehow this isn't the way that my brain works, so I'm always expecting to click on a new reference.

    It's weird. It would be nice if when you hit "Add Vertex" that the focus moved to the new Reference collector, but this kind of awkwardness seems to be part of how Onshape does everything in the native features too. In case this is useful to see:



    Not shown in the video:

    I'm finding that editing the references for the vertices can be a challenge if there's already a vertex at the point that you want to use as a new reference. It just switches to making that vertex active. It's nice to be able to just click on a vertex and drag it, but there are times when it's hard to do anything else.

    On the closed splines, it seems like they're mostly working the way I would expect with interpolated mode, but the bunching up happens with control point mode.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited January 2022
    @Evan_Reese this looks really good.

    I'm also seeing issues with the vertex list.
  • Alex_KempenAlex_Kempen Member Posts: 244 EDU
    I was a little curious to see what a version of freeform spline which uses a single query parameter instead of an array driven query parameter might look like, so I spent a little time today hacking together a version which does just that.

    This version does include some nice QOL of things like the ability to show all triad manipulators at the same time, automatic caching of offsets (so deselecting and then re-selecting a point doesn't reset the offset), and some fancy edit logic to tie parameters to queries so offsets don't change or jump around. The query parameter also serves to make adding and deleting vertices easier, but the query parameter also means you have to have a unique query selection for each control point, and it abstracts away some of the point specific settings. If I were to spend more time on this, I'd probably re-add the insert and delete mode options, but it's hard for me to say whether the tradeoffs of a single parameter actually offer an improvement over the existing array parameter implementation.



    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Sign In or Register to comment.