featurescript
Discussion List
-
Query Part from Part Studio to Use as Input for Custom Feature
I have written a custom feature that takes a part as an input and performs operations using that part. I am writing new a feature that uses the first feature. When using the new, top level feature, the part that is used as an input for the referenced feature should be predetermined, not chosen by the user. I can have this…
-
Featurescript Request: Consolidate PCBAs
I have a workflow I use most of the time to take complex PCBAs from vendor sites and turn them into simple STEP files and I'd love to know if this is something I could automate with a featurescript. I don't have much experience but would absolutely love to learn if I had time Many PCBAs I receive from vendors or clients…
-
New Custom Feature: Rename Beams
This is mostly just recycled code from the beams feature. In our case, it's really nice to have the beams named accurately, including the length, which obviously changes with move faces or what have you. So the idea is that you put this feature after all of your manipulation to the beams, it remeasures the length, and sets…
-
Triad manipulator with rotation like in assemblies?
Is there a way to get a triad manipulator that can also rotate, like the manipulators in assemblies?
-
Manipulator Change and Editing Logic working together
I'm working on a feature with manipulators to change some values, and I also want editing logic to change some values when others are changed. I've got them both working independently, but I'm not sure the best way to make them work together. Put another way, my editing logic works when I type a new value, but not when I…
-
Manipulator Change and Editing Logic working together
I'm working on a feature with manipulators to change some values, and I also want editing logic to change some values when others are changed. I've got them both working independently, but I'm not sure the best way to make them work together. Put another way, my editing logic works when I type a new value, but not when I…
-
Featurescript Linear Algebra Library?
Does anyone know of any linear algebra libraries in Featurescript? Looking for some functions that are slightly more complex than what's in the stdlib. For example, solving a least-squares matrix system is my current problem. I can get my own using the SVD function, but maybe someone has done this and more.
-
New Award Winning Custom Feature
Photography has always been a fun hobby for me and recently I unearthed an old film camera. Studying light, thinking about how film works, and loving a good FS challenge, I was curious if I could recreate the Polaroid camera in Onshape. At the same time the Onshape team hosted an internal design contest open to all…
-
How can I optimize this FS?
I am currently finishing up a Belt and Pulley generating FS for FRC and have noticed a few areas that add a lot of generation time, some I know why, but others I don't quite understand (such as line 350's extrude). If anyone has any suggestions on where I can optimize the FS, or if there are any tips on good optimization…
-
Feedback into UI panel
Hello, is it possible to use a calculated value as a default in the UI panel and have that value displayed? Thanks Lee Hesketh
-
New FeatureScript - World Revolve
Hello all, Something I've always wanted to see added to the revolve feature is the ability to easily use a world axis to define the axis of a revolve. Since Onshape doesn't support datum axes by default, revolving around a world axis often means manually creating an arbitrary length construction line or manually selecting…
-
[FS} Speed of functions defined in versioned document versus same document
Is there a reason to expect a performance boost when calling a function from an imported versioned document as opposed to importing from another file in the same document? As an example, I copied a low-level function (`project`) from the FS stdlib into my document and renamed it 'local_project'. The profiler shows that…
-
How to make beam feature drive part numbers?
I've been using the beam feature regularly and would really like the ability to have it set the component's part number as well as name. (To the exact same thing -- nothing fancy.) I know I can do it with a mix of variables and a Part Number FS, but I'm regularly working with 8+ beams per part studio, all of whose lengths…
-
PSA: New additions to the FeatureScript Standard Library
If you aren't in the habit of regularly browsing the Standard Library Source or the Standard Library Documentation, you might have missed the addition of two new functions to the Onshape standard library in the latest Onshape release, isQueryEmpty and areQueriesEquivalent. (I guess they weren't deemed worthy of a mention…
-
Query specific edges
I'm looking for a way to query all the edges of a surface body. I'm hoping there is a way to filter only for edges that have two faces attached. I'm sure I read this somewhere but I am not able to find where it was.
-
Configuration variable range available in FeatureScript
Hey All I want to be able to display the range of a configuration variable in the feature tree. I am beginning to learn FS, so i am wondering if I can access the range (min and max value) of a configuration variable from FS? Or can I make a variable in my doc have the value of the Min or Max possible value of a…
-
Is there any scripting method to identify all arcs in a sketch to replace them with a line?
In trying to reduce the number of polygons in exported models, for performance reasons, I thought of converting all arcs within sketches to simple straight lines but have no idea how to do it through script. However, this might corrupt the sketch if there are other references to the targeted arc so a way to avoid that is…
-
Splitting Parts Removes Attributes
According to the docs at https://cad.onshape.com/FsDoc/library.html#module-attributes.fs "Attributes stay with the entity they are defined on, even as the Part Studio changes. An attribute on a face, edge, or body which is split in two will be set with the same name and value on both split pieces." However, the following…
-
Extrude Function Having Strange Behavior
Hi, while working on a shaft FeatureScript, some interesting behavior came up when using the extrude function (I do wish I could use the hole function). Where in certain inputs the extrude to apply the values work, but other times it doesn't. Some help would be greatly appreciated. Document link: TMM Featurescripts
-
Help with redundant code?
My code is very redundant, what would be a more efficient way to write this? I thought it may be a good place to use a function, but I'm not sure how to do it. if (definition.groups[g].configScope == ConfigScope.EVEN_COLUMNS || definition.groups[g].configScope == ConfigScope.ALL || evenColumnPreset) { if (evenColumn) { if…
-
Generating a sketch that can be derived in other part studios
I'm new to feature script. I'm trying to create a feature script that generates a sketch that can be derived in another part studio. So far, the feature script generates a sketch, but this sketch is not shown as an option when attempting to derive it in another part studio. Standard sketches can be derived, so I looked…
-
Direct access to imported data
It would be nice to be able to have access to image pixel data and access to the raw text of imported files inside FeatureScript, instead of just parsed CSV or JSON data. Parsed XML would be nice too but I'm not holding out. The impetus for this was working on an SVG import script.
-
FeatureScript Arrow Operator Improvements
In August of last year, Onshape added support for a new syntax operator, the arrow operator (->). It allows users to chain FeatureScript arguments together by passing the argument on the left of the operator into the function on the right as the first argument. For example, the following two statements are equivalent:…
-
Prevent selecting origin point in Featurescript entity parameter
Is there a way to prevent the origin point from being selectable in a Featurescript entity parameter, while allowing other points created by opPoint to be selectable? Roughly, I have a set of features where the user adds "points", manipulates them over the course of several features, and then I use them to generate a…
-
Cuboid Plus - New Custom Feature
Hello all! I have been using the FeatureScript function fCuboid() a lot lately, and I've been thinking that this could become a custom feature. So here is Cuboid Plus, an expansion of fCuboid(). This allows you to use the fCuboid() functionality of creating a rectangular prism between two points without needed to write…
-
Loading FeatureScript Files Crashes Session
I'm trying to become acquainted with FeatureScript by reviewing examples. Each time I try to load one, my session freezes, forcing me to quit Onshape entirely. The image shows what the window looks like when this happens. Is this a common occurrence? Might use of a different browser help (I'm presently using Safari on…