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.

Custom Feature: Clone Curve to Points

joshtargojoshtargo Member Posts: 221 EDU

Allows you to move or copy a 3D curve to a new location by defining the new endpoints.

New curve retains the essential "Character" of the original curve but is stretched parallel to new Chord to reach target points. (Chord is a line between curve endpoints)

User can also scale new curve normal to new Chord, and rotate new curve around new Chord.

Let me know if you find bugs or want to help make improvements, I am not very skilled in writing scripts, I had a lot of help from GPT and searching for existing code.

Link: Clone Curve to Points

Comments

  • Caden_ArmstrongCaden_Armstrong Member Posts: 164 PRO

    You should enable "link" permissions so that other users can add the feature to their toolbar.

    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • joshtargojoshtargo Member Posts: 221 EDU

    Fixed, I think. Still working on improvements for next version.

  • S1monS1mon Member Posts: 2,957 PRO

    Definitely want to try this out.

    You might want to look at the "official" publishing recommendations for custom features.
    https://forum.onshape.com/discussion/22767/please-publish-your-high-quality-custom-features

    Improvements to Onshape - November 28th, 2023 — Onshape

  • MichaelPascoeMichaelPascoe Member Posts: 1,979 PRO

    Nice work Josh! Keep it up 😎


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • joshtargojoshtargo Member Posts: 221 EDU

    I'm going to be having nightmares about coordinate system transformations for weeks!

  • joshtargojoshtargo Member Posts: 221 EDU

    Working on the next version, I cleaned up the code a lot, and now have it so that you can pick a curve and it will scale until it touches that curve. still lots of bugs and edge cases, but the core is working.

    https://cad.onshape.com/documents/557b17f88f38ef73de260113/w/847f2ad071cb0e78bd856b1e/e/bee2d1e7d3c20968dc61c493

  • S1monS1mon Member Posts: 2,957 PRO

    I'm starting to use this. It's interesting that "mutating" a sketch seems to result in another sketch, rather than a curve.

  • S1monS1mon Member Posts: 2,957 PRO

    Latest update (V4) broke things for me, so I reverted.

    What are the changes? Any clues why it broke?

  • joshtargojoshtargo Member Posts: 221 EDU

    Ill take a look, it's a work in progress

  • joshtargojoshtargo Member Posts: 221 EDU

    working better now. I only intended it for 3d curves, like a CP curve. never tried it on sketches. I need to start adding checks and filters to make sure only valid things are selected. you can choose a point or curve as the target (but I also need to add checks to make sure target is valid). keep playing!

  • S1monS1mon Member Posts: 2,957 PRO

    It seems like there's value in this working on curves, sketches, and edges. It would be consistent with other tools if it would always produce a curve. It might be interesting if it also had an option to "keep points" like CP curve and some other features.

  • joshtargojoshtargo Member Posts: 221 EDU

    I can look into keeping points.

    For generic edges, you mean to select the edge of a solid or surface and move it somewhere?

    What would you want it to do if you select a sketch?

  • S1monS1mon Member Posts: 2,957 PRO

    I can look into keeping points. 

    I think that might be useful for other types of modifications (until we get a real 3D sketcher).

    For generic edges, you mean to select the edge of a solid or surface and move it somewhere?

    Yes.

    What would you want it to do if you select a sketch?

    Make a curve. In V3 it turns a sketch into a sketch, which might be good for some people, but you can't edit it, so the usual thing seems to be to make a curve.

  • joshtargojoshtargo Member Posts: 221 EDU

    Ill try. Everything is a struggle.

  • joshtargojoshtargo Member Posts: 221 EDU

    I'm trying, but I have no idea how to turn an edge into a curve. I tried to use the code from Composite Curve, but it didn't work. It is cool that you can Mutate a sketch curve, and the sketch still controls the copy. That seems useful.

Sign In or Register to comment.