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.

Options

Finding FeatureScript documentation resources?

ken_kaiserken_kaiser Member Posts: 6
edited January 2017 in Community Support
Hi! I'm new here and I found the FeatureScript documentation at https://cad.onshape.com/FsDoc/index.html

I am now looking to apply a Circular Pattern: it is a documented feature but there is no map definition documented for that feature.
https://cad.onshape.com/FsDoc/library.html#module-circularPattern.fs
Looking into the onshape/std/circularPattern.fs doesn't give me many hints.

I was able to find examples of most, if there is any way to search for an example that uses that specific feature, I'll be able to figure it out.

Where are other places to find documentation? Thanks

Best Answer

Answers

  • Options
    ken_kaiserken_kaiser Member Posts: 6
    Thanks Jake! Great to see active development.
    I don't need to tell you but being able to create a custom UI of tools that you use, that are written in FeatureScript changes everything. A huge undertaking but having examples of every FS function would open it up to people who just copy-paste with slight modification. 
  • Options
    ken_kaiserken_kaiser Member Posts: 6
    Follow up, the axis parameter which asks for a query took some debugging. The FeatureScript debugger came back with no axis provided when I queued a body, face, or a vector. There also is no other query that results in an axis so it was guess and check. It took me to the evAxis function which didn't work, but it says it should, when you QueryFilterCompound.ALLOWS_AXIS something you select it works. What ended up working was drawing a line using skLineSegment on the axis I wanted and queried the edge. 

    Debug is useful when something doesn't work, when you select the function in the Part Studio it highlights the part in red and showing FeatureScript notices the {?} icon, it says what it resolved to. e.g.
    debug(context, qCreatedBy(id + "partToPattern", EntityType.BODY));

    // I used it to copy equally spaced circles around a cylinder
    circularPattern(context, id + "myPattern", {
                        "patternType" : PatternType.PART,
                        "entities" : qCreatedBy(id + "partToPattern", EntityType.BODY),
                        "axis" : qCreatedBy(id + "sketch", EntityType.EDGE),
                        "angle" : 360 * degree,
                        "instanceCount" : repeatedTimes,
                        "equalSpace" : true
                    });
  • Options
    Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Hi Ken!

    Thanks for the feedback, I'll look into making the axis documentation a little better.  The ALLOW_AXIS query filter is somewhat strange; theoretically we want to end up with a mathematical representation of some axis to pattern around, but because this is a feature (rather than an operation) we want to let a user click on some geometry (a Query) that can be turned into an math-axis internally.  To facilitate this, definition.axis will take any linear edge, circular edge, or cylindrical face as an "axis". The is one of the problems I mentioned earlier with calling Onshape features (rather than lower level operations) in FeatureScript. Often the inputs are a little unintuitive because they correspond to what goes into the feature dialog rather than the pure mathematical object that is needed (as another example some features will not accept negative valued inputs, but rather always take a positive value and determine the sign with a definition.oppositeDirection variable).

    Sorry this help came after you solved your own issue.  Hopefully it can help Onshapers of the future!
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.