-
The areQueriesEquivalent method does not work when compared to evaluateQuery?
I'm developing a simplistic feature that takes two inputs: A face An edge My only constraint is that the edge belong to the face. In other words, if I query the face for all edges, I expect that the edge selected will also be in the set. To accomplish that, I've written a simple FeatureScript function called…
-
Hey FeatureScripters - What would you like to see in an advanced FeatureScript tutorial?
Hey everyone, I'm Josh, one of the Part Studio developers. Recently I decided the community could use a more advanced tutorial to cover some of the trickier topics in FeatureScript: Queries, ids, transient ids, robust queries, tracking queries, etc. We could also cover common problems, gotchas, tips n' tricks, that sort of…
-
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 +…
-
@OPPATTERN: INVALID_INPUT
FeatureScript 2345;
import(path : "onshape/std/common.fs", version : "2345.0"); annotation { "Feature Type Name" : "Pattern Line"}
export const patternLine = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Select Line:", "Filter" : EntityType.EDGE,…
-
@opPattern: INVALID_INPUT
Trying to duplicate a user-selected line. No idea why these two Featurescripts attached below aren't working. Out of ideas. @NeilCooke HELP! Also, side questions:1) What's the best way to have the pattern be perpendicular to the line? Currently they're in the same direction. I was hoping to be able to go…
-
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.
-
Instantiate and Query Preservation?
I am attempting to store queries(of edges) in a FeatureScript attribute of parts, and then derive those parts into another context. It seems to not preserve the query when using the instantiate function and I'm guessing that's because opMergeContexts() doesn't go into FeatureScript attributes. Is there a way I can go and…
-
How to query "self-referencing" entities that are generated in the feature
Hi there, This is a bit of a weird one. I want to be able to have the user give an initial set of inputs, have a script that uses those to generate some sketches and bodies, and then (still in the UI screen) for the user to be able to fill out a Feature Parameter Query with one of the entities created from the feature. In…
-
Filleting edges created by an extrusion using startTracking?
I'm working on a digital (i.e. cnc router-cut) joints project, and many of the joints will have extruded geometry with fillets on the vertical edges (to accommodate cutter radius) that gets subtracted from another body to form the joint. One example is this "Halved Dovetail" I create the feature by creating the half lap…
-
How do I select an adjoining part in FS
I have a part studio with multiple parts, I want to be able to select 2 faces on one part and then also work on the part that adjoins it as below: The mock up is available at https://cad.onshape.com/documents/1d8686fa8d2943b37843e397/w/4b929d003a5a139e2f77286e/e/e0979796b001bdae18a9981c I can easily get all parts by using:…
-
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?
-
qFarthestAlong not behaving as expected
I am working on a FeatureScript which begins by finding the furthest parallel planar face which is part of the same body as a selected planar face. To do this, I am finding the vector opposite the normal vector of the selected face and using this as the direction for qFarthestAlong; however, debugging this query seems to…
-
Unable to fillet an existing object - Need help
Hi, I am unable to fillet an existing object, it always throws up errors and ive tried everything to get around this such as trying to draw arcs with lines so i wouldnt have to fillet after i extrude to no avail. Here is my code: var length = 100*millimeter; var depth = 50*millimeter; var width = 500*millimeter; var…