-
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…
-
Laser joint but with single pin for sloting parts
Hello, as part of a laser cutting project, I want to create a number of parts that slot together. Similarly to how the laser joint Featurescript works but with only a single pin that takes up half the overlapping distance. As can be seen in the photo. Currently, I am doing this by hand but there is an incredible amount of…
-
Possible Editing Logic bug with Array parameters
[Only not posting to support because I first want some community feedback about whether I'm using Editing Logic incorrectly]MWE: https://cad.onshape.com/documents/6aeee181faba5f5f7d8abf2d/w/6af36a1d3037a2e5b20744d4/e/c8beebf8888117a1279d1623 My EL function is modifying feature parameters based on whether any entity is…
-
Using a Part Studio Reference Parameter Breaks ErrorStringEnum Functionality
For a bit of background, ErrorStringEnums are the internal Onshape error messages which are utilized by every Onshape standard library feature in order to make translating and standardizing error messages easier. Although ErrorStringEnums are not currently exposed to users directly in the documentation, the three types of…
-
Why do attributes not come through when instantiating?
When instantiating part studio reference parameters, I'm able to get the attributes to come through if I use the legacy setAttribute(), but with the new setAttribute(), where you can specify a name, it doesn't seem to work? Thanks in advance!
-
Abusing UIHints for Fun and Profit
I had some fun making an early April Fool's joke about adding microtransactions to my featurescripts. This uses UIHint.REMEMBER_PREVIOUS_VALUE, UIHint.ALWAYS_HIDDEN, and an editing logic function to keep track of how many times someone has used a script and encourages them to buy more uses when they run out. An example of…
-
Using the custompropertyID to show custom property in a custom table
Can someone show me the correct syntax to use the customPropertyID with PropertyType.CUSTOM? I just can't get it to work for some reason (mostly because I have almost no idea what I'm doing with FS!), but trying hard to learn..... var custom1 = getProperty(context, { "entity" : part, "propertyType" : PropertyType.CUSTOM,…
-
[FS] JSON Writer
Has anyone written a function to convert a map to a JSON string? (Basically the inverse of parseJsonWithUnits). Just looking for something rudimentary. It may be hard to do this if the map contains non-basic types. (e.g. after serializing a "plane", it wouldn't be straightforward to know that you needed to interpret the…
-
Managing a FeatureScript Library
Hey guys, We've spent the last year building a great set of custom features for our joinery company. But as the library grows, we're finding it difficult to keep on top of feature updates. We're splitting out bits of FeatureScript into functions that can be reused in different features, but then you have the issue of…
-
Pre selection logic?
I'm having trouble understanding how to export a function. Can someone give me some pointers? Here is what I'm trying to do: If you have pre selected a plane and a vertex, then click the feature, the feature will detect that you are wanting to use the "Up to vertex" method. I'm trying export these definitions so that the…
-
Set name property of curves with featurescript
In FS it's currently forbidden to set the name property of a curve (only works with bodies and faces). However, you can select and rename curves in the GUI, so it seems that this shouldn't be a fundamental issue. I have a system that needs to generate many curves and then allow the user to select them, and having a name…
-
Make a Configuration Variable that can accept a FS array/ any FS expression
I must be missing something. I'm trying to have one of my configuration variables accept an FS array, but when I attempt to specify the configuration variable type, I just get the options of Length, Angle, Integer, Real or Text. Is there no way to put in a general FS expression? The general PS variables have an "Any" type.…
-
getAllAttributes
With the switch to named attributes, we now use "getAttributes" to retrieve specific attributes from a specific entity:const value = getAttribute(context, { "entity" : entity, "name" : "importantData" }); Does anyone know a way to return all named attributes on an entity? Perhaps this would require a new function…
-
[FS] Determine if feature is the final enabled feature in the part studio
Is there a way inside a feature to determine if that feature is the last one in the list? I'm developing a system where the user performs many small "atomic" operations (there might be 10-100 of these) that are extremely cheap, but then to visualize the result of the full sequence requires one big "solve" that is…
-
How do I set the "MaxNumberOfPicks" with a query?
How do i set the max number of picks with a query? precondition
{
annotation { "Name" : "Group Size" }
isInteger(definition.quantity, POSITIVE_COUNT_BOUNDS); annotation { "Name" : "Parts", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
definition.parts is Query;
}<br>
-
How to calculate the farthest point within a piece?
I would like to know if there is some kind of Feature Scripti capable of searching the furthest path of a flow of plastic material injected into a part. (I hope I have explained myself well :) )
-
custom msg for undefined table cell
For FS tables, does anyone know if it is possible to replace "Not set" with a custom message/value?
-
How to find intersection points for some entity types in FS
Any leads how to find in FS: 1- WiredBody(Spline) - WiredBody(Spline) intersectionPoint; 2- WiredBody(Spline) - Plane intersectionPoint
-
Pattern point to point help?
I'm trying to transform copy a selected face from one point, to another so that I can use it in multiple places. I keep getting stuck on opPattern or transform. Can someone help me understand how to do this? Here is what I have so far. The opPattern is where it breaks. var count = -1; for (var edges in pathFaces)
{ count =…