Add custom feature to a sketch.

chess_denman
chess_denman Member Posts: 2 ✭

Forgive what is a really beginner question.
I am trying to write myself two custom features to work inside sketches.
I want simply to create two lines either side of a center line (ie offset right and left)
I also want to place a circle at the geometric center of a set of lines (eg the center of a rectangle).

These are things I do often.
I am therfore learning featurescript.
what I cannot work out how to do is to add a feature specifically to the sketching bit of onshape as opposed to adding one to the part studio.
I can see others have done it.
I think for example here:
https://cad.onshape.com/documents/d8aab1e0e7ae10038a6830e0/w/9dfdd631d025960813b8f2df/e/421758eb171fa79c9a45f9a6

but I am a bit too much of a beginnenr to distill the core elements of the script down to just what adds a feature to a sketch page

Chess

Comments

  • S1mon
    S1mon Member Posts: 4,636 PRO

    Custom features can operate on sketches, but not within the Sketcher.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • EvanReese
    EvanReese Member, Mentor Posts: 3,099 PRO

    You cannot create a feature that you can use inside of a sketch. However you can produce standalone sketches with featurescript. For example, you could write a script that creates a sketch circle around any points you pick. Examples of your end goal would help me know how to help.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com