-
Notifications
You must be signed in to change notification settings - Fork 46
Added documentation about Feature Studio #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
AlexKempen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments on areas I think would be good to expand upon, I like how you took the time to try and explain the hierarchical id structure since that's definitely very confusing to everyone! Let me know if you have any questions/comments, I'm happy to discuss further as well!
|
|
||
| ### Operations | ||
|
|
||
| Operations modify or create geometry in the Part Studio. The take in queries to produce modified bodies. Almost all operations are prefixed with `op`. The most common operations are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the difference between, e.g., opExtrude and extrude? A lot of people don't know the difference, although this has been improved somewhat by Onshape making the default FeatureScript common.fs instead of geometry.fs
|
|
||
| ### Sketches | ||
|
|
||
| To create a sketch, use the `newSketch(context, "id", {"face": queryOfPlanarFace})`, or if you only have a `Plane` object, use `newSketch(context, "id", {"face": planeObject})`. Planes can be created with the `plane(origin, normal, x)` function. To draw on the plane use functions prefixed with `sk`, such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People should be using newSketchOnPlane most of the time, newSketch is the Onshape sketch feature which is overkill, it's also query based which is usually less helpful
| } | ||
| ``` | ||
|
|
||
| ### Geometry Validation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should talk about the buttons for adding parameters at the top of a Feature Studio, as those are very helpful. I feel like talking about the specific syntax of annotation and predicates in the precondition of defineFeature is overkill. This documentation page does a pretty good job of going over the various parameter types already: https://cad.onshape.com/FsDoc/uispec.html
One thing that would be good to include is a full example of an enum declaration plus parameter, as the documentation isn't very explicit about that. You can also share the convention for namign enums (enum name should be CapitalCase, values should be ALL_CAPS)
| ### Variables and Constants | ||
| In Feature Studio, you can define a variable with `var name = value`. Later in code, when you use name, it will use the value associated with it. Additionally, if the value is assigned once and never changed, you can change the declaration to `const name = value`. | ||
|
|
||
| ### Functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear this is too abstract to be very helpful, functions (and predicates) could probably get an entire page just to them since you kinda need to understand type hints, parameters vs. arguments, and the overall syntax before you can start using them effectively
|
|
||
| ### Functions | ||
| A function is a block of code that is easily reusable and preforms a specific task. To define a function, you type `function myFunctionName()`. If you need to pass things into the function, you can use the syntax `function myFunctionName(var1 is Type)`. To execute the function, you can call it with the syntax `myFunctionName(var1)` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A section on ValueWithUnits (when you need to multiply/divide by inch, how to print them to the console for debugging, etc.) would be nice. Ditto for Queries, I also have a video where I talk about them (and ids) in more detail you might find helpful as a reference
https://www.youtube.com/watch?v=JRxLxXwqWWQ
|
|
||
| <center markdown>{width=80%}</center> | ||
|
|
||
| Onshape allows this even though the "r" level is repeated because they are consecutive, unlike the previous example. Notice how previously the order was id->r, id->e, id->r, id->e, whereas this one was id->r, id->r, id->e, id->e. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be nice to tie back the "why" by talking briefly about qCreatedBy and explaining how the id hierarchy can be used to quickly query all of the children of a hierarchical structure, e.g., why qCreatedBy(id) (where id is the top level featureId) always returns everything created by your feature so far
Created a new page under the Other Resources tab that explains the basics of how to use feature studio.