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.

Fit Spline

billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,799 PRO
edited December 2016 in FeatureScript
from 3dcad's post 'WHAT IS YOUR XMAS 2016 FEATURE & FIX WISH?'
philip said:
@billy2 - Oh boy! 
I have used your fit spline and really like it.
I have noticed that often the preview has failed but the finished result is still good (just turn off preview).
The other piece of feedback from a very well known design house that i showed it to was that it would be nice if it worked with closed profiles.
Great to have you here (in all your guises!) 


Comments

  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,799 PRO
    It solves the show independently from the nodes, that's why you can turn show off. The show is really there so I could debug. Send me the curves and I'll look at it. I ran through a bunch examples, but didn't bang on it too hard. It's was working on the curves I needed to process. I want it work with edges also, but I think a straight messing things up. I might have to look for straight edges and handle them seperately.

    As a side note, if you write a script with an optimizing loop, put a counter in the loop and break it if the loop hits a high number. If you write a run away condition, it takes ten minutes for your account to log out and your errant script to stop. I've been logged 10 times with 9 dead processes running. It's so much better to put a break in your loops. FYI.

    The closed option is 4 lines of code. I'll put them back in, also the pattern stuff which I wasn't sure why Ilya added that. I'll put that back. Watch for an update soon.

    I really like the splines in OS and now with composite definitions you can do anything. I also like this design pattern where you compose your curves before you enter your loft command. There's more feature tree entry's but who cares. In the other CAD system with the selection manager, it was goofy. Like you couldn't flip directions without leaving the selection manager, things that made the use case difficult.

    Philip would you please go to Dave's office (you guys don't have offices right?), goto his spot and ask nicely for knitting/unknitting. I'm ready for it.

  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,799 PRO
    edited December 2016
    I've updated "Fit Spline V2" to be more versatile.
    -handles closed condition
    -sort curve direction
    -fixed straight bug
    -up the resolution 

    I've added the 'close' spline option, orange is input & gray is fit spline:


    Can handle non-connected splines properly now:


    Works with arcs, had to reverse curve directions for arcs because it was too difficult to build arcs from 'toe to head' consistently:


    Classic fit spline, the reason I wrote Fit Spline:

    2 curves in space on different planes:

    I've stepped up the resolution, but fit splines is still limited to 1000 nodes for runaway script protection:


    Classic fit spline except curves don't have to be in order any longer:

    Standard surface sketch pattern I use a lot, 4 mirrored splines making an ellipse (kinda). This was another reason for sorting curve direction:


    Curves & straights, this is the condition that errored for Phillip. Turns out the straight didn't like displaying an offset distance of zero. Guard against that:


    So I struggle with why do you need fit spline? It's a surfacing thing and I'm having trouble justifying it in the world of solid modeling. Here's a bad example:


    Let's say I wanted to replicate the outside of this face. I split the solid to generate edges I can grab. Then in this case, I need to combine the 2 edges into one curve (fit spline) for a revolve. With some planar faces (not currently available) and a knit (not available), I could take this from surfaces into solids. I need a better example:


    I think I could write planar surface, ruled surface & radiated surface using feature script. What I can't do is knit. Knit is core functionality that can't be feature scripted in. I worry about tolerance though, let's hope knit has some really loose tolerances.


Sign In or Register to comment.