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.

3D Spline with tangency and weighting control

philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
Ok, i am an aeronautical engineer by training and i really wanted 3D splines for lofting wing, propellor and parachute shapes.
Here is a custom feature that does a lot of what i was looking for. The original work was done by Mark Barr and the tangency capability was added by Ilya Baran after i promised to leave him alone if he exposed the functionality. All i did was make it work the way i wanted it to! :)

So, how does it work?
For an open spline, you can now optionally select any edge or sketch entity to define the tangent vector (and optionally flip the tangency direction).
The end of the spline does not have to touch the end of the edge/entity defining the tangent direction.
You can use the same edge/entity for both start and end tangency if you wish.

The weighting of the tangency is proportional to the length of the edge/entity nominated.
There is a variable 'TangencyWeightingFactor' that you may want to change for very large or very small parts.

Best practice?
Use sketch entities to define the tangency/weighting

In this public document, edit the 'Tangency/Weighting' sketch and be sure to select the 'Final' option.

https://cad.onshape.com/documents/b234dd7c0b23405dfebd551c/w/2c022de196b503c1ae096790/e/58a4e2de4c6963f95e46deaa

Have fun - Philip . . . 




 
Philip Thomas - Onshape

Comments

  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    Handy. However, it would be a lot more flexible if the tangent lines/surfaces only added the tangent direction, and the tangent weight was controlled by an input from the user (0-10 or something). It would also be nice to be able to choose tangent vs curvature continuous.
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    @mahir - thank you for your comment.
    Just to be clear, the weighting is controlled by the length of the tangent entity. For that reason, i have suggested that it be a sketch entity, perhaps even sitting on top of an edge (thereby decoupling the direction from the magnitude). If you specifically wanted a numeric weighting, you could do that but you would not be able to set an upper bound as you would need to allow larger numbers for larger parts (or use a scaling factor as i have done here). If you wanted to modify this custom feature to accept numbers (instead of using the length of the edge), you should be able to do so fairly easily.
    As for curvature continuous guide curves, you'll have to wait just a little longer for those! :) 

    Have fun - Philip :)
    Philip Thomas - Onshape
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    I did change the weighting (removed evLength) and added it to the UI. It's makes editing the spline more
    dynamic while editing. Not sure I like having to edit a parent sketch, then waiting to see
    the effect after a rebuild.



    I suppose one could add vectors to the end of the spline and with a manipulator function, make this really dynamic. I suppose I should do this next and give 3D_Spline a lift up in functionality.




  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    @billy - nicely done! :)
    I can help you - anytime a feature is not the last feature in the feature list, you get a 'Final button'.
    Simply add a dummy feature (anything) after the 3D spline feature and you will get a 'Final' button - press it and now when you edit any of the values in the custom feature, you will see the results.
    Pease keep working on this to make it better! :) 
    Philip Thomas - Onshape
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    Thanks Philip for "final". Haven't really understood it's meaning until now and I see why it exists.

    So I can edit the "Tangency/Weighting" click on final and it shows me the spline updating. Also, I can rollback model and it shows me the "final" state up to rollback position. This is what I expected:



    I'm guessing I'm a little critical of "Final" and not understanding it's full functionality. This is my problem. In this example, it shows nicely and I'm seeing it's power. 

    It's kinda convoluted and not intuitive, I mean I want to edit the 3D_Spline yet I have to edit a parent control sketch "Tangency/Weighting". 





    It's not impossible to train an old dog new tricks.....




  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    Philip-

    So, if I add vectors to the 3D_spline and make it behave like a 2D sketch spline, are you going to clobber my code and write a better version? Not you in general, but the guys with the source code.

    Also, on a side note, let's take 3D_spline for instance. If I made your version better, do I make it public and now there's a philip 3D_spline & a billy 3D_spline?

    How are community driven features going to be controlled?




  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    I imagine the control sketches could be used purely for tangency direction with the weighting value input by the user. In that case the spline should update immediately upon changing the weighting in the feature GUI. That's what I thought @billy had already done, but maybe not. 
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    @billy - well done for improving the 3D spine. 

    Well done for figuring out 'Final' - yes its very powerful and helps with any type of feature that may reference anything created in a previous feature - this is a huge problem with other cad systems and we are very proud to offer it in Onshape.
    You're right, we don't have a dedicated mechanism for curating/disseminating custom features, but we will! :)
    Today just making them public and posting a link in this thread (or elsewhere on the FeatureScript forum) is a good start.
    The good news is that once someone links to a document you have made public, they are notified of newer versions when they become available AND it doesn't matter if at some later date you unshare it - anyone that used it still has it (so their documents will always regenerate).
    As for us writing a better one - maybe! But again, it doesn't matter - custom features are first class citizens. If they work now, they will always work in the future. Someone may in a single part studio use your spline and my spline and an Onshape 3D spline - all will work now and in the future.

    - Philip . . . 
    Philip Thomas - Onshape
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    edited September 2016
    Mahir-It does update immediately when updating the weight values. It's what I'm use to seeing. Edit the 3D_spline by rmb and clicking edit. I'm using the scroll wheel to increment/decrement values which is working nicely now. Makes it fun to flex 3D_spline. I still think drag handles is what people will expect to see when editing a 3D_spline.

    Philip is trying to show me something new. It does work. I think it has to be taught though, it's not
    obvious to a user, at least a SW & Pro/E user. I'm not opposed to learning new things, I'm just a little stubborn.



  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    @billy, drag handles aren't too hard if you have an example to work from. Check out the End Flange FS I wrote for an example of using manipulated. It's just a matter of defining where they are in space, what direction, and what they do. 
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
    mahir-thanks for the suggestion. I'll take a look,
  • bruce_williamsbruce_williams Member, Developers Posts: 842 EDU
    I would like to use 3D Spline FS.  What is the latest version you guys have worked out?  

    I loaded Ilya Baran's 3D Spline 2 and it does not seem to have any weighting for tangency.  Trying to create this elbow loft and think the 3D Spline will be answer to getting the top to be correct.


    www.accuratepattern.com
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • bruce_williamsbruce_williams Member, Developers Posts: 842 EDU
    That works really well for controlling the spline. Thanks for the quick reply and such a nice job on the script.

    The loft is not accepting both of the 3D splines as guides; that might be cuz they are connected at one end.  I am going to play with it. 
    www.accuratepattern.com
  • bruce_williamsbruce_williams Member, Developers Posts: 842 EDU
    Yes - the guides work when separated just .04".  The elbow looks great.  I am thrilled to have the 3D spline tool.  Thanks for your work guys!
    www.accuratepattern.com
Sign In or Register to comment.