create sketch feature script

Corey
Corey Member Posts: 23 EDU

I have a feature script that creates a new sketch and a set of geometries at a selected point of an existing sketch or feature. I would like to be able to add the sketch geometry to a current and active sketch. I could import a DFX, but this would be a static set of lines and objects. My current feature script dynamically creates the features via the wizard options. Using the DFX option, I would need to create all the options.

My feature script is here and alows the user to pick what motor they will be using and how many holes to add for the motor mount along with adding to the bose diameter if desired.

https://cad.onshape.com/documents/560724c751b793055299f037/w/aa4ce9a3e6bfa89de52eca63/e/f8181e56363c4c8cac6a01ec

Answers

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,955 PRO

    FeatureScript can't add to an existing sketch. FS could copy a sketch or sketch entities. You could do this with the API, but that would be a lot of work. I suspect whatever you are trying to do in the end is possible with FeatureScript. What is your end goal?

    On a similar note, here are two resources I highly recommend if you are getting into FeatureScript:

    FeatureScript Fundamentals by Onshape

    FeatureScript Video Tutorials by CADSharp

    .


    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚