-
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?
-
Can points be added to an existing sketch with feature script?
I want to add functionally derived points to a sketch to use as anchors. Can I do this with feature script? In a way I'm asking to create a custom constraint.
-
I'm having trouble with skPolyline --- ALREADY ANSWERED...
I am having trouble with this code: var fPoints is array = []; var L = 10.0; var CL = L; var Rule = 1.0 ; for (var i = 0; i < definition.numberOfF; i += 1) { fPoints = append(fPoints,vector(0,CL*inch)); CL = CL/Rule; } skPolyline(sketch1, "polyline1", { "points" : fPoints }); I'm getting "Precondition of skPolyline failed…
-
Featurescript Custom Icons
Is there any way to set an icon for a custom feature that I have created? This would be extremely useful in distinguishing my custom features
-
opBoolean FS Question
Can I do opBoolean without user selecting the "targets"?
-
opExtractSurface on Derived feature - NOT touching the one sided edges
-
opExtractSurface using derived feature
-
@opBoolean: BOOLEAN_SAME_INPUT error message
I am trying to create 2 holes in the same body using an adaption of the featurescript from "Dowel and Minifix", I can create and subtract the first hole and create the cylinder for the second hole but when I try to subtract that I get the error "@opBoolean: BOOLEAN_SAME_INPUT". My code is as follows: <div> // Create Hole…
-
Selecting Derived Sketch
can somebody explain me , how to achieved this. I have sample code that I can use but I want to know the basic.
-
Add tooltip to feature
How do you add a tooltip to a feature like the builtin ones? If you add a "Hole" and hover over "Sketch points to place holes" you get a tooltip saying "No points selected" and on a chamfer if you hover over "Entities to chamfer" you get a tooltip "select edges or faces to chamfer". I cant locate the tooltip text anywhere…
-
getting the copied sketch
if i copied a sketch, how do i get the 2nd sketch programmatically in FS?
-
vector or plane question
can somebody explain this?
-
Either or selection of edge or face in featurescript
Sure I am missing something really obvious here but I cant see how to allow selection of either a face or an edge in featurescript.
-
Using a for loop for multiple operations on multiple parts
Hello, I have a script that makes a new sketch on a selected face, draw a rectangle, extrude and finally a Boolean subtraction. Currently it only works for one face at a time. How could I use a for loop to allow the operations to be done on all selected faces? This is for a mortise and tenon script I'm writing and when I…
-
Lighten Feature with Text
@ilya_baran I have been using the lighten feature you created with success. However, I have noticed something. If there is a remove extrude of text before the Lighten feature, then it does not work, the text however can be placed after. This did catch me out! But wanted to find out, what is it about the text that is…
-
Custom Beam Profile
So after adding the new profile to the code, how do I use the feature in my documents, all that shows up it the original beam feature, the edited one only shows up in the document which I created it in.
-
Conditional visibility of array parameters
Is it possible to have a parameter array whos individual sub-parameters can be driven by array-level logic? I don't know why, but the below precondition code does not work. I get tagged with an error on the boolean condition of the if statement. It looks like I can't reference individual "arrayVar" parameters. Is there a…
-
Feature interface programming
I am writing a feature that has a significantly complex interface. This means that the precondition in the feature is a mess. Is there a way to simplify the precondition? Such as loading annotations from another FeatureScript file, for example.
-
Featurescript Text Size
Hey FS community, I am using featurescript for a project and would like to engrave some text. However, the default text is waaaaaay too big and I can't find anything in the standard documentation of sktext for how to change size. Is there another way to create text? Am I missing an option to change font size? Thanks for…
-
Loft sketches using FeatureScript
Hello, I am trying to build a FeatureScript that will take external data, generate offset sketches and loft them. Each sketch is essentially a profile. However, I am having difficulties creating an array of sketches or profiles to then pass to the opLoft function #N00B. Could anyone take a look at my code? FeatureScript…
-
featurescript
Hi, The code is available here https://cad.onshape.com/documents/12312312345abcabcabcdeff/w/a855e4161c814f2e9ab3698a/e/b4277d7ee5ca49a493856c34 but how do we search in it ? The lack of doc of featurescript could be mitigated by an easy way to search in the code. Could we download a zip and grep locally in it ? For exemple,…
-
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…
-
Is there any video tutorials for building parametric curves with functions with FeatureScript?
Like parametric curves by interpolation and Bezier curves. Im completely new to featurescript and i have been having a hard time learning it from the material disposed by onshape.
-
duplicate an entity from a sketch
Hi using const outsideCircle = sketchEntityQuery(id + "toothSketch", EntityType.EDGE, "outsideCircle"); Is it possible to create a new sketch and duplicate the entity outsideCircle onto the new one ? (or should I keep the original parameters in variables to be able to do a new skCircle/sk... ?) thanks,
-
iterate over intersection points
Hi, Is it possible to iterate over all the vertex that intersect with an array of query object ? For example, I have those 2 circles. How do I iterate over the 2 intersection points ? const e1 = sketchEntityQuery(id + "gearSketch2", EntityType.EDGE, "baseCircle"); const e2 = sketchEntityQuery(id + "gearSketch2",…
-
query point coordinate
Hi, I have a feature script which creates 2 line and place a point of the intersection, like skPoint(gearSketch, "A", { "position" : center + vector(1, 0) * (pitchCircleRadius + addendum) }); skConstraint(gearSketch, "A_coincident1", { "constraintType" : ConstraintType.COINCIDENT, "localFirst" : "A", "localSecond" : "axis"…
-
skconstraint on the circle center
Hi, I have a line and a circle. The line is fixed and I need to place a circle at a specific position, tangent to the line. skCircle(gearSketch2, "baseCircle", { "center" : center, "radius" : arcBase.radius, "construction" : true }); skConstraint(gearSketch2, "Base_tangent", { "constraintType" : ConstraintType.TANGENT,…
-
An automated way of exporting part contours and pockets into 2D vector with different layers?
Hi, I've been using onshape for few months now and It is a great software. I am trying to improve my workflow for routing and cutting 2d shapes in my cnc and laser cutter. For the moment I am forced to create manually the 2d views for each part, export them and edit the vector drawing to split the vectors in different…
-
Accessing Feature Browser thru Featurescript
Is it possible to access the #Variable in the feature browser by Featurescript?