-
Allowing for mate connector selection. What's the correct syntax?
I'm testing out different query types and wanted to allow for users to select a Mate Connector. However, when I wrote out: Filter" : EntityType.BODY && (…|| BodyType.MATE_CONNECTOR), the feature dialog doesn't allow for mate connector selection or show the mate connector symbol until I add || AllowMeshGeometry.NO as well.…
-
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" :…
-
Query Finder (A new way to automate Onshape!) 🆕
. CADSharp is introducing a new way to automate Onshape! Actually, this isn't new, but it has never really been easily available for all users. (no coding required) . Query Finder Save and use selections across features and even across part studios. Use this functionality to automate your downstream selection process. .…
-
Query sheet metal bend / flange center line
Hello there ! I'd like to measure the distance between a hole axis and my sheet metal bend center line (the dotted line inside the sheet metal flat view), but i'm having a hard time querying it I did managed to do a "manual" query of the center line ike so : annotation { "Name" : "Center line", "Filter" : EntityType.BODY…
-
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 "bodies this side of plane "?
Is there an efficient way to query all bodies on one side of a plane?
-
@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…
-
How can I see if a Boolean subtract has modified an object?
I am passing a pipe with some fittings through a concrete wall and I need to know which of the pipes and fittings are going to be embedded in the concrete. One approach is to use the Boolean subtract with each pipe/fitting one at a time. Then I need a method to see if the concrete wall has been modified after each Boolean…
-
Query vertices of mixed part?
I would like to take advantage of the new mixed modeling. I'm starting with an STL body as the main input, but I can't seem to query any of the vertices. Is there a way to query the vertices of a mixed part?
-
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…
-
qSubtraction part edges vs sketch edges?
I'm trying to preform a qSubtraction by subtracting the edges of a face and desired excluded edges. The subtraction works when both selections are on a part, but it doesn't work when the selection is a sketch face and a sketch edge belonging to the sketch face. How would I preform a qSubtraction between the edges of a…
-
Query the target of an opBoolean subtract operation
Hi, I have the following code in my FS: opBoolean(context, id + "booleanInset", { "tools" : qCreatedBy(id + "extrudeInset", EntityType.BODY), "targets" : mortiseBody, "operationType" : BooleanOperationType.SUBTRACTION, "targetsAndToolsNeedGrouping": true, "keepTools" : false }); Obviously the mortiseBody variable contains…
-
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…
-
How to find the radius or diameter of a curve in Featurescript
I'm trying to amend some code to generate a spur gear - eventually I want it to create a helical gear, but I have to walk before I can run! The starting position is that I will have created a part studio with the relevant gears as blank extruded pieces. The diameter of the extrusions are the gear tip diameters as I'm…
-
Using partQuery in FeatureScript to retrieve parts
Hi, I noticed the "get parts in PartStudio" returns a partQuery that looks like below: "partQuery":…
-
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…
-
New point every(x) distance on line
I'm looking for a way to add a point using featurescript every x distance on a line...the tricky part is that the line doesn't have to be aligned to any certain axis, it could be askew to any axis. I'm sure there is some vector math that I am unaware of. Please point(hah!) me in the right direction! To clarify, lets assume…
-
Querying points on a curve
Hi I am currently working on a script to auto spline between my aerofoils, but I am having trouble's. I tried querying the vertices adjacent to the profile, however this only gave me the leading and trailing point. I have now queried the upper and lower splines and attempted to do a line intersect but obviously a spline…
-
Featurescript: Select all outer faces adjacent to a seed face
I've tried all sorts of variations of qLoopBoundedFaces, qFaceOrEdgeBoundedFaces, and qEdgeAdjacent... no cigar. For example, given the start face of an extruded ring, what combination of queries will retrieve the cylindrical outer surface? It seems whatever I try ends up with all the surfaces of the extrusion. This would…
-
query input validation
Is there a way to reject a query selection based on arbitrary criteria? For example, what if I wanted to accept a face as an input, but I wanted to reject any face that lacks at least one linear edge? What if I wanted to only accept circular faces, blue faces, or faces whose Normal points 37 degrees North?
-
get vertices for an edge query?
My feature queries for an edge, and I need to know the locations of its endpoints. How do I do that? (Apologies for the noob question, but I've been digging for twenty minutes and can't find it.)