featurescript
Discussion List
-
Building a full model with featurescript?
Out of curiosity - does anybody here use featurescript to build "full models" rather than well... just features? I haven't really dug into featurescript myself, but plan on it when I have some time. I have found many custom features created by other users extremely useful, but I don't really know what I'd try to use it for…
-
How can I make an array of points created by a for loop in featurescript?
for (var i = 0; i < numberOfDowels; i += 1) { opPoint(context, id + ("locationPoint" ~ i), { "point" : toWorld(cSys, vector((fenceDistance + (dowelSpacing * i)), 0 * inch, 0 * inch)) }); } var locationPoints is array = evaluateQuery(context, qCreatedBy(id + ("locationPoint" ~ i), EntityType.BODY)); This gives me an error…
-
opSplitFace - Invalid Input
I hoping someone can explain to me why this script is failing: https://cad.onshape.com/documents/13e9c12a44cf54f198c08ea5/w/2c9e84ed0d4301b95e18ebf2/e/ed69f87a561cc4d22f3deb33 Ultimately this is to be part of a more complicated script. I wrote this simple script to troubleshoot and apparently I don't understand what…
-
skConstraint / Newbie to featurescript
I'm just starting to work with featurescript and I have no programming experience so there are some large gaps in my knowledge. I've been working off of a script written by someone who actually knew what they were doing which imports solid tool-bodies from a separate context and uses them to create machining details at…
-
list of boolean
I want to export a list of boolean , similar to export enum but list of strings, where user can check 1 or more strings. Can somebody point me to the right direction?
-
Featurescript - Evaluate centre of circle
I am embarking on my first custom feature creation! I have run into an issue someone might be able to shed some light on.I have selected the edge of a circle and would like to get the centre point to place a hole on. I have the below code to evaluate the selected circle: var circleCentre = evCurveDefinition(context, {…
-
Hole Feature Naming
Is it possible to create a hole feature that names the feature the same as the tap information or clearance information? For example if a hole feature creates a tapped hole for a M3x0.5 screw, the feature would be called M3x0.5, and if the hole feature creates a clearance hole for the M3x0.5 screw, the feature would be…
-
How to get adjacent sketch entities?
I'm trying to use qAdjacent to find entities in the sketch which share a vertex, however qAdjacent only seems to work properly for non sketch entities. If I select an edge on a body it works fine. My query is: qAdjacent(qNthElement(definition.myEdges, i), AdjacencyType.VERTEX, EntityType.EDGE)<br> It works just as expected…
-
Projection of an edge onto a sketch
considering I have an edge selected(input) and would like to project that edge onto a sketch from a feature script, using the 'skConstraint' command in the feature script is the solution but i am unable to figure out the syntax for using the 'Projected' constraint type in this situations. any suggestions????
-
evRaycast not reporting all face intersections
I'm trying to use evRaycast to get all points where a ray intersects the face of a body. It mostly seems to be working however I have run into a strange issue. A single point is missing from what I would expect to be an intersection. I've included a screenshot where I have circled the "expected point" in black and a link…
-
Linking a configurable variable in an assembly
Given that (to my knowledge) there is no way to have a sketch text linked to a configurable variable I went ahead and wrote my own feature script that takes a text field in the from a configurable variable and engraves said text onto the part.This part is then used in an assembly and I want to, in the assembly level, be…
-
Creating Plane through 3 Points in featureScript
Does anyone have any tips for creating a new plane through 3 points. Have not had any luck with all test attempts of cPlane, opPlane, etc. var b = vector(32, 56, 0) * millimeter;var a = vector(88, 0, 0) * millimeter;var c = vector(88,56,50) * millimeter;var _origin = (a+b+c)/3;var _normal = cross((c-a), (b-a));var newplane…
-
Sketching in FeatureScript - Coincident constraint between two vectors
I'm currently learning how to sketch in FeatureScript. I want to know if there's a way to sketch with constraints before using skSolve. For example if I want to make a tangent arc with its two end points coincident to two end points of a pair of parallel lines. The arc has to be tangent with both lines. Is there an easy…
-
Ellipsoid custom feature
In support sometimes we get a chance to create tools that bridge the gap between current functionality and potential future functionality through the use of FeatureScript and custom features. In this case, a feature to create ellipsoids! With independant x/y/z dimensions. Check it…
-
How to calculate distance across a surface?
My goal is to write a script to add a hexagonal pattern of hexagonal tiles across a series of adjacent surfaces. However, I'm new to Featurescript so at an early stage. Where I'm stuck at the moment is trying to convert from real-world distances to the "2d unitless parameter-space" used as parameters…
-
Configurations update: Edit FeatureScript IDs
In addition to the other new features already mentioned, Onshape 1.78 added a piece of functionality specifically for the purpose of writing FeatureScript that builds configured Part Studios. As you may already know, the user-facing names of configuration inputs and the user-facing names of configuration table rows can be…
-
Using partQuery in FeatureScript to retrieve parts
Hi, I noticed the "get parts in PartStudio" returns a partQuery that looks like below: "partQuery":…
-
Evaluate existing FeatureScript using API
I understand the 'Evaluate FeatureScript' endpoint takes in "script" and "queries" in the body of request for API call and I have had some luck using the API this way.But I keep thinking there should be a way to reference an existing FeatureScript that lives in a document. Does anyone have any experience doing this?…
-
LaserIt Feature Release
Hi Onshapers! I just finished this feature called LaserIt, which takes an arbitrary 3D solid and slices it to be laser cuttable (or some other 2D planar machining technique). Here are some images of it in action! I'd love to hear what you think!…
-
"For Each" feature in Onshape?
This could be an improvement request or feature script thought, but I've been noticing that there are a few features that I have to set up multiple times, when really I'm doing the same thing. For example, I need to make a new feature for every "Fill Surface" call, even if I want to use the feature on a hundred individual…
-
Calculate Bounds
Hello I use onshape to prepare parts to Cam when I do so I do create a stock That in close the model and I did find this very nice featurescript. Called Calculate Bounds The only problem with this script is that I cannot control if I want to more offset in X or Y or Z. Do someone now how you can add an offset tab. maybe if…
-
How to create a Natural Spline / Minimal-Energy Spline
I'm working on a new FeatureScript to quickly create hose routings: In the FeatureScript I can select a start, end and midpoints. A fitspline is going through all points. * Now I would like to know how to create a "Natural Spline / Minimal-Energy Spline" This means that the spline should behave like a bend hose/wire. * Can…
-
Surface Pattern - with options [NEED HELP]
Hi folks, I have a need to produce a pattern of counterbored holes, that share a normal direction, but the depth of which is driven by (with an offset) a surface or series of surfaces. (here's a link to this doc, for what it's…