-
Weird Extra Mate Connectors Added by addInstance()
I have a featurescript that inserts a part from a configurable part studio at a specific mate connector. The feature brings along any mate connectors in the part studio as well. I'm using an instantiator with a partQuery specified. Like this: const instantiator = newInstantiator(id + "blockBody", {"partQuery" :…
-
How to Reference Individual Sketch Entities
I’m currently exploring FeatureScript and working on a function that creates a set of rectangles within a sketch: export function cskDraw(context is Context, sketch is Sketch, featurePrefix is string) { const offsets = [0, 50, 100]; for (var i = 0; i < 3; i += 1) { skRectangle(sketch, featurePrefix ~ ("rectangle" ~ (i +…
-
Query filter help for vertices?
I'm trying to construct a query filter which will take individual vertices, edge points, mate connectors, and/or whole sketches. When I select a whole sketch I want it to use any sketch points, or vertices of sketched lines/arc/etc, but not from construction sketch entities. I don't really understand…
-
How can I find the intersection points from 2 circles in 2 sketches (w scripting)
Hello I want to find the intersection points of 2 circles I tried : var i = 1; var j = 2; // sketches Id var test_i = id + ("sketch_" ~ i); var test_j = id + ("sketch_" ~ j); // circles Id var circle_i = "circle_" ~ i; var circle_j = "circle_" ~ j; // circle edges var edges_i = sketchEntityQuery(test_i, EntityType.EDGE,…
-
Onshape Featurescript Query - return XYZ coordinates of a mouseclicked point on a part
Hello Onshape: I want to make a featurescript that queries for the user to click a point on a surface or edge, then returns the XYZ coordinates of the spot that was clicked. This would greatly simplify a lot of work for certain kinds of freehand work that I have been doing recently. I have attached an image to serve as an…
-
Invert FeatureScript Query
There are a few times where it is easier to select a part by excluding other parts. Is there a way to invert the selection, I tried !query, but it isn't boolean. I've tried to find a list of subqueries, I can't find them in one place, but I went through the Standard Library. Keywords I've tried: opposite, inverse, logical…
-
Create a query from a Z_AXIS
I am using circularPattern in FeatureScript. It requires the axis of rotation as a query. I want to rotate around the Z_AXIS. How do I convert the Z_AXIS into a query?
-
Making queries and choosing parts
Hello, it's the third day I'm trying to figure it out but can't find a way. There are 2 "HOW TO" in the linked code I need help with: https://cad.onshape.com/documents/ea8f7cb66c45333ca1b9ef34/w/9adca070203387c455da1627/e/4b4132af1e1d18d47336a16e Can you help me with the two tasks: 1. The main thing to input is a mate…
-
How to find the id of several bodies in "Query" with several mouse Picks
I am trying to pass the body id to rename solids with a string + i (1,2,3 ...... etc) annotation { "Feature Type Name" : "Name my_Part" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "Nome",…
-
Querying the edges of a given face
Featurescript question: I have a query containing a single face, which I want to use as my axis for a circularPattern. However, the axis parameter (as far as I can tell) requires an edge not a face. How can I "convert" that face to an edge query such that i can use that as the axis?
-
Controlling the publication of Featurescripts
Is there a way we can control the publication of featurescript ? Currently we have a bunch of featurescript that we would like to call from a wrapper featurescript. Just like releasing updates in conventional programming, is there a way to release the wrapper featurescript, similar to Partstudio release. Or is there a way…
-
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…
-
How to get all faces that meet at an edge with FeatureScript?
I'm experiencing some weirdness in a FeatureScript that's supposed to get all faces that meet at an edge. I've got two thin, rectangular parts butted together at 90 degrees, and I want the user to be able to select an edge of the joint in order to automatically generate pockets and drills for cabinet fastening hardware.…
-
Queries, queries and more queries ...
Here is a simple FS: FeatureScript 736;
import(path : "onshape/std/geometry.fs", version : "736.0"); annotation { "Feature Type Name" : "FS Test" }
export const fstest = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Plane", "Filter" : GeometryType.PLANE ||…
-
How do I get the length and vertex values of a simple edge
Is there a simple example of how to query an edge for length and vertices? I've looked through several .fs examples and I get lost on what is relevant to my question. In particular the concept of context. If I pass in the edge in precondition, what should the context be when I query that edge?
-
Access to sketch elements
I'm probably missing something, but it seems to be unnecessarily difficult to access newly created sketch elements. I want to create a sketch containing two lines and then extrude one of the lines depending on other conditions. The extrude requires a query as input, but I can't find a query that will return an element with…
-
Proper way to extract/query face/vertex/edge out of a rectangle extrude (body) in Featurescript
Hello. Trying to build some simple parts as of now and have some features already in stock. For example a rectangle extrude. I would like to build some other sketches and features upon a certain face (currently the one marked with red vertices). I have a code where I can get the face/vertices/edges for next operations:…
-
How to I evaluate a query and store one of the resulting entities?
Hello, I am hoping you can help me. I would like to find the 2 largest Cylindrical surfaces on a part by surface area. I can do this, but I think there must be a better method? I am used to object oriented programming in java where I could store this sort of thing using an object. I havn't put the full code (as it long and…
-
Using entity in calls to functions that expect queries?
I'm just getting started with FeatureScript, so this is probably really naive... but I've scoured the docs and done a lot of trial/error, and I'm still mystified. I'm trying to create a feature to that makes ribs from edges that are the intersections of two faces, with the rib following a vector that's halfway between the…
-
How to create a query that will select a specific edge of a part?
I have a part that is a rectangle that is 1/4" thick after extrusion. In FeatureScript I need to select the corner edge (the 1/4" thickness, no other edges). This is so I can keep the part flat but Fillet the corner (just the vertical edge). I can do this manually be don't know how to create a FS query to do the same…