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.

Equivalent OnShape function / script

quentin_moutyquentin_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.

Comments

  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    I'm not sure what you're asking. All features available in the standard OS interface do indeed have a corresponding FeatureScript. What are you trying to accomplish?
  • quentin_moutyquentin_mouty Member, Developers Posts: 13
    Hello,
    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


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
  • quentin_moutyquentin_mouty Member, Developers Posts: 13
    I know (hope) this function existe my point is about finding the equivalence between standard interface and FS. You gave me circularPattern but if I want trim for example how can I find it ?
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited March 2017
    @quentin_mouty If you mean sketch command "trim" - I think most of sketch commands (execpt some basic like "line", "circle", "point") are not implemented in feature script, because we have not feature history tree in sketch invironment. Generaly saying Feature Script solves feature-level tasks, it is rather weak instrument for sketch generation.
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    Here is the FeatureScript documentation for the available sketch functions. As @konstantin_shiriazdanov stated, the sketch functions available in FS are still primitive. You can generate basic line geometry (lines, circles, rectangles, etc), but there are no advanced sketch editing functions (trim, convert edge, intersect, etc). Maybe one day.  

    https://cad.onshape.com/FsDoc/library.html#module-sketch.fs

  • quentin_moutyquentin_mouty Member, Developers Posts: 13
    Ok I have my answer thanks.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    This is a common question, and @mahir is spot on: Certain sketch functions (including "trim") have toolbar buttons but no FeatureScript function call equivalent.

    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.

  • quentin_moutyquentin_mouty Member, Developers Posts: 13
    First thank you for this explanation that highlight some point on Onshape. Cannot we think of some work around re limite a curve with another ? Like using a split instead of Trim ? I saw a splitFace function but not sure if it can be useful.
Sign In or Register to comment.