Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Equivalent OnShape function / script
quentin_mouty
Member, Developers Posts: 13 ✭
Hello all,
I wanted to know if their is a way to have an equivalent array between the function in Onshape interface and Featuring script ?
Thank you.
I wanted to know if their is a way to have an equivalent array between the function in Onshape interface and Featuring script ?
Thank you.
0
Comments
I will take an example :
I want to do a trim in a sketch, on the standard interface I have to select the part I want to remove. But in script library I have no function called "Trim" so it is kind of hard to use the trim function in FS. That is why I wanted to know if there was a clear equivalent table between standard interface and FS ?
Thank you
https://cad.onshape.com/FsDoc/library.html#module-sketch.fs
Most Onshape functionality we get as functions in FeatureScript for free, simply because the FeatureScript is what makes them work in the first place! But when you use "trim" in a sketch, it turns out you aren't actually adding a function call to the Part Studio FeatureScript, like you are when you use "extrude". Instead, you are directly modifying sketch entities that you previously placed into the sketch.
Why did we do it this way? Well, Onshape sketches allow very direct control over entities, always letting you delete constraints, move entities around, delete them, etc. These interactions are very natural to represent as FeatureScript, so long as the FeatureScript simply says "make and position each entity and constraint you see in front of you". This way, changing or deleting something in an Onshape sketch simply changes or deletes the code associated with making that entity or constraint.
The trim operation, on the other hand, adds sketch constraints, possibly removes some, maybe splits a single edge into two, etc. Putting it as a function in the Part Studio FeatureScript would complicate interaction later on, since changes to the sketch couldn't be mapped back to changes to that original trim function.
Things like sketch Fillet, Pattern, and Use are also like this. Rectangle and Polygon are too, but for those two at least, we do have FeatureScript functions (skRectangle and skRegularPolygon) which do the same task.