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.

FeatureScript Help

wayne_sauderwayne_sauder Member, csevp Posts: 551 PRO
 I am trying to learn a little FeatureScript. Looking for a bit of input on this one, https://cad.onshape.com/documents/975e5a12e82b5d60281883ab/w/4c6a9174b7dd3839ec4c2295/e/a920a3afff5e167ad546da55
 I copied the Port Feature by @cody_armstrongand modified it to do what I needed now I would like to get the tool to add the fillet shown in Part studio 1 into my feature yet how is the best way to do this? What query should be used or is that not needed? The fillet always stays the same radius and always on the same edge so there is no need to show it in the UI.  
Tagged:

Comments

  • richard_doylerichard_doyle Member, User Group Leader Posts: 290 ✭✭✭✭
    Can anyone help Wayne?

    @chadstoltzfus @Evan_Reese @MichaelPascoe

    Thanks,

    Richard
  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited January 2022
    Thanks for the shout out @richard_doyle.


    @wayne_sauder Welcome to FS!

    Here is one way you can do this:
    https://cad.onshape.com/documents/7660251fbec9ce980aea5e3a/w/7eb230cdb608d89c5c8814fc/e/3c08e5d680b0411ea4c5b76c

    Place this below the revolve cut in the revolveCut function.
    const edges = qCreatedBy(sketchId + "revolve", EntityType.EDGE);
    const evalEdges = evaluateQuery(context, edges);
    const singleEdge = evalEdges[5];
        
    opFillet(context, sketchId + "fillet", {
                "entities" : evalEdges[5],
                "radius" : 0.01 * inch
    });
        
    debug(context, singleEdge);

    FYI: FeatureScript is based off of JavaScript. Learning some basic JS will save you a ton of headaches. Of course, we are here for you too!



    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • wayne_sauderwayne_sauder Member, csevp Posts: 551 PRO
    @MichaelPascoe
    Thanks, so much for that help,works pefectlly. 
    Someday I have some time I'll need to sit down and study the basics of JS. 
  • chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 139 PRO
    Looks like I was too slow on this one! Great solution, Michael, glad it helped out. 

    Wayne, a couple of tips for learning FS:
    • Yes, learning some basic JS syntax will be very helpful, not sure what your programming experience is but spending some time in JS tutorials will definitely help you begin to build more advanced elements of FeatureScript like your own functions, predicates, and custom data types. 
    • There are a ton of resources for learning FS, and of course the forums are a great start. Some other places that I still frequent to this day are https://cad.onshape.com/FsDoc/index.html for English explanation of the conventions of FS, and https://cad.onshape.com/FsDoc/library.html for a searchable (Ctrl + F/Cmd + F) document of available functions.
    • You're already doing this step, but continue to look at other people's code and see what techniques they use. Particularly for generating queries, attributes/metadata, and coordinate systems. Mastering those will make you wield FS in extremely powerful ways. You can also look at code behind some of the standard features you're used to using, like Extrude. This can be found at https://cad.onshape.com/documents/12312312345abcabcabcdeff
    • I have done a user group presentation on how to get started learning FS, and there are several other users on the forums who have made tutorials, so be sure to reach out if you're looking for every more resources
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • richard_doylerichard_doyle Member, User Group Leader Posts: 290 ✭✭✭✭
    Looks like I was too slow on this one!

    This came up at the user group meeting last night, I jumped into the forums and tagged three of the brightest people I know, and boom - Michael jumped in.

    The power of community!

    Richard


Sign In or Register to comment.