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

13

Comments

  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    @Alex_Kempen
    that seems pretty cool! I haven't had a chance to check it out and probably won't for a few days, but didn't want to leave you hanging in the meantime. Thanks for giving it some thought and time.
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    oh wow this sprint's software update is a banger with lots of relevant stuff for Freeform Spline! I've got some playing to do when I make time for it.
    Evan Reese
  • adam_richardsonadam_richardson Member Posts: 35 ✭✭
    Great work on this @Evan_Reese !
    I could well be missing something, but is there a way to essentially duplicate a freeform spline such that it is projected onto a plane? This is useful for lofting a surface down to a part line in plastic for example. Or if I want to make something symmetric about a centerline.

    I couldn't see a way to reference the points from a previously drawn freeform spline but then make all the points of the new spline lie flat in, say, Z. I can create a new sketch and use the geometry of the earlier freeform spline, but it appears to be non-editable (maybe there's a way to convert it to a conventional spline so I can edit it that I just don't know about). Hope that's clear...

  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    Great work on this @Evan_Reese !
    I could well be missing something, but is there a way to essentially duplicate a freeform spline such that it is projected onto a plane? This is useful for lofting a surface down to a part line in plastic for example. Or if I want to make something symmetric about a centerline.

    I couldn't see a way to reference the points from a previously drawn freeform spline but then make all the points of the new spline lie flat in, say, Z. I can create a new sketch and use the geometry of the earlier freeform spline, but it appears to be non-editable (maybe there's a way to convert it to a conventional spline so I can edit it that I just don't know about). Hope that's clear...

    Adam, if I follow, you're just looking for a way to force some parts of the spline (or the whole thing) to be planar, right? If so, there's not yet a super clean way to do it. Eventually I'd like to add faces as a references, which might include planes, which would help. Here are a few ideas in the meantime though:
    • You can create it in 3D and then "Use" the edge into a sketch in order to force it flat.
    • You could create a sketch first that has a bunch of points that you can reference with Freeform Spline, then edit the sketch with the "Final" button active
    It's always a little bit of a question for me as to how much functionality to pack into this one feature vs just creating a second similar feature for other use cases. In the end, I think Onshape could create a much better native tool for these kinds of workflows. Maybe it would be something more like 3D Sketching in Solidworks. In any case, I've had fun making the feature, and I use it often, but I kind of hope it eventually becomes obsolete.
    Evan Reese
  • adam_richardsonadam_richardson Member Posts: 35 ✭✭
    Thanks Evan, you're understanding what I'm getting at, and the way I solved it for now is to create a sketch using the geometry, as you suggested. I can see the 2nd approach working too with a bit of planning ahead, as usually you "grow" the geometry up from the part line.

    Agreed that ideally this is something built natively into OnShape! From an industrial design standpoint it's much more intuitive to be able to work with these in 3D rather than interpolate through 2x 2D sketches
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    From an industrial design standpoint it's much more intuitive to be able to work with these in 3D rather than interpolate through 2x 2D sketches
    ID is my background and I very much agree. I wanted something as interactive as the curve tools in Rhino, but still backed by the parametricity of Onshape.
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    I just pushed out a V24 update:
    • I made it so the feature automatically starts out with two points created when you first make the feature since this is the first step anyway. I've been wanting this every time I use it so I don't know why I'm just getting around to it, haha.
    • @S1mon I fixed the issue with the periodic b-spline bulging. To make a closed spline with opFitSpline I just added the first point again to the end of the list (just like the Fit Spline feature code), but opBSpline doesn't need it and will close if isPeriodic is true, so I had to remove it for that case. Thanks for pointing it out.
    • I also fixed the issue of adding a point in closed mode. Because I was adding an extra point to the end that wasn't in the feature array param you were getting overlapping point manipulators, one of which was out of range for the array param. I updated the point manipulators to not add that last one if it's "closed".
    • I improved and cleaned up the messaging a bit to hopefully be more instructive about what to do or what's going wrong.
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    @Alex_Kempen

    I had a quick poke around your version and there's definitely some cool stuff happening!
    The caching is an interesting idea. I did find it worked well for the most recently added point, but if I clicked a middle point twice (to deselect and reselect) it felt a bit jumpy since it moved the last point there, but kept the same offsets. 

    I thought the "confirm" boolean was clever (though maybe not needed since ctrl-z works for feature edits).

    I'm torn about the ability to add all of the triads. It looks super messy sometimes, but it does reduce clicks a bit and feel more interactive. To anyone reading this, what do you think? Would that be a helpful option to you or feature bloat?

    There are definitely some pros to the single query method. The two biggest drawbacks (for me anyway) are that you must have a reference per point, which isn't usually why I want this feature, and that you can't manually edit the offsets, which I do from time to time.

    As usual, your code is much more concise and tidy than mine. Thanks again for taking the time to look at it!
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    S1mon said:
    @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.
    As far as I know this is a limitation of FeatureScript, but it definitely makes my feature a lot less intuitive. Maybe @ilya_baran or @kevin_o_toole_1 know how to do it or could make it possible easily enough. Any ideas, guys? Ideal for me would be the option to use UIHint.FOCUS_INNER_QUERY for this kind of array param, not just query-driven ones.

    Evan Reese
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    The only thing I can think of that might work for the array parameter is adding UIHint.INITIAL_FOCUS_ON_EDIT to the inner query parameter, but I don't recall if that actually behaves correctly inside an array parameter.

    Confirm is certainly unnecessary from a feature design perspective, but I've begun to add them to all of my features which have editing logic functions which are triggered by a boolean since they make it much clearer what the boolean actually does. Otherwise, the UI has a boolean checkbox option that refuses to stay checked, which is confusing, to say the least. It also makes things more satisfying to use, which I personally enjoy.

    One thing you can do to make editing easier is automatically move the insert location to the vertex before the previously removed vertex whenever a vertex is removed. I have plans to do this for my Plate FeatureScript, as I've found that removing something from a selection often coincides with adding something to replace it immediately thereafter. Given the current UI implementation, this might not work since insert has a dedicated mode, but you could potentially look at making it passive akin to the way my Plate FeatureScript handles it and seeing how that works out. Plus, adding lines between point selections might have a passive bonus of making it easier to understand what's going on selection wise (at the cost of cluttering the graphics window a bit more).
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    I'm pretty sure I've tried UIHint.INITIAL_FOCUS_ON_EDIT and it didn't work, which I guess makes sense. If there are a ton of queries with that UIHint, how would FeatureScript know which one to prioritize?  I'll try it again though to confirm. I'd really love the ability to set focus explicitly with editing logic or manips, for example when a user selects a point in the view, it should also focus on that point's query. 

    I didn't think about the added clarity of the confirm boolean, which I think makes a lot of sense for behavior that people aren't used to. I'd love to have some new interactive elements available like a scroll wheel, or more formal button (with a custom icon maybe), which could be momentary or persistent.

    I'll dig into your last paragraph and the Plate FS to make sure I understand all of it when I have more time. As always, I appreciate the ideas and prodding to make my features better.
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    Update: I noticed it is pretty easy to add weights to each b-spline point, so I added it for the Control Point mode. Notice I'm getting a triangular shape here, even though the control polygon is a hexagon. I'm weighting every other point.

    Evan Reese
  • S1monS1mon Member Posts: 3,046 PRO
    @Evan_Reese
    Great to add weights to the feature.

    You may want to add a lower limit on the weights that isn't 0. A weight of 0 causes the spline to disappear.
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    done
    Evan Reese
  • S1monS1mon Member Posts: 3,046 PRO
    @Evan_Reese

    Congratulations on winning the Onshape Live FeatureScript!

    Called it a while ago...

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Congrats, Evan!
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    S1mon said:
    @Evan_Reese

    Congratulations on winning the Onshape Live FeatureScript!

    Called it a while ago...

    lol yeah you did and I wasn't so sure. Thanks!
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    Congrats, Evan!
    Thanks, Ilya. Wouldn't have been possible without your help answering FS questions over the past few years.
    Evan Reese
  • bryan_lagrangebryan_lagrange Member, User Group Leader Posts: 835 ✭✭✭✭✭
    @Evan_Reese Is that anothe Onshape championship belt to add to your collection?
    Bryan Lagrange
    Twitter: @BryanLAGdesign

  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    @Evan_Reese Is that anothe Onshape championship belt to add to your collection?
    You know, I'm not sure! I thought they might just send it to the folks that made that awesome train.
    Evan Reese
  • lanalana Onshape Employees Posts: 711
    Congratulations, Evan!
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    lana said:
    Congratulations, Evan!
    Thanks, Lana
    Evan Reese
  • bryan_lagrangebryan_lagrange Member, User Group Leader Posts: 835 ✭✭✭✭✭
    @Evan_Reese We got to see your freeform spline feature script in action at last night's user group meeting. @GregBrown showed how he used it on the creation of an exhaust manifold. Very impressive. 
    Bryan Lagrange
    Twitter: @BryanLAGdesign

  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    @Evan_Reese We got to see your freeform spline feature script in action at last night's user group meeting. @GregBrown showed how he used it on the creation of an exhaust manifold. Very impressive. 
    I heard that! Thanks for using it and demoing, Greg.
    Evan Reese
  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO
    Nice!

    This would be great to have built in to the Plane feature.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    Nice!

    This would be great to have built in to the Plane feature.
    Ooh good idea! that's pretty low hanging fruit to write now that I've done this one. Help yourself, or I may get to it at some point (🥁).
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,188 ✭✭✭✭✭
    v34 Update: Freeform Spline in Polyline mode now supports corner fillets

    This is super handy for things like pipe routing made of lines and arcs, or cable routing where you want to control the bend radius. It was a lot more work than it sounds like to get it working, but I think it's fairly stable. At this point the feature is getting kind of unruly, so I've gone ahead and updated it in hopes that people can help me with quality control. Lemme know if you find bugs!

    Some notes on how it works:
    • Fillets can be specified by radius or chord width
    • You can either select Fillet all corners at the bottom or select Fillet corner inside of each vertex. Anything in a vertex setting overrides the global "fillet all" setting.
    • The individual corner fillets accept a radius or width value of 0, so if you want to fillet everything except a certain one, use that in conjunction with Fillet all corners.
    • When Fillet all corners is selected, you have the option to create the curve as a single fit spline. Otherwise it will be a compound curve with individually selectable lines and arcs
    Evan Reese
  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 847 PRO
    Nice update. I've been using this extensively the past couple months to put wires into my assemblies. I think I have a bug, in that I can't pick things in the order you have it set up to (starting and ending direction). I always have to pick the first point first, then a few more points, and finally the staring and ending directions last. Not a big deal, but if you'd like to do a screen share one day to see how I'm using it, I'd be happy to. 
  • S1monS1mon Member Posts: 3,046 PRO
    edited July 2023
    I'm very happy to see this tool be improved more and more, but I also share @nick_papageorge073's issue. I often find myself expecting to be modifying one point, but ending up moving a different one. I'm not sure how much of it is a bug vs something that seems non-intuitive about the workflow. 

    As I'm been playing more and more with Plasticity, I'm realizing that a workflow that I'd love to see in Onshape is one where I start by clicking on the two endpoints, it creates a degree-1 spline (AKA a line) and then optionally increase the number of CVs. Each CV would be movable, and the overall curve would scale based on the the endpoints. This might be a completely different feature or mode, but it's something that I'd love to see.

    [edit] to clarify, the existing "insert" mode is helpful, but what I'd really love to see is the ability to instead increase the degree without changing the shape (see Pomax's info on raise the degree). 

    The other key point is that currently internal points (or CVs) are relative to a reference - which is useful - but there's no proportional updates to curves based on the their endpoints. Ideally, this would be the default.

    Creating a degree-1, increasing to degree-2, moving the middle CV to get the overall gesture of a curve, then increasing (if necessary) the degree again, and tweaking the new CVs... that's a very common workflow for Alias, Rhino, NX, ICEM, etc. When the curve is degree 2, it's defined by three points, and guaranteed to be planar. This is important. Non planar curves aren't very common as the basic gestures of product design. Details or second/third order fillets/blends will end up creating 3D edges, but the basic shapes are almost always defined by planar curves (just not necessarily orthogonal to the default planes).
Sign In or Register to comment.